This project provides a full Language Server (LSP) and a VSCode extension for the Vult DSP language. It offers a professional IDE experience similar to clangd but specifically tailored for Vult developers.
- Syntax Highlighting: Full syntax coloring for
.vultfiles. - Real-time Diagnostics: Instant cross-file compile errors and warnings powered by the Vult compiler engine.
- Smart Code Completion: Context-aware suggestions for Vult keywords, built-in types, and all user-defined functions/variables across your workspace.
- Go to Definition: Jump to the source of any function, memory block, or variable—even if defined in another file.
- Hover Support: View function signatures and variable types by simply hovering your mouse over them.
- Signature Help: Interactive parameter hints that appear as you type function arguments, highlighting the current parameter.
- Workspace-wide Rename: Rename a function or variable project-wide (
F2), updating all references automatically. - Find All References: Quickly see every usage of a specific symbol across all your
.vultfiles. - Document Symbols: A clean "Outline" view of your file's structure, including functions, types, and state variables.
- Intelligent Formatter: A robust code formatter (
Shift+Alt+F) that handles complex indentation, ignores braces inside strings/comments, and collapses consecutive empty lines for a cleaner codebase.
-
Build the project:
cd vult-lsp npm install npm run build -
Link to VSCode: Run the following command to link this extension to your VSCode extensions folder:
macOS / Linux:
ln -s "$(pwd)" ~/.vscode/extensions/vult-lsp
Windows (PowerShell):
New-Item -ItemType SymbolicLink -Path "$env:USERPROFILE\.vscode\extensions\vult-lsp" -Target (Get-Location).Path
-
Restart VSCode: Reopen VSCode, and it will automatically detect the new extension for any
.vultfiles.
The Vult LSP is built on standard vscode-languageserver technologies and communicates over Standard IO (stdio) by default. This makes it highly portable to web-based and custom IDEs.
To start the language server as a standalone process (which most editors expect):
node out/server.js --stdioTo integrate this LSP into the Monaco Editor (the engine behind VSCode) running in a browser, you typically use monaco-languageclient and a WebSocket wrapper to tunnel the STDIO connection to the web.
-
Set up a WebSocket proxy on your backend: Use a library like
wsorrpc-websocketsin a Node.js server. When a browser connects, spawn thenode out/server.js --stdioprocess and pipe the WebSocket messages into the child process's stdin, and pipe stdout back to the WebSocket. -
Connect Monaco from the frontend: Using the
monaco-languageclientpackage:import { listen } from 'vscode-ws-jsonrpc'; import { MonacoLanguageClient, CloseAction, ErrorAction } from 'monaco-languageclient'; // Create a standard WebSocket to your backend const webSocket = new WebSocket('ws://localhost:3000/vult-lsp'); listen({ webSocket, onConnection: connection => { // Create the Monaco Language Client const languageClient = new MonacoLanguageClient({ name: 'Vult Language Client', clientOptions: { // Bind the client to the Monaco document documentSelector: ['vult'], errorHandler: { error: () => ({ action: ErrorAction.Continue }), closed: () => ({ action: CloseAction.DoNotRestart }) } }, connectionProvider: { get: () => Promise.resolve(connection) } }); // Start the client, linking Monaco to the remote LSP const disposable = languageClient.start(); } });
For editors like Neovim or Emacs, you can configure their built-in LSP clients to point to the vult-lsp startup script.
Example for Neovim (nvim-lspconfig):
require'lspconfig'.configs.vult = {
default_config = {
-- Adjust path to wherever you built the vult-lsp folder
cmd = {'node', '/path/to/vult-lsp/out/server.js', '--stdio'},
filetypes = {'vult'},
root_dir = require'lspconfig.util'.root_pattern('.git', 'package.json'),
},
}
require'lspconfig'.vult.setup{}npm run watch: Automatically rebuild on changes.- Press
F5in VSCode while this project is open to launch a "Extension Development Host" for debugging.