From fe481eb9f10a9782c176325d34f9db72b4f36c32 Mon Sep 17 00:00:00 2001 From: "m.kindritskiy" Date: Tue, 28 Jan 2025 14:26:10 +0200 Subject: [PATCH] add docs about lsp --- docs/docs/ide_support.md | 80 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-) diff --git a/docs/docs/ide_support.md b/docs/docs/ide_support.md index 24c0579..a8a566d 100644 --- a/docs/docs/ide_support.md +++ b/docs/docs/ide_support.md @@ -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