sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
807 stars 39 forks source link

feature: add option for gotoanything to ignore files without extension #6007

Open ryuukk opened 1 year ago

ryuukk commented 1 year ago

Problem description

These are executables on unix, often they are just shell scripts, so i propose this feature to be opt-in rather than opt-out

In my project however they are not, so i don't want them to appear on the preview

game game_main.d

When i open the goto menu, it always preview the binary first, wich i don't want, i want the source code, so please add that option

Preferred solution

An option to disable files without extention from showing up

Alternatives

There is no alternative found

I can't ignore a folder because there are text assets in the folder next to the executable

Additional Information

No response

rchl commented 1 year ago

Shell scripts are not binaries. For actual binaries it would make sense to enable:

    // Determines whether Goto Anything should exclude files ignored by git.
    "goto_anything_exclude_gitignore": false,

since those should likely already be excluded by git.

Alternative option is to adjust this setting (can be done per-project also):

    // These files will still show up in the sidebar, but won't be included in
    // Goto Anything or Find in Files
    "binary_file_patterns": ["*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip"],
ryuukk commented 1 year ago

I never said shell script are binaries, please read what i wrote, i said some are using them as executable, hence why some strip the .sh extension

This was an argument for opt-in vs opt-out for the feature i suggest, not my use case

I said it's not the case in my project, files without extension are elf executables (binary)

Hence none of the option you mention are valid

Hence, again, i suggest you add an option to ignore files without extension, i repeat it because i feel like you didn't read my comment

Sometimes i feel like you guys waste time on purpose

How am i supposed to type a "non extension", in your "binary_file_patterns": ["*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip"],

?????

"goto_anything_exclude_gitignore": false,

i don't use git in this project and this is not a solution, nobody wants to micro manage a file to workaround a bad design, either fix it, provide a setting, but please don't recomand people to do dumb stuff

rchl commented 1 year ago

"binary_file_patterns": ["*"]

(Must be fun to go through life being constantly annoyed at everything and everyone...)

ryuukk commented 1 year ago

"binary_file_patterns": ["*"]

This doesn't work, it can't find any file anymore, again please read my original post

(Must be fun to go through life being constantly annoyed at everything and everyone...)

This is not a open source and free product, it's a paid product, expectations

Otherwise i'd have fixed it myself and not annoy anyone

ryuukk commented 1 year ago

image

I don't want this file to show up when i do:

image

If i set "binary_file_patterns": ["*"], then it doesn't show anything at all

image

So i have to repeat again, i suggest adding an option for game, wich is an elf executable, to not show up at all

In case you want to examinate the file, here it is: game.zip

jwortmann commented 1 year ago

Have you tried to put "game" into "binary_file_patterns"?

game

I don't think there is a way to create a file pattern to match arbitrary extentionless filenames, if you need a more general solution.

ryuukk commented 1 year ago

As you can see, there are multiple binaries, and again, i have to repeat myself, I will not hardcode binary names, i don't want to micro manage

And again, this is a suggestion for a feature, i'm not here asking for workarounds

deathaxe commented 1 year ago

Ignoring all files without extension (opt-in or not) is probably not the best solution, as correctly stated in first post, those can be executables or shell scripts. The latter ones are probably worth keeping for preview.

Binaries should however be excluded from Goto Anything as previewing large chunks of hex code is not useful and those are rather unlikely to be desired targets to got to. That's especially annoying as it may sometimes delay preview of next matching files while typing file names quickly.

ST already ignores binary files from Goto Anything, just not those without extension.

As it is already able to detect binary files per content and scopes them binary.plain, I wonder whether that scope is stored in ST's internal file catalog. If so, excluding files per main scope should be possible in addition to existing filter techniques.


... nobody wants to micro manage a file to workaround a bad design ...

It is common practise build artefacts (executables, libraries or intermediate object files) to be organized in separate sub directories (e.g. output or build, ... ).

So it is easy to add related folder(s) to a .gitignore file without the need to add rules for each file individually.

It requires however a project to be git tracked and no other text files to be .gitignored which might be of interest for Goto Anything.

So whether "goto_anything_exclude_gitignore": true is sufficient or useful depends on the use case. It however doesn't just exist as a workaround for anything.

ryuukk commented 1 year ago

It is common practise build artefacts (executables, libraries or intermediate object files) to be organized in separate sub directories (e.g. output or build, ... ).

It is common practice to not preview a file you don't want to open

If previewing wasn't a thing, i wouldn't complain about it

ST needs a simpler way to switch files