Skip to main content

LSP server for KOMPAS-3D ksAPI

Project description

KOMPAS-3D LSP

Language Server Protocol server for KOMPAS-3D ksAPI.

Auto-completion, hover docs, signature help and diagnostics for KOMPAS-3D scripting in Python, C++ and C#.

Powered by the official ksAPI documentation — 856 interfaces, 7104 methods (RU), 54 interfaces (EN). Multi-language syntax: C++, Python (pywin32), C# (COM interop). No KOMPAS-3D installation required.


Features

Feature Status
textDocument/completion — interfaces, methods, enum constants, per-language syntax +
textDocument/hover — descriptions with syntax and examples per language +
textDocument/signatureHelp — method signatures on argument input +
textDocument/publishDiagnostics — common mistake warnings per language +
--check batch mode — file validation without LSP +

Installation

pip install kompas3d-lsp

Verify:

kompas3d-lsp --help

OpenCode Integration

Put opencode.json in your project root:

{
  "lsp": {
    "kompas3d-lsp": {
      "command": ["kompas3d-lsp", "--stdio"],
      "extensions": [".py", ".cpp", ".h", ".cs"]
    }
  }
}

Environment Variables

Variable Default Description
KOMPAS_LSP_LANG ru Knowledge base language (ru / en)
KOMPAS_LSP_DATA_DIR Custom path to {lang}/ksapi_knowledge.json

In opencode.json:

{
  "lsp": {
    "kompas3d-lsp": {
      "command": ["kompas3d-lsp", "--stdio"],
      "extensions": [".py"],
      "env": { "KOMPAS_LSP_LANG": "en" }
    }
  }
}

CLI

kompas3d-lsp --stdio              # stdio transport (default, for LSP clients)
kompas3d-lsp --tcp                # TCP transport (127.0.0.1:2087, debugging)
kompas3d-lsp --lang en            # override knowledge base language
kompas3d-lsp --check file.py      # batch file check (without LSP)
kompas3d-lsp --check file.py --json  # JSON output
kompas3d-lsp --help

Supported Languages

Extension Language Syntax Style
.py, .pyw Python method(param: type) -> type
.cpp, .cxx, .cc, .h, .hpp, .hxx C++ Native from documentation
.cs C# Type method(params);

Language auto-detected by file extension. Server shows syntax, examples and diagnostics matching the file language.


Diagnostics

The server warns about:

  1. Python: import win32com.client without try/except — KOMPAS may be missing on CI
  2. C++: method call via -> without null check
  3. C#: Marshal.GetActiveObject / Type.GetTypeFromProgID without try/catch

Client Configuration

VS Code

{
  "lsp.clients.kompas3d-lsp.command": ["kompas3d-lsp", "--stdio"]
}

Neovim (vim.lsp)

vim.api.nvim_create_autocmd("FileType", {
  pattern = "python",
  callback = function()
    vim.lsp.start({
      name = "kompas3d-lsp",
      cmd = { "kompas3d-lsp", "--stdio" },
    })
  end,
})

Links


License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kompas3d_lsp-0.2.0.tar.gz (2.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kompas3d_lsp-0.2.0-py3-none-any.whl (1.4 MB view details)

Uploaded Python 3

File details

Details for the file kompas3d_lsp-0.2.0.tar.gz.

File metadata

  • Download URL: kompas3d_lsp-0.2.0.tar.gz
  • Upload date:
  • Size: 2.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.2

File hashes

Hashes for kompas3d_lsp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 41c7f79de383b5fa13e30b764a362305563737fcf642a2fad30d029867e4f52f
MD5 22f4f6f7562c97ab26dc67d809e26c9a
BLAKE2b-256 3e4c4954a798896727ee7ef90ce45c246795278a85a550379e38e6f64c8af24b

See more details on using hashes here.

File details

Details for the file kompas3d_lsp-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: kompas3d_lsp-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.2

File hashes

Hashes for kompas3d_lsp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2cfda0d7876ff83099640685c71f6345b11d196c212188264f3de8bc954c4494
MD5 c6a64cbb2e222fa7304567210524cdff
BLAKE2b-256 a2ed525d43877d16a649064513d7b7937b0fd8eeb049a6210a282f56ab67136b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page