Skip to content

source-academy/source-lsp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Apr 16, 2025
433d552 · Apr 16, 2025

History

95 Commits
Apr 15, 2025
Apr 12, 2025
Apr 15, 2025
Apr 16, 2025
Apr 14, 2025
Apr 16, 2025
Jan 18, 2025
Mar 19, 2025
Jan 18, 2025
Jan 18, 2025
Jan 18, 2025
Mar 19, 2025
Apr 12, 2025
Mar 26, 2025
Jan 18, 2025
Mar 30, 2025
Apr 16, 2025
Apr 16, 2025
Mar 30, 2025
Jan 18, 2025

Repository files navigation

source-lsp

A LSP server for source

Use

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.

Features

Currently, the following language features are supported:

  • Completion
  • Go to declaration
  • Highlight names
  • Document Symbols
  • Rename symbol
  • Hover information
  • Diagnostics

Documentation

Documentation for diagnostics can be found here

Autocomplete

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.

Notes to developers

Debugging in VS Code

Follow these steps to use the VS Code debugger to step through function calls in the server and client:

  1. 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.

  2. 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.

  3. 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.