Skip to main content

IDE/Text editors support

Jet Brains plugin (official)​

Provides autocomplete and filetype support.

VSCode plugin (official)​

Provides autocomplete and filetype support.

Emacs plugin (community)​

Provides autocomplete and filetype support.

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:

  • Goto definition
    • Navigate to definitions of mixins files
    • Navigate to definitions of command from depends, ref, and YAML merge aliases
  • 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, just make sure you have lets >= 0.0.55.

Neovim​

Neovim support for lets self lsp can be added manually:

  1. Add new filetype:
vim.filetype.add({
filename = {
["lets.yaml"] = "yaml.lets",
},
})
  1. Define lets_ls lsp config

Requires neovim >= 0.11.2

vim.lsp.config.lets_ls = {
cmd = { "lets", "self", "lsp" },
filetypes = { "yaml.lets" },
root_markers = { "lets.yaml" },
}

vim.lsp.enable("lets_ls")

JSON Schema​

In order to get autocomplete and filetype support in any editor, you can use the JSON schema file provided by Lets.

VSCode​

To use the JSON schema in VSCode, you can use the YAML extension.

Add the following to your settings.json:

{
"yaml.schemas": {
"https://lets-cli.org/schema.json": [
"**/lets.yaml",
"**/lets*.yaml",
]
}
}

Neovim​

To use the JSON schema in Neovim, you can use the nvim-lspconfig with SchemaStore plugin.

In your nvim-lspconfig configuration, add the following:

servers = {
yamlls = {
on_new_config = function(new_config)
local yaml_schemas = require("schemastore").yaml.schemas({
extra = {
{
description = "Lets JSON schema",
fileMatch = { "lets.yaml", "lets*.yaml" },
name = "lets.schema.json",
url = "https://lets-cli.org/schema.json",
},
},
})
new_config.settings.yaml.schemas = vim.tbl_deep_extend("force", new_config.settings.yaml.schemas or {}, yaml_schemas)
end,
},
}