vscode-bazel
vscode-bazel copied to clipboard
Syntax highlighting in BUILD files
I don't get syntax highlighting only in BUILD
files (language mode defaults to "Plain text").
If I rename my file to BUILD.bazel
, the syntax highlighting turns on.
BUILD
files should be recognized since they're listed in the package.json file here: https://github.com/bazelbuild/vscode-bazel/blob/master/package.json#L152
If you invoke the "Developer: Toggle Developer Tools" command, do you see anything in the console log that would indicate what might be happening?
No - no message in the console.
Features like "Format document" and the target overlay are working.
Edit: same problem with WORKSPACE
. But WORKSPACE.bazel
works.
In the bottom-right area of the status bar, there should be a language identifier. Does it say "Starlark" or "Plain Text"? And if it's the latter, does changing it to "Starlark" fix it?
It says "Plain Text". Changing it to "Starlark" fixes it.
Puzzling. I'm not sure what would cause your workspace to have a different configuration for those particular files, unless you had another extension installed that was colliding with ours, or if there was some other old state interfering with it.
It would be interesting to know if this happens on a completely fresh VS Code + vscode-bazel install.
I've disabled all other extensions. The extension was just installed:
Name: vscode-bazel
Id: bazelbuild.vscode-bazel
Description: Bazel BUILD integration
Version: 0.1.0
Publisher: The Bazel Team
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=bazelbuild.vscode-bazel
and VS Code looks up-to-date:
Version: 1.30.2
Commit: 61122f88f0bf01e2ac16bdb9e1bc4571755f5bd8
Date: 2019-01-07T22:49:48.319Z
Electron: 2.0.12
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
OS: Linux x64 4.18.10-1rodete2-amd64
If you have any other idea, I can investigate tomorrow.
@laurentlb, did you ever have any luck resolving this?
My experience is inverted. I'm on a macos. I'm finding that *.bazel files are not syntax highlighted by default but BUILD files render fine.
Here's a screen shot from my Extensions -> vscode-bazel -> Contributions
tab. I can see that .bazel
is not included in that list.
I'm running
Version: 1.39.0
Commit: 9df03c6d6ce97c6645c5846f6dfa2a6a7d276515
Date: 2019-10-09T06:57:43.593Z
Electron: 4.2.10
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Darwin x64 18.7.0
Name: vscode-bazel
Id: bazelbuild.vscode-bazel
Description: Bazel BUILD integration
Version: 0.3.0
Publisher: The Bazel Team
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=BazelBuild.vscode-bazel