From 670ecf53dd29b9fb0dc7c0907a00b0d0a6c6c9fc Mon Sep 17 00:00:00 2001 From: Fabian Schmidt Date: Thu, 5 Dec 2024 07:53:24 +0100 Subject: [PATCH] Changed emmet lsp, silenced repeated key warning from which-key, fixed annoying rust-analyzer error --- after/ftplugin/rust.lua | 9 ++++++++ lazy-lock.json | 48 ++++++++++++++++++++--------------------- lua/plugins/lsp.lua | 28 ++++++++++++++++++++---- lua/plugins/wk.lua | 4 ++-- 4 files changed, 58 insertions(+), 31 deletions(-) create mode 100644 after/ftplugin/rust.lua diff --git a/after/ftplugin/rust.lua b/after/ftplugin/rust.lua new file mode 100644 index 0000000..af630f1 --- /dev/null +++ b/after/ftplugin/rust.lua @@ -0,0 +1,9 @@ +for _, method in ipairs({ 'textDocument/diagnostic', 'workspace/diagnostic' }) do + local default_diagnostic_handler = vim.lsp.handlers[method] + vim.lsp.handlers[method] = function(err, result, context, config) + if err ~= nil and err.code == -32802 then + return + end + return default_diagnostic_handler(err, result, context, config) + end +end diff --git a/lazy-lock.json b/lazy-lock.json index 078cfe4..f8294ac 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,41 +1,39 @@ { "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, - "bufferline.nvim": { "branch": "main", "commit": "2e3c8cc5a57ddd32f1edd2ffd2ccb10c09421f6c" }, + "bufferline.nvim": { "branch": "main", "commit": "5c528bee3dd797d5bd6bae5f229411939b25b203" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, - "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "dashboard-nvim": { "branch": "master", "commit": "fabf5feec96185817c732d47d363f34034212685" }, - "fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" }, - "gitsigns.nvim": { "branch": "main", "commit": "1ef74b546732f185d0f806860fa5404df7614f28" }, - "kanagawa.nvim": { "branch": "master", "commit": "f491b0fe68fffbece7030181073dfe51f45cda81" }, - "lazy.nvim": { "branch": "main", "commit": "460e1cd8f24e364d54543a4b0e83f6f4ec1f65fb" }, - "lspkind-nvim": { "branch": "master", "commit": "cff4ae321a91ee3473a92ea1a8c637e3a9510aec" }, - "lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "fidget.nvim": { "branch": "main", "commit": "e2a175c2abe2d4f65357da1c98c59a5cfb2b543f" }, + "gitsigns.nvim": { "branch": "main", "commit": "ac5aba6dce8c06ea22bea2c9016f51a2dbf90dc7" }, + "kanagawa.nvim": { "branch": "master", "commit": "ad3dddecd606746374ba4807324a08331dfca23c" }, + "lazy.nvim": { "branch": "main", "commit": "e41dffcbafd7123c9c0ffb0bb1624b8e3d08c884" }, + "lspkind-nvim": { "branch": "master", "commit": "a700f1436d4a938b1a1a93c9962dc796afbaef4d" }, + "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, "lunar.nvim": { "branch": "master", "commit": "08bbc93b96ad698d22fc2aa01805786bcedc34b9" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "43894adcf10bb1190c2184bd7c1750e8ea2b3dce" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, - "nvim-autopairs": { "branch": "master", "commit": "ffc139f2a96640ca6c4d3dff9b95b7b9eace87ae" }, - "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, - "nvim-dap": { "branch": "master", "commit": "90616ae6ae40053103dc66872886fc26b94c70c8" }, - "nvim-dap-ui": { "branch": "master", "commit": "1c351e4e417d4691da12948b6ecf966936a56d28" }, - "nvim-dap-virtual-text": { "branch": "master", "commit": "3497eb39bf413a57ab5b7e7e2e192683e462148c" }, - "nvim-jdtls": { "branch": "master", "commit": "99e4b2081de1d9162666cc7b563cbeb01c26b66b" }, - "nvim-lspconfig": { "branch": "master", "commit": "eb36e0185ad4b92b0999fb698428f2966334d2c1" }, + "nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" }, + "nvim-cmp": { "branch": "main", "commit": "40a03dc225383c4f6256596c2cdf27e03b8119b5" }, + "nvim-dap": { "branch": "master", "commit": "cc92b054720a96170eca6bd9bdedd43d2b0a7a8a" }, + "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, + "nvim-dap-virtual-text": { "branch": "master", "commit": "76d80c3d171224315b61c006502a1e30c213a9ab" }, + "nvim-jdtls": { "branch": "master", "commit": "e129398e171e87c0d9e94dd5bea7eb4730473ffc" }, + "nvim-lspconfig": { "branch": "master", "commit": "f012c1b176f0e3c71f40eb309bdec0316689462e" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, - "nvim-treesitter": { "branch": "master", "commit": "4d94c24d6cb9985347bdf0692c1fd81088c6c8b2" }, - "nvim-treesitter-context": { "branch": "master", "commit": "7f7eeaa99e5a9beab518f502292871ae5f20de6f" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "bf8d2ad35d1d1a687eae6c065c3d524f7ab61b23" }, - "nvim-web-devicons": { "branch": "master", "commit": "9154484705968658e9aab2b894d1b2a64bf9f83d" }, - "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" }, + "nvim-treesitter": { "branch": "master", "commit": "a3a732107f8b529f97bf4921b3e1af5dcc756bb6" }, + "nvim-treesitter-context": { "branch": "master", "commit": "1147c42cf9477701581d1eb31e1735969e21dd06" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "3e450cd85243da99dc23ebbf14f9c70e9a0c26a4" }, + "nvim-web-devicons": { "branch": "master", "commit": "e87554285f581047b1bf236794b0eb812b444b87" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, "rustaceanvim": { "branch": "master", "commit": "047f9c9d8cd2861745eb9de6c1570ee0875aa795" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, - "trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" }, - "vimwiki": { "branch": "dev", "commit": "705ad1e0dded0e3b7ff5fac78547ab67c9d39bdf" }, - "which-key.nvim": { "branch": "main", "commit": "bfec3d6bc0a9b0b2cb11644642f78c2c3915eef0" } + "trouble.nvim": { "branch": "main", "commit": "3dc00c0447c016cd43e03054c3d49436a1f2076d" }, + "vimwiki": { "branch": "dev", "commit": "72792615e739d0eb54a9c8f7e0a46a6e2407c9e8" }, + "which-key.nvim": { "branch": "main", "commit": "68e37e12913a66b60073906f5d3f14dee0de19f2" } } diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 288fb39..b0b19dd 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -127,10 +127,30 @@ return { capabilities = capabilities, on_attach = lsp_attach }) - capabilities.textDocument.completion.completionItem.snippetSupport = true - lspconfig.emmet_ls.setup({ - capabilities = capabilities, - on_attach = lsp_attach + lspconfig.emmet_language_server.setup({ + filetypes = { "css", "html", "javascript", "typescript" }, + -- Read more about this options in the [vscode docs](https://code.visualstudio.com/docs/editor/emmet#_emmet-configuration). + -- **Note:** only the options listed in the table are supported. + init_options = { + ---@type table + includeLanguages = {}, + --- @type string[] + excludeLanguages = {}, + --- @type string[] + extensionsPath = {}, + --- @type table [Emmet Docs](https://docs.emmet.io/customization/preferences/) + preferences = {}, + --- @type boolean Defaults to `true` + showAbbreviationSuggestions = true, + --- @type "always" | "never" Defaults to `"always"` + showExpandedAbbreviation = "always", + --- @type boolean Defaults to `false` + showSuggestionsAsSnippets = false, + --- @type table [Emmet Docs](https://docs.emmet.io/customization/syntax-profiles/) + syntaxProfiles = {}, + --- @type table [Emmet Docs](https://docs.emmet.io/customization/snippets/#variables) + variables = {}, + }, }) end }, diff --git a/lua/plugins/wk.lua b/lua/plugins/wk.lua index 8408b7e..0f57ab1 100644 --- a/lua/plugins/wk.lua +++ b/lua/plugins/wk.lua @@ -16,9 +16,9 @@ end function maps.moveByRow() -- When text is wrapped, move by terminal rows, not lines, unles a count is provided vim.api.nvim_set_keymap('n', 'j', 'v:count == 0 ? \'gj\' : \'j\'', - { silent = true, expr = true, desc = "Go down 1 line" }) + { noremap = true, silent = true, expr = true, desc = "Go down 1 line" }) vim.api.nvim_set_keymap('n', 'k', 'v:count == 0 ? \'gk\' : \'k\'', - { silent = true, expr = true, desc = "Go up 1 line" }) + { noremap = true, silent = true, expr = true, desc = "Go up 1 line" }) end function maps.centeredSearch()