Syntax Highlighting BUILD Files

1,191 views
Skip to first unread message

Samuel Littley

unread,
Apr 2, 2015, 1:15:42 PM4/2/15
to bazel-...@googlegroups.com
Hi All,

Does anybody have a Textmate compatible syntax definition for BUILD files (i.e. a .tmLanguage file)? I'd love to have syntax highlighting in Sublime Text! Is there one floating around internally at Google that could reasonably be released to the outside world?

Best,

Samuel Littley

Shawn Pearce

unread,
Apr 2, 2015, 1:17:36 PM4/2/15
to Samuel Littley, bazel-...@googlegroups.com
BUILD is basically a subset of Python. Can you force the editor to try
Python mode?

Samuel Littley

unread,
Apr 2, 2015, 1:32:43 PM4/2/15
to bazel-...@googlegroups.com, samuel....@toastwaffle.com
That's a very good start, yes. I am slightly ashamed of not having though of that before!

It would however be nice to have keyword highlighting for the various Bazel rules, so I'd still be interested to know if such a thing exists? Otherwise I foresee myself creating one in the next few days...

Ulf Adams

unread,
Apr 2, 2015, 1:58:44 PM4/2/15
to Samuel Littley, bazel-...@googlegroups.com
I'm not aware of one.
--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To post to this group, send email to bazel-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/a9f0fcd4-df58-4766-a7cf-8ca493fd0fcb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

b...@folsomlabs.com

unread,
Apr 2, 2015, 10:54:20 PM4/2/15
to bazel-...@googlegroups.com, samuel....@toastwaffle.com
This doesn't help with Textmate exactly, but Vim users there exists a simple syntax plugin for Pants, which uses a BUILD dialect sufficiently similar to Bazel that it could fairly trivially be adapted.  https://github.com/pantsbuild/vim-pants


On Thursday, April 2, 2015 at 10:58:44 AM UTC-7, Ulf Adams wrote:
I'm not aware of one.

On Thursday, April 2, 2015, Samuel Littley <samuel....@toastwaffle.com> wrote:
That's a very good start, yes. I am slightly ashamed of not having though of that before!

It would however be nice to have keyword highlighting for the various Bazel rules, so I'd still be interested to know if such a thing exists? Otherwise I foresee myself creating one in the next few days...

On Thursday, 2 April 2015 18:17:36 UTC+1, Shawn Pearce wrote:
On Thu, Apr 2, 2015 at 10:15 AM, Samuel Littley
<samuel....@toastwaffle.com> wrote:
> Does anybody have a Textmate compatible syntax definition for BUILD files
> (i.e. a .tmLanguage file)? I'd love to have syntax highlighting in Sublime
> Text! Is there one floating around internally at Google that could
> reasonably be released to the outside world?

BUILD is basically a subset of Python. Can you force the editor to try
Python mode?

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discuss+unsubscribe@googlegroups.com.

David Chen

unread,
Apr 3, 2015, 1:35:02 AM4/3/15
to b...@folsomlabs.com, bazel-...@googlegroups.com, samuel....@toastwaffle.com
Speaking of Vim syntax highlighting, here's a simple Bazel syntax plugin for Vim I quickly put together based on the Pants one: https://github.com/davidzchen/vim-bazel

I'd be glad to either send a pull request to add it to the Bazel repo or move it to github.com/google or another GitHub organization.

To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.

To post to this group, send email to bazel-...@googlegroups.com.

Eric Zundel Ayers

unread,
Apr 3, 2015, 11:06:15 AM4/3/15
to David Chen, b...@folsomlabs.com, bazel-...@googlegroups.com, samuel....@toastwaffle.com
There is also a Pants IntelliJ plugin (Pants Support) that supports highlighting and navigating through BUILD files, but it probably wouldn't get along well with Bazel right now.  Open source repo: https://github.com/pantsbuild/intellij-pants-plugin/

abergmeier...@gmail.com

unread,
Jun 7, 2017, 4:15:35 AM6/7/17
to bazel-discuss
Will start to work on something like that soonish. Would like to have something similar to Anaconda - but for Skylark.

Steren Giannini

unread,
Jun 8, 2017, 4:07:13 AM6/8/17
to abergmeier...@gmail.com, bazel-discuss, laur...@google.com
Hi,
I am not aware of Sublime support, but I am an Atom user and have been using https://atom.io/packages/language-bazel 

let me loop +Laurent Le Brun who might have more guidance.
I also know we have a Summer of code project starting: https://bazel.build/blog/2017/05/31/google-summer-of-code-2017.html that will enable editor services for BUILD and .bzl files.

Steren

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.

Laurent Le Brun

unread,
Jun 8, 2017, 5:46:20 AM6/8/17
to Steren Giannini, abergmeier...@gmail.com, bazel-discuss
Steren, do we have a page to list all editor/IDE integration? I think
it would be useful to have.

For the Summer of code project, it will help for more advanced
features (completion, jump to symbol definition, etc.). However,
syntax highlighting probably needs to be done separately.
--
Laurent

Steren Giannini

unread,
Jun 8, 2017, 5:49:15 AM6/8/17
to Laurent Le Brun, michell...@google.com, abergmeier...@gmail.com, bazel-discuss
A page listing all IDE integrations is something I have drafted. +Michelle Irvine should be publishing it soon in our docs.

abergmeier...@gmail.com

unread,
Jun 8, 2017, 6:16:22 AM6/8/17
to bazel-discuss, laur...@google.com, michell...@google.com, abergmeier...@gmail.com
Interesting. Steren, can we perhaps form another group with monthly calls around IDE integrations?

I would have chosen Go for the language server, but if you guys decide to go with Java, I may rather choose Kotlin for synergy.
Reply all
Reply to author
Forward
0 new messages