fix: remove config that conflicts when editing vue files
This commit is contained in:
+32
-31
@@ -1,55 +1,56 @@
|
||||
{
|
||||
"FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" },
|
||||
"LuaSnip": { "branch": "master", "commit": "73813308abc2eaeff2bc0d3f2f79270c491be9d7" },
|
||||
"LuaSnip": { "branch": "master", "commit": "dae4f5aaa3574bd0c2b9dd20fb9542a02c10471c" },
|
||||
"SchemaStore.nvim": { "branch": "main", "commit": "55ca969ceed5209d62cbf4c20cef023ff188b6c5" },
|
||||
"base46-colors": { "branch": "main", "commit": "131ca742f6e8d1eb4c938a2519a94840ba129c2f" },
|
||||
"catppuccin": { "branch": "main", "commit": "c89184526212e04feffbddda9d06b041a8fca416" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" },
|
||||
"catppuccin": { "branch": "main", "commit": "0a5de4da015a175f416d6ef1eda84661623e0500" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||
"copilot.vim": { "branch": "release", "commit": "da369d90cfd6c396b1d0ec259836a1c7222fb2ea" },
|
||||
"copilot.vim": { "branch": "release", "commit": "a12fd5672110c8aa7e3c8419e28c96943ca179be" },
|
||||
"dashboard-nvim": { "branch": "master", "commit": "0775e567b6c0be96d01a61795f7b64c1758262f6" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" },
|
||||
"github-theme": { "branch": "main", "commit": "c106c9472154d6b2c74b74565616b877ae8ed31d" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03" },
|
||||
"keys.nvim": { "branch": "main", "commit": "572490e8efac66a6008e016dbe82ad49ebfb3250" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
||||
"lazygit.nvim": { "branch": "main", "commit": "a04ad0dbc725134edbee3a5eea29290976695357" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "155eac5d8609a2f110041f8ac3491664cc126354" },
|
||||
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
|
||||
"mini.icons": { "branch": "main", "commit": "e8fae66cb400744daeedf6e387347df50271c252" },
|
||||
"neo-tree.nvim": { "branch": "v3.x", "commit": "9130e58424ad95bf2dd8b40afbb8cf04d648638c" },
|
||||
"neotest": { "branch": "master", "commit": "2cf3544fb55cdd428a9a1b7154aea9c9823426e8" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "21c2a84ce368e99b18f52ab348c4c02c32c02fcf" },
|
||||
"mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
|
||||
"mini.icons": { "branch": "main", "commit": "68c178e0958d95b3977a771f3445429b1bded985" },
|
||||
"neo-tree.nvim": { "branch": "v3.x", "commit": "f3df514fff2bdd4318127c40470984137f87b62e" },
|
||||
"neotest": { "branch": "master", "commit": "deadfb1af5ce458742671ad3a013acb9a6b41178" },
|
||||
"neotest-dotnet": { "branch": "main", "commit": "e27c67a856ce67cc968b773d01a35ec07459bb8b" },
|
||||
"neotest-go": { "branch": "main", "commit": "59b50505053f9c45a9febb79e11a56206c3e3901" },
|
||||
"neotest-jest": { "branch": "main", "commit": "2f657403aabab7d68eaa2cb9181dc4bb7fdd8a08" },
|
||||
"neotest-jest": { "branch": "main", "commit": "3f0cc2cff1ee05394081805c622dc2551b54d8c4" },
|
||||
"neotest-playwright": { "branch": "fork", "commit": "e6202f2b00dd5c3b7b626b147b86deb36c2d64bd" },
|
||||
"neotest-python": { "branch": "master", "commit": "7cab6e2ecc260bf61b97ca147574a470bd880cbd" },
|
||||
"neotest-vitest": { "branch": "main", "commit": "f5560d7048e514d8da92a9e1e1f1c6d84dd9096f" },
|
||||
"none-ls.nvim": { "branch": "main", "commit": "5cf63841461b49989972d35bf886e076a1ab3649" },
|
||||
"neotest-python": { "branch": "master", "commit": "b0d3a861bd85689d8ed73f0590c47963a7eb1bf9" },
|
||||
"neotest-vitest": { "branch": "main", "commit": "f01addc6f07b79ef1be5f4297eafbee9e0959018" },
|
||||
"none-ls.nvim": { "branch": "main", "commit": "f61f46ded0ca9edce7a09b674f8e162d10921426" },
|
||||
"nuget.nvim": { "branch": "main", "commit": "ce137d6503e96657d133b48946f8739c8600834b" },
|
||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
|
||||
"nvim-dap": { "branch": "master", "commit": "7367cec8e8f7a0b1e4566af9a7ef5959d11206a7" },
|
||||
"nvim-dap-python": { "branch": "master", "commit": "64652d1ae1db80870d9aac7132d76e37acd86a26" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "da88697d7f45d16852c6b2769dc52387d1ddc45f" },
|
||||
"nvim-dap": { "branch": "master", "commit": "db321947bb289a2d4d76a32e76e4d2bd6103d7df" },
|
||||
"nvim-dap-python": { "branch": "master", "commit": "1808458eba2b18f178f990e01376941a42c7f93b" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "db8fef885009fdec0daeff3e5dda92e1f539611e" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "44acfe887d4056f704ccc4f17513ed41c9e2b2e6" },
|
||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "41847d3dafb5004464708a3db06b14f12bde548a" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" },
|
||||
"omnisharp-extended-lsp.nvim": { "branch": "main", "commit": "ec1a2431f8872f650a85ed71c24f0715df2e49c2" },
|
||||
"onedarkpro.nvim": { "branch": "main", "commit": "eeac8847a46a02c4de4e887c4c6d34b282060b5d" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "64dd4cf3f6fd0ab17622c5ce15c91fc539c3f24a" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "746ffbb17975ebd6c40142362eee1b0249969c5c" },
|
||||
"omnisharp-extended-lsp.nvim": { "branch": "main", "commit": "a47388e5417e7f1cfa6962cc441a23c4c5fb2151" },
|
||||
"onedarkpro.nvim": { "branch": "main", "commit": "743bf248cf238a0625f3a204eecefafcf6281a9f" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"rainbow-delimiters.nvim": { "branch": "master", "commit": "3277ad5f96eb03c9d618c88e24f683e4364e578c" },
|
||||
"rainbow-delimiters.nvim": { "branch": "master", "commit": "e2858c43caafec291f915ef25fbed27bbe78abbd" },
|
||||
"telescope-themes": { "branch": "main", "commit": "65721365bd7a04a6c9679e76b6387b60320fd5f3" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||
"typr": { "branch": "main", "commit": "bdd9ef7143702851edd1dac85101e0a537056d2f" },
|
||||
"venv-selector.nvim": { "branch": "main", "commit": "ab5002d83817e481f7eef07b488c7e402d231bcf" },
|
||||
"typr": { "branch": "main", "commit": "584e4ef34dea25a4035627794322f315b22d1253" },
|
||||
"venv-selector.nvim": { "branch": "main", "commit": "d4367f29df803e1fe79c0aa8e4c6250cd0ff0e5f" },
|
||||
"vim-dadbod": { "branch": "master", "commit": "6d1d41da4873a445c5605f2005ad2c68c99d8770" },
|
||||
"vim-dadbod-completion": { "branch": "master", "commit": "a8dac0b3cf6132c80dc9b18bef36d4cf7a9e1fe6" },
|
||||
"vim-dadbod-ui": { "branch": "master", "commit": "48c4f271da13d380592f4907e2d1d5558044e4e5" },
|
||||
"vim-dadbod-ui": { "branch": "master", "commit": "07e92e22114cc5b1ba4938d99897d85b58e20475" },
|
||||
"volt": { "branch": "main", "commit": "620de1321f275ec9d80028c68d1b88b409c0c8b1" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "904308e6885bbb7b60714c80ab3daf0c071c1492" }
|
||||
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
|
||||
}
|
||||
|
||||
+297
-270
@@ -1,323 +1,350 @@
|
||||
return {
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
lazy = false,
|
||||
config = function()
|
||||
require("mason").setup()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
lazy = false,
|
||||
opts = {
|
||||
automatic_enable = false,
|
||||
auto_install = true,
|
||||
},
|
||||
},
|
||||
{
|
||||
"linux-cultist/venv-selector.nvim",
|
||||
dependencies = {
|
||||
"neovim/nvim-lspconfig",
|
||||
"mfussenegger/nvim-dap",
|
||||
"mfussenegger/nvim-dap-python",
|
||||
{ "nvim-telescope/telescope.nvim", branch = "0.1.x", dependencies = { "nvim-lua/plenary.nvim" } },
|
||||
},
|
||||
ft = "python",
|
||||
keys = {
|
||||
{ "<leader>v", "<cmd>VenvSelect<cr>" },
|
||||
},
|
||||
opts = {
|
||||
search = {},
|
||||
options = {},
|
||||
},
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = { "hoffs/omnisharp-extended-lsp.nvim" },
|
||||
lazy = false,
|
||||
config = function()
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
lazy = false,
|
||||
config = function()
|
||||
require("mason").setup()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
lazy = false,
|
||||
opts = {
|
||||
automatic_enable = false,
|
||||
auto_install = true,
|
||||
},
|
||||
},
|
||||
{
|
||||
"linux-cultist/venv-selector.nvim",
|
||||
dependencies = {
|
||||
"neovim/nvim-lspconfig",
|
||||
"mfussenegger/nvim-dap",
|
||||
"mfussenegger/nvim-dap-python",
|
||||
{ "nvim-telescope/telescope.nvim", branch = "0.1.x", dependencies = { "nvim-lua/plenary.nvim" } },
|
||||
},
|
||||
ft = "python",
|
||||
keys = {
|
||||
{ "<leader>v", "<cmd>VenvSelect<cr>" },
|
||||
},
|
||||
opts = {
|
||||
search = {},
|
||||
options = {},
|
||||
},
|
||||
},
|
||||
{
|
||||
"b0o/SchemaStore.nvim",
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = { "hoffs/omnisharp-extended-lsp.nvim" },
|
||||
lazy = false,
|
||||
config = function()
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
vim.lsp.handlers["window/showMessage"] = function(_, result, ctx)
|
||||
local client = vim.lsp.get_client_by_id(ctx.client_id)
|
||||
vim.lsp.handlers["window/showMessage"] = function(_, result, ctx)
|
||||
local client = vim.lsp.get_client_by_id(ctx.client_id)
|
||||
|
||||
local lvl = ({
|
||||
ERROR = vim.log.levels.ERROR,
|
||||
WARNING = vim.log.levels.WARN,
|
||||
INFO = vim.log.levels.INFO,
|
||||
LOG = vim.log.levels.DEBUG,
|
||||
})[result.type]
|
||||
local lvl = ({
|
||||
ERROR = vim.log.levels.ERROR,
|
||||
WARNING = vim.log.levels.WARN,
|
||||
INFO = vim.log.levels.INFO,
|
||||
LOG = vim.log.levels.DEBUG,
|
||||
})[result.type]
|
||||
|
||||
vim.notify(result.message, lvl, {
|
||||
title = string.format("LSP[%s]", client and client.name or "Unknown"),
|
||||
})
|
||||
end
|
||||
vim.notify(result.message, lvl, {
|
||||
title = string.format("LSP[%s]", client and client.name or "Unknown"),
|
||||
})
|
||||
end
|
||||
|
||||
vim.lsp.handlers["$/progress"] = function(_, result, ctx)
|
||||
local client = vim.lsp.get_client_by_id(ctx.client_id)
|
||||
vim.lsp.handlers["$/progress"] = function(_, result, ctx)
|
||||
local client = vim.lsp.get_client_by_id(ctx.client_id)
|
||||
|
||||
if result.value.kind == "begin" then
|
||||
vim.notify(
|
||||
string.format("LSP[%s] %s", client and client.name or "Unknown", result.value.title),
|
||||
vim.log.levels.INFO
|
||||
)
|
||||
end
|
||||
end
|
||||
if result.value.kind == "begin" then
|
||||
vim.notify(
|
||||
string.format("LSP[%s] %s", client and client.name or "Unknown", result.value.title),
|
||||
vim.log.levels.INFO
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
vim.lsp.config("eslint", {
|
||||
on_attach = function(_, bufnr)
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = bufnr,
|
||||
command = "EslintFixAll",
|
||||
})
|
||||
end,
|
||||
on_new_config = function(config, new_root_dir)
|
||||
config.settings.workspaceFolder = {
|
||||
uri = vim.uri_from_fname(new_root_dir),
|
||||
name = vim.fn.fnamemodify(new_root_dir, ":t"),
|
||||
}
|
||||
end,
|
||||
})
|
||||
local base_on_attach = vim.lsp.config.eslint.on_attach
|
||||
|
||||
vim.lsp.enable("eslint")
|
||||
vim.lsp.config("eslint", {
|
||||
on_attach = function(client, bufnr)
|
||||
if not base_on_attach then
|
||||
return
|
||||
end
|
||||
|
||||
vim.lsp.config("omnisharp", {
|
||||
handlers = {
|
||||
["textDocument/definition"] = require("omnisharp_extended").handler,
|
||||
},
|
||||
capabilities = capabilities,
|
||||
})
|
||||
base_on_attach(client, bufnr)
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = bufnr,
|
||||
command = "LspEslintFixAll",
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
vim.lsp.enable("omnisharp")
|
||||
vim.lsp.enable("eslint")
|
||||
|
||||
vim.lsp.config("lua_ls", {
|
||||
capabilities = capabilities,
|
||||
})
|
||||
vim.lsp.config("omnisharp", {
|
||||
handlers = {
|
||||
["textDocument/definition"] = require("omnisharp_extended").handler,
|
||||
},
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
vim.lsp.enable("lua_ls")
|
||||
vim.lsp.enable("omnisharp")
|
||||
|
||||
local vue_language_server = vim.fn.stdpath("data")
|
||||
.. "/mason/packages/vue-language-server/node_modules/@vue/language-server"
|
||||
vim.lsp.config("lua_ls", {
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
vim.lsp.config("ts_ls", {
|
||||
capabilities = capabilities,
|
||||
init_options = {
|
||||
plugins = {
|
||||
{
|
||||
name = "@vue/typescript-plugin",
|
||||
location = vue_language_server,
|
||||
languages = { "vue" },
|
||||
},
|
||||
},
|
||||
},
|
||||
filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue" },
|
||||
})
|
||||
vim.lsp.enable("lua_ls")
|
||||
|
||||
vim.lsp.enable("ts_ls")
|
||||
local vue_language_server_path = vim.fn.stdpath("data")
|
||||
.. "/mason/packages/vue-language-server/node_modules/@vue/language-server"
|
||||
|
||||
vim.lsp.config("html", {
|
||||
filetypes = { "html", "ejs", "vue", "gohtml" },
|
||||
capabilities = capabilities,
|
||||
})
|
||||
local tsserver_filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue" }
|
||||
|
||||
vim.lsp.enable("html")
|
||||
local vue_plugin = {
|
||||
name = "@vue/typescript-plugin",
|
||||
location = vue_language_server_path,
|
||||
languages = { "vue" },
|
||||
configNamespace = "typescript",
|
||||
}
|
||||
|
||||
vim.lsp.config("emmet_language_server", {
|
||||
filetypes = { "html", "css", "javascriptreact", "typescriptreact", "vue", "gohtml" },
|
||||
capabilities = capabilities,
|
||||
})
|
||||
local ts_ls_config = {
|
||||
init_options = {
|
||||
plugins = {
|
||||
vue_plugin,
|
||||
},
|
||||
},
|
||||
filetypes = tsserver_filetypes,
|
||||
}
|
||||
|
||||
vim.lsp.enable("emmet_language_server")
|
||||
local vue_ls_config = {}
|
||||
|
||||
vim.lsp.config("cssls", {
|
||||
filetypes = { "css", "vue", "scss", "less" },
|
||||
capabilities = capabilities,
|
||||
})
|
||||
vim.lsp.config("vue_ls", vue_ls_config)
|
||||
vim.lsp.config("ts_ls", ts_ls_config)
|
||||
|
||||
vim.lsp.enable("cssls")
|
||||
vim.lsp.enable("vue_ls")
|
||||
vim.lsp.enable("ts_ls")
|
||||
|
||||
vim.lsp.config("tailwindcss", {
|
||||
capabilities = capabilities,
|
||||
})
|
||||
vim.lsp.config("jsonls", {
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
json = {
|
||||
schemas = require("schemastore").json.schemas(),
|
||||
validate = { enable = true },
|
||||
format = { enable = true },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.enable("tailwindcss")
|
||||
vim.lsp.enable("jsonls")
|
||||
|
||||
vim.lsp.config("pyright", {
|
||||
capabilities = capabilities,
|
||||
})
|
||||
vim.lsp.config("html", {
|
||||
filetypes = { "html", "ejs", "gohtml" },
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
vim.lsp.enable("pyright")
|
||||
vim.lsp.enable("html")
|
||||
|
||||
vim.lsp.config("lemminx", {
|
||||
capabilities = capabilities,
|
||||
})
|
||||
vim.lsp.config("emmet_language_server", {
|
||||
filetypes = { "html", "css", "javascriptreact", "typescriptreact", "vue", "gohtml" },
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
vim.lsp.enable("lemminx")
|
||||
vim.lsp.enable("emmet_language_server")
|
||||
|
||||
vim.lsp.config("gopls", {
|
||||
capabilities = capabilities,
|
||||
filetypes = { "go", "gomod", "gowork", "gotmpl", "gohtml" },
|
||||
})
|
||||
vim.lsp.config("cssls", {
|
||||
filetypes = { "css", "scss", "less" },
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
vim.lsp.enable("gopls")
|
||||
vim.lsp.enable("cssls")
|
||||
|
||||
vim.lsp.config("rust_analyzer", {
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
diagnostics = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
capabilities = capabilities,
|
||||
})
|
||||
vim.lsp.config("tailwindcss", {
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
vim.lsp.enable("rust_analyzer")
|
||||
vim.lsp.enable("tailwindcss")
|
||||
|
||||
vim.lsp.enable("gh_actions_ls")
|
||||
vim.lsp.config("pyright", {
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||
callback = function(ev)
|
||||
local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
||||
vim.lsp.enable("pyright")
|
||||
|
||||
if not client then
|
||||
vim.notify("LSP client not found", vim.log.levels.ERROR)
|
||||
return
|
||||
end
|
||||
vim.lsp.config("lemminx", {
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
if not client.server_capabilities then
|
||||
vim.notify("LSP server not ready yet", vim.log.levels.WARN)
|
||||
return
|
||||
end
|
||||
vim.lsp.enable("lemminx")
|
||||
|
||||
client.on_error = function(err)
|
||||
vim.notify(string.format("LSP server error: %s", err.message), vim.log.levels.ERROR)
|
||||
end
|
||||
vim.lsp.config("gopls", {
|
||||
capabilities = capabilities,
|
||||
filetypes = { "go", "gomod", "gowork", "gotmpl", "gohtml" },
|
||||
})
|
||||
|
||||
client.on_status = function(status)
|
||||
if status == "stopped" then
|
||||
vim.notify("LSP server stopped", vim.log.levels.WARN)
|
||||
elseif status == "running" then
|
||||
vim.notify("LSP server running", vim.log.levels.INFO)
|
||||
end
|
||||
end
|
||||
vim.lsp.enable("gopls")
|
||||
|
||||
local omnisharp = require("omnisharp_extended")
|
||||
vim.lsp.config("rust_analyzer", {
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
diagnostics = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
if client.name == "omnisharp" then
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"gd",
|
||||
omnisharp.telescope_lsp_definition,
|
||||
{ desc = "Go to definition", buffer = ev.buf }
|
||||
)
|
||||
vim.lsp.enable("rust_analyzer")
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"gi",
|
||||
omnisharp.telescope_lsp_implementation,
|
||||
{ desc = "Go to implementation", buffer = ev.buf }
|
||||
)
|
||||
vim.lsp.enable("gh_actions_ls")
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"gr",
|
||||
omnisharp.telescope_lsp_references,
|
||||
{ desc = "Go to references", buffer = ev.buf }
|
||||
)
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||
callback = function(ev)
|
||||
local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>D",
|
||||
omnisharp.telescope_lsp_type_definition,
|
||||
{ desc = "Go to type definition", buffer = ev.buf }
|
||||
)
|
||||
else
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"gd",
|
||||
vim.lsp.buf.definition,
|
||||
{ desc = "Go to definition", buffer = ev.buf }
|
||||
)
|
||||
if not client then
|
||||
vim.notify("LSP client not found", vim.log.levels.ERROR)
|
||||
return
|
||||
end
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"gD",
|
||||
vim.lsp.buf.declaration,
|
||||
{ desc = "Go to declaration", buffer = ev.buf }
|
||||
)
|
||||
if not client.server_capabilities then
|
||||
vim.notify("LSP server not ready yet", vim.log.levels.WARN)
|
||||
return
|
||||
end
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"gi",
|
||||
vim.lsp.buf.implementation,
|
||||
{ desc = "Go to implementation", buffer = ev.buf }
|
||||
)
|
||||
client.on_error = function(err)
|
||||
vim.notify(string.format("LSP server error: %s", err.message), vim.log.levels.ERROR)
|
||||
end
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"gr",
|
||||
vim.lsp.buf.references,
|
||||
{ desc = "Go to references", buffer = ev.buf }
|
||||
)
|
||||
end
|
||||
client.on_status = function(status)
|
||||
if status == "stopped" then
|
||||
vim.notify("LSP server stopped", vim.log.levels.WARN)
|
||||
elseif status == "running" then
|
||||
vim.notify("LSP server running", vim.log.levels.INFO)
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
callback = function()
|
||||
if require("nvim-treesitter.parsers").has_parser() then
|
||||
vim.opt.foldmethod = "expr"
|
||||
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
else
|
||||
vim.opt.foldmethod = "syntax"
|
||||
end
|
||||
end,
|
||||
})
|
||||
local omnisharp = require("omnisharp_extended")
|
||||
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = "*.go",
|
||||
callback = function()
|
||||
local params = vim.lsp.util.make_range_params()
|
||||
params.context = { only = { "source.organizeImports" } }
|
||||
local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params)
|
||||
for cid, res in pairs(result or {}) do
|
||||
for _, r in pairs(res.result or {}) do
|
||||
if r.edit then
|
||||
local enc = (vim.lsp.get_client_by_id(cid) or {}).offset_encoding or "utf-16"
|
||||
vim.lsp.util.apply_workspace_edit(r.edit, enc)
|
||||
end
|
||||
end
|
||||
end
|
||||
vim.lsp.buf.format({ async = false })
|
||||
end,
|
||||
})
|
||||
if client.name == "omnisharp" then
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"gd",
|
||||
omnisharp.telescope_lsp_definition,
|
||||
{ desc = "Go to definition", buffer = ev.buf }
|
||||
)
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>ca",
|
||||
vim.lsp.buf.code_action,
|
||||
{ desc = "Code actions", buffer = ev.buf }
|
||||
)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"gi",
|
||||
omnisharp.telescope_lsp_implementation,
|
||||
{ desc = "Go to implementation", buffer = ev.buf }
|
||||
)
|
||||
|
||||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, { desc = "Rename", buffer = ev.buf })
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"gr",
|
||||
omnisharp.telescope_lsp_references,
|
||||
{ desc = "Go to references", buffer = ev.buf }
|
||||
)
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>e",
|
||||
vim.diagnostic.open_float,
|
||||
{ desc = "Display error for current line", buffer = ev.buf }
|
||||
)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>D",
|
||||
omnisharp.telescope_lsp_type_definition,
|
||||
{ desc = "Go to type definition", buffer = ev.buf }
|
||||
)
|
||||
else
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"gd",
|
||||
vim.lsp.buf.definition,
|
||||
{ desc = "Go to definition", buffer = ev.buf }
|
||||
)
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>ea",
|
||||
":Telescope diagnostics bufnr=0<CR>",
|
||||
{ desc = "Display errors for current buffer", buffer = ev.buf }
|
||||
)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"gD",
|
||||
vim.lsp.buf.declaration,
|
||||
{ desc = "Go to declaration", buffer = ev.buf }
|
||||
)
|
||||
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, { desc = "Display symbol info", buffer = ev.buf })
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"gi",
|
||||
vim.lsp.buf.implementation,
|
||||
{ desc = "Go to implementation", buffer = ev.buf }
|
||||
)
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"gr",
|
||||
vim.lsp.buf.references,
|
||||
{ desc = "Go to references", buffer = ev.buf }
|
||||
)
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
callback = function()
|
||||
if require("nvim-treesitter.parsers").has_parser() then
|
||||
vim.opt.foldmethod = "expr"
|
||||
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
else
|
||||
vim.opt.foldmethod = "syntax"
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = "*.go",
|
||||
callback = function()
|
||||
local params = vim.lsp.util.make_range_params()
|
||||
params.context = { only = { "source.organizeImports" } }
|
||||
local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params)
|
||||
for cid, res in pairs(result or {}) do
|
||||
for _, r in pairs(res.result or {}) do
|
||||
if r.edit then
|
||||
local enc = (vim.lsp.get_client_by_id(cid) or {}).offset_encoding or "utf-16"
|
||||
vim.lsp.util.apply_workspace_edit(r.edit, enc)
|
||||
end
|
||||
end
|
||||
end
|
||||
vim.lsp.buf.format({ async = false })
|
||||
end,
|
||||
})
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>ca",
|
||||
vim.lsp.buf.code_action,
|
||||
{ desc = "Code actions", buffer = ev.buf }
|
||||
)
|
||||
|
||||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, { desc = "Rename", buffer = ev.buf })
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>e",
|
||||
vim.diagnostic.open_float,
|
||||
{ desc = "Display error for current line", buffer = ev.buf }
|
||||
)
|
||||
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>ea",
|
||||
":Telescope diagnostics bufnr=0<CR>",
|
||||
{ desc = "Display errors for current buffer", buffer = ev.buf }
|
||||
)
|
||||
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, { desc = "Display symbol info", buffer = ev.buf })
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user