A LSP server for source
The code for the lsp is in /server
but code for testing the lsp is provided in /client
. If you want to use this lsp in your own VSCode extension, download the
latest version from the releases page, and copy the set up in client/src/extension.ts
.
Ensure that the lines
const serverModule = context.asAbsolutePath(
path.join("dist", 'source-lsp.js')
);
point to the correct path to the downloaded lsp file.
If you want to test out the lsp, you can clone the repo and open up VSCode
git clone https://github.com/mug1wara26/source-lsp && cd source-lsp
npm i
code .
Then press ctrl + shift + b and enter to build, then press f5 to run the plugin.
Currently, the following language features are supported:
- Completion
- Go to declaration
- Highlight names
- Document Symbols
- Rename symbol
- Hover information
- Diagnostics
Documentation for diagnostics can be found here
Documentation for built in names or modules are generated by the script server/src/docs/build_docs.mjs
. This script is not automatically run during the build process, as it is rarely updated.
If an update to the autocomplete is required, run npm run docs
.
Follow these steps to use the VS Code debugger to step through function calls in the server and client:
-
Ensure VS Code is running on the root directory of this project. Open the Run and Debug side panel by clicking or using the Ctrl+Shift+D shortcut. Observe that there is a dropdown to select launch configurations at the top, and a Call Stack panel at the middle.
-
Run the Run Extension debug launch config. This will automatically build the necessary files. A new VS Code window in debug mode should appear with expected LSP features working. You should now be able to set breakpoints in TS files within the client/ folder.
-
Run the Attach to Server debug launch config. If needed, ensure that a new debug session named
Remote Process [0] << Attach to Server 6009
appears in the Call Stack panel and does not die. You should now be able to set breakpoints in TS files within the server/ folder.