Glscript-language-server is a language server that provides IDE functionality for writing glscript programs. You can use it with any editor that supports the Language Server Protocol (VS Code, Vim, Emacs, Zed, etc).
After initialization, glscript-language-server creates a proxy workspace for the TSServer project located at <project_dir>/.local/glproxy-workspace/.
| Glproxy workspace files | Description | Can edit/delete |
|---|---|---|
| DEFAULT_INCLUDED.js | includes for all scripts by default for TSServer | ✔️ |
| _debug.emitted.js | synced current client buffer for debug | ❌* |
| _bundle.<hash>.js | required for TSServer correct work | ❌* |
| jsconfig.json | copied from <project_dir> for the TSServer project | ❌** |
| debug/*/*.* | emitted files in debug mode (for developers) | ❌ |
* do not edit or delete these files while working on the project.
** you should edit the source jsconfig.json and than restart the glscript service (glscript overwrites the jsconfig in the glproxy workspace on init).
- NodeJS
- typescript & tsserver dependencies (version ^5 of tsserver not supported yet)
npm i -D typescript typescript-language-server@4
-
Download glscript-language-server from Release page and move it to
<project_dir>/.local/glscript-language-server.exe -
Configure Language Client
Visual Studio Code
-
Install Generic LSP Proxy extension. Then, create a configuration file at
<project_dir>/.vscode/lsp-proxy.jsonwith the following content[1][2]:[ { "languageId": "glscript", "command": "%CD%/.local/glscript-language-server.exe", "args": ["./node_modules/.bin/typescript-language-server.cmd"], "fileExtensions": [".ts", ".js"], "initializationOptions": { "locale": "en" } } ] -
Add
<project_dir>/.vscode/launch.jsonfor debugging[1][2]:{ "version": "0.2.0", "configurations": [ { "name": "Debug NodeJS runtime", "type": "node", "request": "launch", "runtimeExecutable": "node", "runtimeArgs": ["--enable-source-maps", "--inspect-brk"], "program": "${workspaceFolder}/.local/glproxy-workspace/_debug.emitted.js" } ] } -
It is recommended to disable the built-in TypeScript extension. Running both the built-in TypeScript service and glscript-language-server simultaneously may cause conflicts. Press Ctrl+Shift+X, search for "@builtin TypeScript and JavaScript Language Features", and disable that extension.
-
Press Ctrl+Shift+P, search for "LSP Proxy: Reload LSP Configuration", then press Enter.
WebStorm
- Install the LSP4IJ plugin.
- Add a new language server (User guide):
Server
Field Value Name glscript-language-server Command $PROJECT_DIR$/.local/glscript-language-server.exe $PROJECT_DIR$/node_modules/.bin/typescript-language-server.cmdMappings / File type
File type Language Id JavaScript javascript TypeScript typescript Mappings / File name patterns
File name patterns Language Id *.js javascript *.ts typescript Configuration / Server / Initialization Options[1]
{ "locale": "en" }- It is recommended to disable the built-in JavaScript and TypeScript language support to avoid conflicts.
-
For more detailed usage examples, including how to structure your project and use the #include directive, please see the examples directory in the repository.
- How We Made the Deno Language Server Ten Times Faster
- How To Interpret Semantic Tokens
- Language server protocol overview
- A Common Protocol for Languages
- Debug your original code instead of deployed with source maps
- Yet another explanation on sourcemap
- Practical parsing with PEG and cpp-peglib
- PEGs and the Structure of Languages
- PEG Parsing Series Overview
MIT