Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add docs about lsp #274

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading