vscode-bazel-tools
vscode-bazel-tools copied to clipboard
Bazel integration for Visual Studio Code
Bazel Tools (Deprecated)
Bazel integration for Visual Studio Code. If you also want to have syntax highlighting for BUILD and WORKSPACE files take a look at bazel-code. The current version is meant to be a preview and might have heavy bugs.
Update: The bazel team now officially started developing vscode-bazel which provides a more feature rich integration for bazel. This extension is therefore deprecated and will not be published anymore.
Features
- Running bazel commands from within Visual Studio Code. Detect which targets are available in a
WORKSPACEand choose one. - Generation of project files for code navigation and auto-completion used by other third party language extensions, e.g.
c_cpp_properties.jsonfor C/C++ or.classpathfor Java - Generate and show the dependency graph of a target
Commands
- Bazel: Create C++ Project: Creates a
c_cpp_properties.jsonfile that contains all transitive include paths starting from a root C++ target. Takes also the used toolchain into account and uses their system include directories. - Bazel: Create Java Project: Classpath generation.
- Bazel: Build: Builds a target chosen from the shown label list.
- Bazel: Run: Runs a *_binary target chosen from the shown label list.
- Bazel: Clean: Cleans up the output directories.
- Bazel: Show dependencies graph
For each command listed above there is also a button available in the status bar.
Requirements
- A recent version of bazel
Roadmap
-
Add commands for bazel
fetchandtestand provide a user friendly interface for them, especially forquery. Here we could implement a graph view within vscode that visualizes the dependencies and shows up useful information for each target. -
Extend the language support, especially Java.
Tasks:
- [x] Implement a target picker based on bazel query and build the selected target based on the user decision. Use vscodes terminal for that purpose.
- [x] Implement the run command.
- [x] Implement the
vs_code_aspectthat generates programming language dependent descriptor files. Traverses all C++ dependencies and outputs all include paths known to bazel. Installs the aspect as well as aBUILDfile into the users workspace in order to make it 'applicable'. - [x] Generation of
c_cpp_properties.jsonfile based on bazel aspects output. We use descriptors of any C++ kind. - [x] Cleanup temporary descriptor files after generation
- [ ] Check bazel installation and
WORKSPACEon startup and report the status to the user - [x] Check the usage on other platforms than linux.
- [ ] Implement test cases.
- [ ] Add more language support. Currently the focus is on C++. Building targets is language independent.
- [x] Add language information for each target chosen from the target picker.
- [ ] Consider the visibility of each target
- [ ] Dive deeper into JS and develop a solid extension architecture.
- [x] Provide buttons for build and run.
- [ ] Wrap the bazel commands into a class with a handy interface.
Contribute
Let me know if you have any suggestions or if you want to contribute. I am happy about any support. The current status is far away from a release version but you can simply check it out and try it in your vscode editor by running:
npm install
Then you can run it in the developer mode.
Thank you goes out to the following contributors for pushing the project forward: