Files
carbon-lang/utils/vscode/development.md
T
Jon Ross-PerkinsandRichard Smith f922988c8c Update the vscode language server setup (#4663)
Switches from js to ts, and starts bundling files in order to produce a
better package for deployment. Fixes the README.md to be a more
appropriate front page, moving dev content to development.md. Makes the
path to `carbon` configurable so that it's more stable than just running
in `bazel-bin`.

This is built using suggestions from samples at
https://github.com/microsoft/vscode-extension-samples/tree/main/lsp-sample
and
https://github.com/microsoft/vscode-extension-samples/tree/main/esbuild-sample.
Note the esbuild in particular comes from complaints from `vsce` to use
an option from
https://code.visualstudio.com/api/working-with-extensions/bundling-extension,
and esbuild is just the first option detailed there (I have no real
opinion on options).

I'm bumping the version, and will do a release after merging.

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2024-12-16 16:05:17 +00:00

1.6 KiB

Extension development

Currently only contains basic syntax highlighting.

Releases

This assumes NodeJS is installed, along with vsce (using npm install -g vsce).

  1. npm install && vsce publish

Local installation

This assumes NodeJS is installed, along with vsce (using npm install -g vsce).

  1. npm install && vsce package -o carbon.vsix && realpath carbon.vsix
    • This installs dependencies, builds the VSIX file, and prints the path for installation.
  2. Install the plugin:
    • If you're using VS Code locally, run npm install && vsce package -o carbon.vsix && code --install-extension carbon.vsix
    • If you're using VS Code's remote mode:
      1. In vscode, open the command palette and select "Extensions: Install from VSIX...".
      2. Enter the path printed by the above command.

Development

  1. bazel build //toolchain in project root.
  2. Open utils/vscode folder in VS Code.
  3. Launch the extension using Run command (F5).
  4. In the opened window, open the carbon-lang repository as folder.
  5. Open a carbon file.
  6. Open code outline (Ctrl+Shift+O).

Debugging output

  1. Go to the "Output" panel.
  2. In the top right, there is a dropdown; select "Carbon Language Server".

Updating dependencies

To update dependencies, run npm update.