Starlark extension for Visual Studio CodeVscode extension that adds intelligent editor features for the Starlark language.
BackgroundStarlark is becoming a dominant configuration language. Its great features include determinitic and isolated execution, as well as simplicity and great readbility. While there is editor support for Bazel and Buck's build files, no existing editor extension provides jump-to-definition, linting and code completion for pure Starlark files, specifically its load() statement. These issues will be solved in the future by Google's Starlark language server, which is not open-source yet. This extension here exists to provide a good experience in the meantime. ArchitectureBecause Starlark's syntax is a subset of Python, we could of course try to use existing Python editor extensions - which is exactly what this project does. It only takes a tweak to the supported source file extensions, adjustment to the Python grammar, some AST transformations, disabling python features, correct bundling of the modified libraries and some debugging ;) Because most Python extension share the same code-intelligence library jedi, these modifications can be applied to other editors relatively easily. Future featuresAn editor extension based on Google's language server is the best long-term solution, so I don't plan on investing significant time into this project. Though it may be interesting to add autocomplete for files in the load() statement, and we probably want to support buildifier, Starlark's linting & code formatting tool. Most importantly, please let me know if something doesn't work. |