From 09f83ea29d16d7f2b7f5de7091852dca454e3761 Mon Sep 17 00:00:00 2001 From: Seymur Bagirov Date: Thu, 26 Sep 2024 17:52:51 +0400 Subject: [PATCH] refactor: move vim.filetype.add to lsp.lua --- nvim/lua/themystery/plugins/lsp.lua | 16 +++++++++++++++- nvim/lua/themystery/plugins/treesitter.lua | 5 ----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/nvim/lua/themystery/plugins/lsp.lua b/nvim/lua/themystery/plugins/lsp.lua index ff02f06..5315efb 100644 --- a/nvim/lua/themystery/plugins/lsp.lua +++ b/nvim/lua/themystery/plugins/lsp.lua @@ -43,8 +43,22 @@ return { 'ray-x/go.nvim', }, config = function() + -- unknown filetypes(needed for some lsp servers) + vim.filetype.add { + pattern = { + ['.*/hypr/.*%.conf'] = 'hyprlang', + ['openapi.*%.ya?ml'] = 'yaml.openapi', + ['openapi.*%.json'] = 'json.openapi', + } + } + + local lsp = require("lsp-zero") + lsp.configure('yamlls', { + filetypes = { 'yaml', 'yaml.openapi' } + }) + lsp.configure('csharp_ls', { handlers = { ["textDocument/definition"] = require("csharpls_extended").handler, @@ -207,7 +221,7 @@ return { local gopls_opts = require("go.lsp").config() require("mason-lspconfig").setup({ - ensure_installed = { 'tsserver', 'svelte', 'lua_ls', 'csharp_ls', 'rust_analyzer', 'gopls' }, + ensure_installed = { 'ts_ls', 'svelte', 'lua_ls', 'csharp_ls', 'rust_analyzer', 'gopls' }, handlers = { lsp.default_setup, lua_ls = function() diff --git a/nvim/lua/themystery/plugins/treesitter.lua b/nvim/lua/themystery/plugins/treesitter.lua index 890ac1b..004b16f 100644 --- a/nvim/lua/themystery/plugins/treesitter.lua +++ b/nvim/lua/themystery/plugins/treesitter.lua @@ -30,11 +30,6 @@ return { } } require('rainbow-delimiters.setup').setup() - vim.filetype.add { - pattern = { - ['.*/hypr/.*%.conf'] = 'hyprlang' - } - } end }, -- "nvim-treesitter/nvim-treesitter-context"