From 90c900c602b27d01a98c5507492d5787aee08c8b Mon Sep 17 00:00:00 2001 From: newbie Date: Tue, 19 Dec 2023 12:08:06 +0800 Subject: [PATCH] add yaml lsp --- lua/lsp/yaml.lua | 12 ++++++++++++ lua/plugs/nvim-lspconfig.lua | 6 ++++-- lua/plugs/yaml.lua | 11 ----------- 3 files changed, 16 insertions(+), 13 deletions(-) delete mode 100644 lua/plugs/yaml.lua diff --git a/lua/lsp/yaml.lua b/lua/lsp/yaml.lua index e69de29..7990cc8 100644 --- a/lua/lsp/yaml.lua +++ b/lua/lsp/yaml.lua @@ -0,0 +1,12 @@ +return { + capabilities = require('cmp_nvim_lsp').default_capabilities(), + settings = { + yaml = { + schemas = { + ["https://json.schemastore.org/github-workflow.json"] = "/.github/workflows/*", + ["../path/relative/to/file.yml"] = "/.github/workflows/*", + ["/path/from/root/of/project"] = "/.github/workflows/*", + }, + }, + } +} diff --git a/lua/plugs/nvim-lspconfig.lua b/lua/plugs/nvim-lspconfig.lua index 60e0243..d3b0fb2 100644 --- a/lua/plugs/nvim-lspconfig.lua +++ b/lua/plugs/nvim-lspconfig.lua @@ -46,8 +46,9 @@ return { require 'lspconfig'.clangd.setup(require('lsp.c')) require 'lspconfig'.bashls.setup(require('lsp.bash')) require 'lspconfig'.pyright.setup(require('lsp.pyright')) - require 'lspconfig'.jsonls.setup({}) - require('lspconfig').yamlls.setup(require("lsp.yaml")) + require 'lspconfig'.jsonls.setup {} + require 'lspconfig'.yamlls.setup(require('lsp.yaml')) + G.map({ { 'n', 'rn', 'lua vim.lsp.buf.rename()' }, @@ -60,6 +61,7 @@ return { { 'n', '', 'lua vim.lsp.buf.format()' }, }) + end }, diff --git a/lua/plugs/yaml.lua b/lua/plugs/yaml.lua deleted file mode 100644 index 2bd9f59..0000000 --- a/lua/plugs/yaml.lua +++ /dev/null @@ -1,11 +0,0 @@ -return { - settings = { - yaml = { - schemas = { - ["https://json.schemastore.org/github-workflow.json"] = "/.github/workflows/*", - ["../path/relative/to/file.yml"] = "/.github/workflows/*", - ["/path/from/root/of/project"] = "/.github/workflows/*", - }, - }, - } -}