{"id":29066908,"url":"https://github.com/rhaiscript/lsp","last_synced_at":"2026-03-14T23:37:54.351Z","repository":{"id":41151259,"uuid":"411470064","full_name":"rhaiscript/lsp","owner":"rhaiscript","description":"Language server for Rhai.","archived":false,"fork":false,"pushed_at":"2023-03-17T15:13:39.000Z","size":1597,"stargazers_count":63,"open_issues_count":20,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-12-25T14:42:38.470Z","etag":null,"topics":["lsp","lsp-server","rhai","scripting-language","vscode","vscode-extension","vscode-language"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rhaiscript.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-28T23:44:32.000Z","updated_at":"2025-10-31T11:19:50.000Z","dependencies_parsed_at":"2023-01-19T23:00:17.009Z","dependency_job_id":null,"html_url":"https://github.com/rhaiscript/lsp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rhaiscript/lsp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhaiscript%2Flsp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhaiscript%2Flsp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhaiscript%2Flsp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhaiscript%2Flsp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rhaiscript","download_url":"https://codeload.github.com/rhaiscript/lsp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhaiscript%2Flsp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30521490,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-14T19:51:21.629Z","status":"ssl_error","status_checked_at":"2026-03-14T19:51:12.959Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lsp","lsp-server","rhai","scripting-language","vscode","vscode-extension","vscode-language"],"created_at":"2025-06-27T10:08:53.277Z","updated_at":"2026-03-14T23:37:54.317Z","avatar_url":"https://github.com/rhaiscript.png","language":"Rust","readme":"- [Rhai LSP](#rhai-lsp)\n  - [Requirements](#requirements)\n  - [Project Structure](#project-structure)\n    - [`crates/rhai-rowan`](#cratesrowan)\n    - [`crates/rhai-lsp`](#crateslsp)\n    - [`crates/rhai-sourcegen`](#cratessourcegen)\n    - [`editors/vscode`](#editorsvscode)\n  - [Tests](#tests)\n  - [Benchmarks](#benchmarks)\n  - [Profiling](#profiling)\n  - [Contributing](#contributing)\n    - [Development Process](#development-process)\n      - [Building and Installing the VSCode Extension](#building-and-installing-the-vscode-extension)\n      - [Building the Rhai CLI](#building-the-rhai-cli)\n      - [Debugging the Language Server](#debugging-the-language-server)\n      - [Building the VSCode Extension](#building-the-vscode-extension)\n        - [Requirements](#requirements-1)\n        - [Build Steps](#build-steps)\n\n# Rhai LSP\n\nExperimental Rhai LSP Server and IDE support.\n\nIt's incomplete and not recommended for general use yet, everything can be subject to changes.\n\n## Requirements\n\n- Stable Rust toolchain is required (e.g. via [rustup](https://rustup.rs/))\n- ... other required tools are described in the appropriate sections\n\n## Project Structure\n\n### [`crates/rowan`](crates/rhai-rowan)\n\nRhai syntax and a recursive descent parser based on [Rowan](https://github.com/rust-analyzer/rowan).\n\nThe high-level syntax ([ungrammar](https://rust-analyzer.github.io/blog/2020/10/24/introducing-ungrammar.html)) definition is found in [crates/rowan/src/ast/rhai.ungram](crates/rhai-rowan/src/ast/rhai.ungram). The parser mimics the structure and produces a fitting CST.\n\n### [`crates/lsp`](crates/rhai-lsp)\n\nThe LSP server implementation backed up by [lsp-async-stub](https://github.com/tamasfe/taplo/tree/master/crates/lsp-async-stub).\n\nIt can be compiled to WASM only right now, but native binaries with stdio or TCP communication can be easily implemented.\n\n### [`crates/sourcegen`](crates/rhai-sourcegen)\n\nCrate for source generation.\n\nCurrently only some node types and helper macros are generated from the ungrammar definition. Later the AST will also be generated from it.\n\n### [`editors/vscode`](ide/vscode)\n\nVS Code extension that uses the LSP.\n\nIf all the tools are available from the [Requirements](#requirements), it can be built and installed with `task ide:vscode:dev`.\n\n## Tests\n\nRun all tests with `cargo test`.\n\n[Parser tests](crates/rhai-rowan/tests) are based on scripts found in [`testdata`](testdata), and also in the upstream [rhai submodule](rhai/scripts).\n\n## Benchmarks\n\nRun benchmarks with `cargo bench`.\n\nCurrent parser results:\n\n![bench](images/bench.png)\n\nWe can only go up from here. (although it is 3 times faster than a similar LALR generated parser)\n\n## Profiling\n\nTo profile the parser, run `cargo bench --bench parse -- --profile-time 5`.\n\nThe flame graph outputs can be found in `target/criterion/profile` afterwards.\n\n## Contributing\n\nThe documentation is still pretty much WIP (as everything else). All contributions are welcome!\n\n### Development Process\n\nCurrently the following steps are used to develop the project via vscode:\n\n#### Building the Rhai CLI\n\n```sh\ncargo install --path crates/rhai-cli --debug\n```\n\nThis will build and install the `rhai` executable globally that the vscode extension can also use.\n\n#### Debugging the Language Server\n\nThe debugging process can consist of either strategically placed `tracing::info` statements that are visible in the VSCode debug console under `Rhai LSP`, or attaching a debugger to the running `rhai` process via [LLDB VSCode](https://marketplace.visualstudio.com/items?itemName=lanza.lldb-vscode). Both approaches deemed sufficient so far.\n\n#### Building the VSCode Extension\n\nThe vscode extension relies on rhai-lsp compiled to WebAssembly via [`rhai-wasm`](./crates/rhai-wasm). There are several related [js libraries](./js) that are built on top of it.\n\n##### Requirements\n\n- The usual Rust tools along with the `wasm32-unknown-unknown` target, (`rustup target add wasm32-unknown-unknown`).\n- NodeJs with proper PATH variables set up.\n- Yarn (`npm i -g yarn`)\n- vsce (`npm i -g vsce`)\n\n##### Build Steps\n\nYou'll need to build all local js libraries in dependency order:\n\nFirst the core js library with common utilities:\n\n```sh\n# from js/core\n\nyarn install --force\nyarn build\n```\n\nThen the LSP wrapper, it will also build the WASM library:\n\n```sh\n# from js/lsp\n\nyarn install --force\nyarn build\n```\n\nFinally the extension itself:\n\n```sh\n# from editors/vscode\n\nyarn install --force\nvsce package --no-yarn\n```\n\nThen you can use vscode to install the packaged extension via the UI or the following command:\n\n```sh\ncode --install-extension rhai-0.0.0.vsix --force\n```\n\nAfter this the Rhai extension will be available in vscode.\n\nIf you modify any of the packages, unfortunately you will have to build all dependent packages manually, e.g. if you modify `js/core`, you will have to repeat all the above steps.\n\nUnless you wish to develop any of the javascript parts (the libraries or the extension itself), instead of rebuilding the extension, it is enough to install the Rhai CLI, and setting `\"rhai.executable.bundled\": false` in vscode. This way the extension will use the language server from the `rhai` executable which is easier to debug, rebuild and develop in general.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhaiscript%2Flsp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhaiscript%2Flsp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhaiscript%2Flsp/lists"}