Files
modeling-app/rust/kcl-language-server
dependabot[bot] 8b14d32879 Bump the security group in /rust with 2 updates (#6212)
Bumps the security group in /rust with 2 updates: [pyo3](https://github.com/pyo3/pyo3) and [tokio](https://github.com/tokio-rs/tokio).


Updates `pyo3` from 0.24.0 to 0.24.1
- [Release notes](https://github.com/pyo3/pyo3/releases)
- [Changelog](https://github.com/PyO3/pyo3/blob/v0.24.1/CHANGELOG.md)
- [Commits](https://github.com/pyo3/pyo3/compare/v0.24.0...v0.24.1)

Updates `tokio` from 1.44.1 to 1.44.2
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.44.1...tokio-1.44.2)

---
updated-dependencies:
- dependency-name: pyo3
  dependency-version: 0.24.1
  dependency-type: direct:production
  dependency-group: security
- dependency-name: tokio
  dependency-version: 1.44.2
  dependency-type: direct:production
  dependency-group: security
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-11 16:12:53 +00:00
..
2025-04-11 12:53:05 +10:00
2025-03-04 22:21:12 -08:00
2025-03-04 22:21:12 -08:00
2025-03-04 22:21:12 -08:00

kcl-lsp

The kcl Language Server Protocol implementation and VSCode extension.

This language server is a thin wrapper around the KCL language tooling library. That is found in the modeling-app repo, and published as on crates.io as kcl-lib.

VSCode

Install our extension: KittyCAD Language Server

Neovim

You can add the following to your vim configuration if you are using lspconfig.

This is @jessfraz's setup.

if executable('kcl-language-server')
lua << EOF
local lspconfig = require 'lspconfig'
local configs = require 'lspconfig.configs'

if not configs.kcl_lsp then
  configs.kcl_lsp = {
    default_config = {
      cmd = {'kcl-language-server', 'server', '--stdio'},
      filetypes = {'kcl'},
      root_dir = lspconfig.util.root_pattern('.git'),
      single_file_support = true,
    },
    docs = {
      description = [=[
https://github.com/KittyCAD/kcl-lsp
https://kittycad.io

The KittyCAD Language Server Protocol implementation for the KCL language.

To better detect kcl files, the following can be added:


    vim.cmd [[ autocmd BufRead,BufNewFile *.kcl set filetype=kcl ]]

]=],
      default_config = {
        root_dir = [[root_pattern(".git")]],
      },
    }
  }
end

lspconfig.kcl_lsp.setup{}
EOF
else
  echo "You might want to install kcl-language-server: https://github.com/KittyCAD/kcl-lsp/releases"
end

Helix

Add this to your languages.toml file. Remember to change /Users/adamchalmers to your path.

Note that we don't currently have Treesitter parsers, so there won't be syntax highlighting.

[[language]]
name = "kcl"
scope = "source.kcl"
injection-regex = "kcl"
file-types = ["kcl"]
comment-tokens = "//"
indent = { tab-width = 2, unit = "  " }
language-servers = [ "kcl-lsp" ]
block-comment-tokens = { start = "/*", end = "*/"}


[language-server.kcl-lsp]
command = "/Users/adamchalmers/kc-repos/kcl-lsp/target/release/kcl-language-server"
args = ["server", "--stdio"]

Development

$ yarn install
$ cargo build
$ code .

Once VSCode opens, go to the "Run and Debug" panel (cmd-shift-D on MacOS), and choose Run Extension (Debug Build). This opens a new VSCode window with our KCL extension installed. Open a KCL file and check that the LSP is working.

  • press F5 or change to the Debug panel and click Launch Client

Note

If encountered errors like Cannot find module '/xxx/xxx/dist/extension.js' please try run command tsc -b manually