New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scripts named "build" are detected as bzl #1340
Comments
Mark Sonnabaum wrote:
I was surprised to see strange syntax highlighting on a shell script
named "build", with `#!/bin/sh` for the shebang. I checked the
detected filetype and it was "bzl".
I then found this setting, which sets any file named build or
workspace as bzl:
https://github.com/vim/vim/blob/master/runtime/filetype.vim#L312
Considering that it also appears to be case-insensitive, that feels
too ambiguous to be a default in vim. It would be great if that could
either be made case-sensitive or removed and left to a bzl specific
plugin.
You are using MS-Windows? The filetype rule checks for BUILD, thus on
case-sensitive systems it should not trigger for "build".
How aobut this:
" Bazel (http://bazel.io)
autocmd BufRead,BufNewFile *.bzl,WORKSPACE setfiletype bzl
if has("fname_case")
autocmd BufRead,BufNewFile BUILD setfiletype bzl
endif
Disadvantage: a "BUILD" file on MS-Windows won't be recognized as bzl.
I don't think it's easy to recognize a bzl file from the contents, it
looks a lot like Python.
…--
hundred-and-one symptoms of being an internet addict:
197. Your desk collapses under the weight of your computer peripherals.
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|
The same behavior is on MacOS because HFS defaults to case-insensitive. |
Yeah, I'm on MacOS. @brammool Just tried your suggestion and that seems to work for me. |
fixed as of 6856393 |
Would it be possible for whoever authored those changes to apply them to https://github.com/bazelbuild/vim-ft-bzl/blob/master/ftdetect/bzl.vim to keep it in sync? |
This is unfortunate, since it really neuters this ftdetect declaration. BUILD is the standard name for bazel BUILD files, and now on OSX and Windows it won't be recognized correctly. https://bazel.build/versions/master/docs/build-ref.html#BUILD_files I haven't looked in depth through the ftdetect, but what about just moving the bazel-detection after something that looks for "#!/bin/sh"? |
Josh Hoak wrote:
This is unfortunate, since it really neuters this ftdetect declaration. BUILD is the standard name for bazel BUILD files, and now on OSX and Windows it won't be recognized correctly. https://bazel.build/versions/master/docs/build-ref.html#BUILD_files
I haven't looked in depth through the ftdetect. What about just moving the bazel-detection after something that looks for "#!/bin/sh"?
It is unfortunate that they picked such a common name for their files.
Now it's difficult to tell the type of file from the name.
We could check for no other type being detected, near the end, and then
catch "build" and "BUILD".
…--
ARTHUR: Well, it doesn't matter. Will you go and tell your master that
Arthur from the Court of Camelot is here.
GUARD #1: Listen, in order to maintain air-speed velocity, a swallow
needs to beat its wings 43 times every second, right?
ARTHUR: Please!
The Quest for the Holy Grail (Monty Python)
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|
Problem: Cannot detect Bazel BUILD files on some systems. Solution: Check for BUILD after script checks. (Issue #1340)
Did we decide to stick w/ completing disabling the detection if Is applying it w/ lower precedence still an option? Or if not, maybe we could explicitly detect and exclude files with a shebang line at the top, since BUILD files should never have that. |
Problem: Cannot detect Bazel BUILD files on some systems. Solution: Check for BUILD after script checks. (Issue vim#1340)
Problem: Cannot detect Bazel BUILD files on some systems. Solution: Check for BUILD after script checks. (Issue vim/vim#1340) vim/vim@39170e2 vim-patch:8.0.1283: test 86 fails under ASAN
Problem: Cannot detect Bazel BUILD files on some systems. Solution: Check for BUILD after script checks. (Issue vim/vim#1340) vim/vim@39170e2 vim-patch:8.0.1283: test 86 fails under ASAN
I was surprised to see strange syntax highlighting on a shell script named "build", with
#!/bin/sh
for the shebang. I checked the detected filetype and it was "bzl".I then found this setting, which sets any file named build or workspace as bzl:
https://github.com/vim/vim/blob/master/runtime/filetype.vim#L312
Considering that it also appears to be case-insensitive, that feels too ambiguous to be a default in vim. It would be great if that could either be made case-sensitive or removed and left to a bzl specific plugin.
The text was updated successfully, but these errors were encountered: