Skip to content

phgn0/vscode-starlark

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Starlark extension for Visual Studio Code

Vscode extension that adds intelligent editor features for the Starlark language.

  • Syntax highlighting

  • Jump-to-definition and description for function calls

  • Code autocomplete

  • Linting through pylint

Background

Starlark 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.

Architecture

Because 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 features

An 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.

Packages

No packages published

Languages

  • TypeScript 72.6%
  • Python 23.2%
  • Gherkin 2.3%
  • JavaScript 0.7%
  • HTML 0.6%
  • Jupyter Notebook 0.3%
  • Other 0.3%