A VSCode LSP extension that talks over stdin/stdout to a binary. This can either
be the starlark binary itself, or any binary that has implemented
starlark::lsp::server::LspContext and runs
starlark::lsp::server::stdio_server().
If using another binary, the settings to be aware of are starlark.lspPath (the
binary path) and starlark.lspArguments (the arguments to that binary). These
are available in the VSCode extension settings UI.
Based on a combination of:
- Tutorial at https://code.visualstudio.com/api/language-extensions/language-server-extension-guide
- Code for the tutorial at https://github.com/microsoft/vscode-extension-samples/tree/master/lsp-sample
- Syntax files from https://github.com/phgn0/vscode-starlark (which are the Microsoft Python ones with minor tweaks)
You need to have npm v7+ installed. Afterwards, run npm install in this folder
and in client.
- Follow steps in Pre-requisites section.
- Open VS Code on this folder.
- Press Ctrl+Shift+B to compile the client and server.
- Switch to the Debug viewlet.
- Select
Launch Clientfrom the drop down. - Run the launch config.
- Follow steps in Pre-requisites section.
- Run
npm install @vscode/vsce vscode-languageclient - Run
npm exec @vscode/vsce package - In VS Code, go to Extensions, click on the "..." button in the Extensions bar,
select "Install from VSIX" and then select the
starlark-1.0.0.vsixfile that was produced. - Build the starlark binary with
cargo build --bin=starlarkand then do one of:- Put it on your
$PATH, e.g.cp $CARGO_TARGET_DIR/debug/starlark ~/.cargo/bin/starlark. - Configure the setting
starlark.lspPathfor this extension to point to the starlark binary. e.g.$CARGO_TARGET_DIR/debug/starlark.
- Put it on your
Every few months security advisories will arrive about pinned versions of packages.
npm auditto see which packages have security updates.npm audit fixto fix those issues.- Try
npm audit, if it still has issues runnpm update. npm exec vsce packageto confirm everything still works.