9 stable releases

1.2.5 Jun 9, 2023
1.2.4 Jun 2, 2023
1.2.3 Oct 13, 2022
1.2.1 Aug 8, 2022
1.0.2 May 27, 2022

#147 in Development tools

Download history 3/week @ 2023-12-22 5/week @ 2023-12-29 11/week @ 2024-01-05 8/week @ 2024-01-12 2/week @ 2024-01-19 2/week @ 2024-01-26 3/week @ 2024-02-02 6/week @ 2024-02-09 88/week @ 2024-02-16 61/week @ 2024-02-23 57/week @ 2024-03-01 198/week @ 2024-03-08 36/week @ 2024-03-15 53/week @ 2024-03-22 63/week @ 2024-03-29 21/week @ 2024-04-05

179 downloads per month

MIT/Apache

69KB
1.5K SLoC

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 clang-format, you need install it yourself, it is not built-in.
  • 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

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

USAGE:
    openscad-lsp [OPTIONS]

OPTIONS:
        --builtin <BUILTIN>        external builtin functions file path, if set, the built-in
                                   builtin functions file will not be used [default: ]
        --fmt-exe <FMT_EXE>        clang format executable file path [default: clang-format]
        --fmt-style <FMT_STYLE>    LLVM, GNU, Google, Chromium, Microsoft, Mozilla, WebKit, file
                                   [default: Microsoft]
    -h, --help                     Print help information
        --ignore-default           exclude default params in auto-completion
        --ip <IP>                  [default: 127.0.0.1]
    -p, --port <PORT>              [default: 3245]
        --stdio                    use stdio instead of tcp
    -V, --version                  Print version information

To change the config during running, you can send notification workspace/didChangeConfiguration

// example
{
    "settings": {
        "openscad": {
            "search_paths": "/libs",
            "fmt_exe": "/usr/bin/clang-format",
            "fmt_style": "file",
            "default_param": true
        }
    }
}

Dependencies

~7–19MB
~266K SLoC