Skip to content
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

Closed
msonnabaum opened this issue Dec 28, 2016 · 8 comments
Closed

Scripts named "build" are detected as bzl #1340

msonnabaum opened this issue Dec 28, 2016 · 8 comments

Comments

@msonnabaum
Copy link

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.

@brammool
Copy link
Contributor

brammool commented Jan 6, 2017 via email

@DanGe42
Copy link

DanGe42 commented Jan 10, 2017

The same behavior is on MacOS because HFS defaults to case-insensitive.

@msonnabaum
Copy link
Author

Yeah, I'm on MacOS.

@brammool Just tried your suggestion and that seems to work for me.

@chrisbra
Copy link
Member

chrisbra commented Mar 5, 2017

fixed as of 6856393

@chrisbra chrisbra closed this as completed Mar 5, 2017
@dbarnett
Copy link

dbarnett commented Apr 9, 2017

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?

@artasparks
Copy link

artasparks commented Apr 14, 2017

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"?

@brammool
Copy link
Contributor

brammool commented Apr 15, 2017 via email

brammool added a commit that referenced this issue Apr 15, 2017
Problem:    Cannot detect Bazel BUILD files on some systems.
Solution:   Check for BUILD after script checks. (Issue #1340)
@dbarnett
Copy link

dbarnett commented May 4, 2017

Did we decide to stick w/ completing disabling the detection if fname_case is missing? It rather hobbles the filetype detection on OSX.

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.

desvp pushed a commit to desvp/vim that referenced this issue May 30, 2017
Problem:    Cannot detect Bazel BUILD files on some systems.
Solution:   Check for BUILD after script checks. (Issue vim#1340)
justinmk added a commit to justinmk/neovim that referenced this issue Apr 2, 2018
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
justinmk added a commit to justinmk/neovim that referenced this issue Apr 2, 2018
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants