Skip to content

Commit

Permalink
Merge pull request #274 from lets-cli/update-lsp-docs
Browse files Browse the repository at this point in the history
add docs about lsp
  • Loading branch information
kindermax authored Jan 28, 2025
2 parents cfed66c + fe481eb commit 42a4748
Showing 1 changed file with 79 additions and 1 deletion.
80 changes: 79 additions & 1 deletion docs/docs/ide_support.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,90 @@ title: IDE/Text editors support
Provides autocomplete and filetype support.

[Plugin site](https://plugins.jetbrains.com/plugin/14639-lets)
[Plugin repo](https://github.com/lets-cli/intellij-lets)

### VSCode plugin (official)

Provides autocomplete and filetype support.

[Plugin site](https://marketplace.visualstudio.com/items?itemName=kindritskyimax.vscode-lets)
[Plugin repo](https://github.com/lets-cli/vscode-lets)

### Emacs plugin (community)

Provides autocomplete and filetype support.

[Plugin site](https://github.com/mpanarin/lets-mode)
[Plugin repo](https://github.com/mpanarin/lets-mode)

### LSP

`LSP` stands for `Language Server Protocol`

Starting from `0.0.55` version lets comes with builtin `lsp` server under `lets self lsp` command.

Lsp support includes:

[x] Goto definition
- Navigate to definitions of mixins files
- Navigate to definitions of command from `depends`
[x] Completion
- Complete commands in depends
[ ] Diagnostics
[ ] Hover
[ ] Formatting
[ ] Signature help
[ ] Code action

`lsp` server works with JSON Schema (see bellow).

#### VSCode

VSCode plugin supports lsp out of the box, you only want to make sure you have lets >= `0.0.55`.

#### Neovim

Neovim support for `lets self lsp` can be added manually:

1. Add new filetype:

```lua
vim.filetype.add({
filename = {
["lets.yaml"] = "yaml.lets",
},
})
```

2. In your `neovim/nvim-lspconfig` servers configuration:

In order for `nvim-lspconfig` to recognize `lets lsp` we must define config for `lets_ls` (lets_ls is just a conventional name because we are not officially added to `neovim/nvim-lspconfig`)

```lua
require("lspconfig.configs").lets_ls = {
default_config = {
cmd = {
"lets self lsp",
},
filetypes = { "yaml.lets" },
root_dir = util.root_pattern("lets.yaml"),
settings = {},
},
}
```

3. And then enable lets_ls in then servers section:

```lua
return {
"neovim/nvim-lspconfig",
opts = {
servers = {
lets_ls = {},
pyright = {}, -- pyright here just as hint to where we should add lets_ls
},
},
}
```

### JSON Schema

Expand Down

0 comments on commit 42a4748

Please # to comment.