mirror of
https://github.com/diodeinc/pcb.git
synced 2026-09-14 20:17:19 +08:00
Zener VS Code LSP extension
A VSCode LSP extension that talks over stdin/stdout to a binary. This can either
be the pcb 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 zener.lspPath (the
binary path) and zener.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)
Pre-requisites
You need to have npm v7+ installed. Afterwards, run npm install in this folder
and in client.
Debugging
- 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.
Installing
- Follow steps in Pre-requisites section.
- Run
npm install vsce - Run
npm exec vsce package - In VS Code, go to Extensions, click on the "..." button in the Extensions bar,
select "Install from VSIX" and then select the
zener-1.0.0.vsixfile that was produced. - Build the pcb binary with
cargo build --bin=pcband then do one of:- Put it on your
$PATH, e.g.cp $CARGO_TARGET_DIR/debug/pcb ~/.cargo/bin/pcb. - Configure the setting
zener.lspPathfor this extension to point to the pcb binary. e.g.$CARGO_TARGET_DIR/debug/pcb.
- Put it on your
Updating
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.