How to reproduce:
Create file named "build", put anything into it, eg. #!/bin/bash, and then save it.
Closing and opening the file switches to "NAnt Build File", also on Sidebar file is wrongly detected.
first_line_match rule is used. That's why the shebang is ignored.With that said this issue is not related with the _Default Packages_ and can not be fixed in the syntax defintions without changing ST core behavior.
A backward compatible solution would probably be to introduce a new file_pattern context which was used instead of file_extensions if exists. It would then need to support simple file patterns.
file_patterns:
- *.build // file extension
- build // file name
see https://github.com/SublimeTextIssues/Core/issues/1353 for a prior discussion
FWIW, I use ApplySyntax for more fine-grained control until things like @deathaxe's wish are implemented. Here's the main problem I use it for:
~/.ssh/config~/projects/foo/.git/configBoth files have the same filename. Neither one has a shebang or other guaranteed first line stuff. How do you distinguish them? Even with @deathaxe's system, can the patterns test the full path?
Even ApplySyntax comes with a caveat: I have to disable its default rules by setting default_syntaxes: [] to avoid interfering with the PackageDev-defined languages for special XML files (.tmPreferences, etc.).
As a side note, I'm not sure build is a specific enough extension to justify having it opened with the C++ build system thingy by default. Meson, for example, also uses the .build extension, though that is always written as meson.build.
Can you think of other examples?
Most helpful comment
see https://github.com/SublimeTextIssues/Core/issues/1353 for a prior discussion