From fbbdeaaf3a99027243c7b82cfbfc2e2e1d4b89e9 Mon Sep 17 00:00:00 2001 From: Felipe Silveira Date: Mon, 21 Oct 2024 08:08:59 +0100 Subject: [PATCH] feat: add cue and kcl support (wip) --- CHANGELOG.md | 3 +++ nvim/lua/lsp/config.lua | 5 +++++ nvim/lua/lsp/servers/kcl.lua | 14 ++++++++++++++ nvim/lua/lsp/servers/toml.lua | 14 ++++++++++++++ nvim/lua/lsp/servers/yaml.lua | 3 ++- nvim/lua/plugins/formatting.lua | 2 ++ nvim/lua/plugins/kcl.lua | 7 +++++++ 7 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 nvim/lua/lsp/servers/kcl.lua create mode 100644 nvim/lua/lsp/servers/toml.lua create mode 100644 nvim/lua/plugins/kcl.lua diff --git a/CHANGELOG.md b/CHANGELOG.md index 86eda58..bd4fed0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ### [2024-10-21] + * [[6478eab]](https://github.com/silveiralexf/.dotfiles/commit/6478eab1af1575f1d75ab28b46a144780373c3a9) chore: remove multicursors plugin (silveiralexf@gmail.com) + + * [[28b0e36]](https://github.com/silveiralexf/.dotfiles/commit/28b0e366b5a7f04d0099876c747d0afbe19c2711) chore: bump deps, update dict and add lsp header to taskfile (silveiralexf@gmail.com) diff --git a/nvim/lua/lsp/config.lua b/nvim/lua/lsp/config.lua index e890ada..c78d0ce 100644 --- a/nvim/lua/lsp/config.lua +++ b/nvim/lua/lsp/config.lua @@ -45,6 +45,7 @@ return { 'pylsp', 'rust_analyzer', 'svelte', + 'taplo', 'terraformls', 'tflint', 'ts_ls', @@ -57,6 +58,10 @@ return { require('lspconfig')[server_name].setup({ capabilities = capabilities, }) + -- HACK: directly forcing install while not yet supported by mason-lspconfig + -- ref to: https://github.com/williamboman/mason-lspconfig.nvim/pull/461 + require('lspconfig').kcl.setup({}) + require('lspconfig').dagger.setup({}) end, }, }) diff --git a/nvim/lua/lsp/servers/kcl.lua b/nvim/lua/lsp/servers/kcl.lua new file mode 100644 index 0000000..5aed345 --- /dev/null +++ b/nvim/lua/lsp/servers/kcl.lua @@ -0,0 +1,14 @@ +return { + { + 'neovim/nvim-lspconfig', + config = function() + require('lspconfig').setup({ + opts = { + setup = { + kcl = {}, + }, + }, + }) + end, + }, +} diff --git a/nvim/lua/lsp/servers/toml.lua b/nvim/lua/lsp/servers/toml.lua new file mode 100644 index 0000000..72bc4b6 --- /dev/null +++ b/nvim/lua/lsp/servers/toml.lua @@ -0,0 +1,14 @@ +return { + { + 'neovim/nvim-lspconfig', + config = function() + require('lspconfig').setup({ + opts = { + setup = { + taplo = {}, + }, + }, + }) + end, + }, +} diff --git a/nvim/lua/lsp/servers/yaml.lua b/nvim/lua/lsp/servers/yaml.lua index 10daf47..1aa02d6 100644 --- a/nvim/lua/lsp/servers/yaml.lua +++ b/nvim/lua/lsp/servers/yaml.lua @@ -33,7 +33,7 @@ return { -- Must disable built-in schemaStore support to use enable = true, -- Avoid TypeError: Cannot read properties of undefined (reading 'length') - url = '', + url = 'https://www.schemastore.org/api/json/catalog.json', }, schemas = require('schemastore')['yaml-companion'].yaml.schemas({ -- select subset from the JSON schema catalog @@ -42,6 +42,7 @@ return { 'kustomization.yaml', '.*docker-compose.{yml,yaml}', '*.compose.{yml,yaml}', + 'https://www.schemastore.org/api/json/catalog.json', 'https://json.schemastore.org/github-workflow.json', }, diff --git a/nvim/lua/plugins/formatting.lua b/nvim/lua/plugins/formatting.lua index 0006b11..6a0e017 100644 --- a/nvim/lua/plugins/formatting.lua +++ b/nvim/lua/plugins/formatting.lua @@ -34,6 +34,8 @@ return { hcl = { 'terraform_fmt' }, html = { 'prettierd' }, java = { 'prettierd' }, + cue = { 'cue_fmt' }, + dagger = { 'cue_fmt' }, javascript = { 'prettierd' }, javascriptreact = { 'prettierd' }, json = { 'prettierd' }, diff --git a/nvim/lua/plugins/kcl.lua b/nvim/lua/plugins/kcl.lua new file mode 100644 index 0000000..3ae241e --- /dev/null +++ b/nvim/lua/plugins/kcl.lua @@ -0,0 +1,7 @@ +-- HACK: directly forcing install while not yet supported by mason-lspconfig +-- ref to: https://github.com/williamboman/mason-lspconfig.nvim/pull/461 +return { + { + 'kcl-lang/kcl.nvim', + }, +}