Sublime Forum

Find Results in compressed JavaScript shows the entire file

#1

I noticed that Find Results in a compressed JavaScript file (single line) shows the entire file.

It’s rather annoying to scroll through as the compressed JS files tend to be very large.

Is this a bug or a feature? Is it possible not to show the entire JS file?

0 Likes

#2

Probably not a bug, but a feature. Find shows what line the target was found on. Since compressed Javascript compresses to one line…you get the idea.

If Find was configured to only show up until the target, you would not get the context in which the result is found. How far should you show until you truncate? In normal coding practices, showing the entire line is more than acceptable, a matter a fact, I would say required. Not many people are searching compressed Javascript, they are searching the original source because people don’t usually modify compressed Javascript; compressed Javascript is the final release state.

0 Likes

#3

Not many people are searching compressed Javascript, they are searching the original source…

Well… how do I exclude the compressed JS files? I have an application with several thousand small JavaScript files and a small number of large compressed JS files… Id’ like to exclude the compressed files from my searches, but this is not possible.

0 Likes

#4

Ideally, you would export your compressed code somewhere separate from your source code, and probably even give some specifier to let you know it is compressed (source.js => source-min.js). Then, when you search folders you can add an exclude filter

example of path to search, files to search, and files to exclude (min.js)

c:\somepath\folder\blah,*.js,*.css,-*min.js

I am not sure if you can exclude certain folders with the exclude filter, you would have to play around with it; I haven’t tried to define folders in an exclude filter yet, but it might work, but I know you can define wildcards for file names.

I think you might be able to exclude certain folders from a project in general (I have never tried to do this), those exclusions may get picked up my Find (if you can even do this); I don’t know though. Maybe some others can chime in here.

0 Likes

#5

You can exclude files in the project settings:

sublimetext.com/docs/2/projects.html

0 Likes