14 stable releases
| 2.0.1 | May 28, 2025 |
|---|---|
| 1.3.1 | May 21, 2025 |
| 1.2.6 | Apr 28, 2025 |
| 1.2.5 | Jun 9, 2023 |
| 1.0.2 | May 27, 2022 |
#44 in Development tools
139 downloads per month
88KB
2K
SLoC
NOTICE: Because clang-format produces poor formatting results for OpenSCAD, we have completely removed support for clang-format and switched to the new formatter topiary
openscad-LSP
A LSP (Language Server Protocol) server for OpenSCAD.
inspired by dzhu/openscad-language-server
Tested with VSCode on Mac and Windows. [vscode extension]
Tested with lsp-mode on Emacs on Linux by @Lenbok.
Features
- builtin function/module documents
- code and path auto-completion
- jump to definition
- code snippets
- function/module signatures on hover
- document symbols
- formatter, utilizing topiary.
- variable / module renaming
- hover and suggestion documentation, read from comments before the function/module.
IDE plugins
| IDE | Plugin | Note |
|---|---|---|
| Neovim | mason.nvim | Only tested on Mac and Linux |
| Neovim | nvim-lspconfig | Only tested on Mac and Linux |
| VS Code | openscad-language-support | Only tested on Mac and Windows |
| Emacs | lsp-bridge | Only tested on Mac and Linux |
Install
openscad-LSP is written in Rust, in order to use it, you need to install Rust toolchain.
cargo install openscad-lsp
Build
cd openscad-LSP
cargo build --release
Usage
The server communicates over TCP socket (127.0.0.1:3245).
A language(LSP) server for OpenSCAD
Usage: openscad-lsp [OPTIONS]
Options:
-p, --port <PORT> [default: 3245]
--ip <IP> [default: 127.0.0.1]
--builtin <BUILTIN> external builtin functions file path, if set, the built-in builtin functions file will not be used [default: ]
--stdio use stdio instead of tcp
--ignore-default exclude default params in auto-completion
--depth <DEPTH> search depth [default: 3]
--indent <INDENT> The indentation string used for that particular language. Defaults to " " if not provided. Any string can be provided, but in most instances will be some whitespace: " ", " ", or "\t"
--query-file <QUERY_FILE> The query file used for topiary formatting
-h, --help Print help
-V, --version Print version
To change the config at runtime, you can send notification workspace/didChangeConfiguration
// example
{
"settings": {
"openscad": {
"search_paths": "/libs",
"indent": " ",
"query_file": "path/to/my/openscad.scm",
"default_param": true
}
}
}
Dependencies
~11–24MB
~334K SLoC