Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the vscode language server setup #4663

Open
wants to merge 6 commits into
base: trunk
Choose a base branch
from

Conversation

jonmeow
Copy link
Contributor

@jonmeow jonmeow commented Dec 11, 2024

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.

@jonmeow jonmeow changed the title Update the language server setup Update the vscode language server setup Dec 11, 2024
@github-actions github-actions bot requested a review from chandlerc December 11, 2024 00:55
@github-actions github-actions bot added the utilities Utilities for working with Carbon code: syntax highlighting, editor plugins, etc. label Dec 11, 2024
utils/vscode/README.md Outdated Show resolved Hide resolved
utils/vscode/README.md Outdated Show resolved Hide resolved
utils/vscode/README.md Outdated Show resolved Hide resolved
utils/vscode/README.md Outdated Show resolved Hide resolved
utils/highlightjs/highlightjs_carbon_lang.js Outdated Show resolved Hide resolved
utils/vscode/development.md Outdated Show resolved Hide resolved
*/

/**
* This supports using esbuild to bundle the extension for releases.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment wasn't enough for me to figure out what this file is doing. Can you add some more description here? Specifically, it looks like this is a program that can be run using node; what is its command-line syntax and what does it do when run?

It would also have helped me for this file to point at the invocation of this from the scripts in package.json, and maybe to also point at the uses of the scripts in .vscode/tasks.json.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linked back to https://code.visualstudio.com/api/working-with-extensions/bundling-extension

I'm not sure I'm getting what you're looking for exactly though, maybe you can suggest changes?

Copy link
Contributor Author

@jonmeow jonmeow Dec 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear, I'm mostly re-using code here. I didn't write this myself (and I'm not familiar with esbuild), so I don't have a strong grasp of it beyond that it fixes a warning from vsce.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chandlerc Updated file per discussion.

utils/vscode/src/extension.ts Outdated Show resolved Hide resolved
utils/vscode/eslint.config.mjs Outdated Show resolved Hide resolved
Copy link
Contributor Author

@jonmeow jonmeow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed prettier wasn't formatting json, so fixed that.

utils/vscode/README.md Outdated Show resolved Hide resolved
utils/highlightjs/highlightjs_carbon_lang.js Outdated Show resolved Hide resolved
utils/vscode/README.md Outdated Show resolved Hide resolved
utils/vscode/src/extension.ts Outdated Show resolved Hide resolved
Comment on lines +27 to +28
- If you're using VS Code locally, run
`npm install && vsce package -o carbon.vsix && code --install-extension carbon.vsix`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, this command works for me using VS Code's remote mode too. You might need to run it from the VS Code terminal for code to properly communicate with the running VS code instance.

Copy link
Contributor

@zygoloid zygoloid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, leaving to @chandlerc to approve once he's happy.

Copy link
Contributor

@chandlerc chandlerc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks amazing to me TBH! Excited about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure utilities Utilities for working with Carbon code: syntax highlighting, editor plugins, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants