GithubHelp home page GithubHelp logo

kittycad / kcl-lsp Goto Github PK

View Code? Open in Web Editor NEW
4.0 9.0 0.0 1.47 MB

The `kcl` Language Server Protocol implementation.

Home Page: https://marketplace.visualstudio.com/items?itemName=KittyCAD.kcl-language-server

License: MIT License

Rust 29.94% Dockerfile 2.05% TypeScript 61.50% JavaScript 4.26% Makefile 2.24%

kcl-lsp's Introduction

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

kcl-lsp's People

Contributors

jessfraz avatar dependabot[bot] avatar adamchalmers avatar

Stargazers

Alex avatar Antoine Grondin avatar astrolemonade avatar Brian Lu avatar

Watchers

Jonathan Tran avatar Adam Sunderland avatar  avatar Mike Farrell avatar David Harvey-Macaulay avatar Vonni Williams avatar Pierre Jacquier avatar Ben Crabbe avatar  avatar

kcl-lsp's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.