feat: add support for ts7 projects

This commit is contained in:
Stevan Freeborn
2026-07-13 18:07:38 -05:00
parent 3713cd68b9
commit b7f335ed22
2 changed files with 434 additions and 395 deletions
+9 -9
View File
@@ -1,9 +1,9 @@
{ {
"FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" },
"LuaSnip": { "branch": "master", "commit": "0abc8f390b278c3b4aabc4c004ac8a088b65cf24" }, "LuaSnip": { "branch": "master", "commit": "0abc8f390b278c3b4aabc4c004ac8a088b65cf24" },
"SchemaStore.nvim": { "branch": "main", "commit": "19adbfb1c4d4049b691be0d840936b109de0f5ea" }, "SchemaStore.nvim": { "branch": "main", "commit": "e954496f8ef22904e8a84f5078f4a110fdc7a0d3" },
"base46-colors": { "branch": "main", "commit": "131ca742f6e8d1eb4c938a2519a94840ba129c2f" }, "base46-colors": { "branch": "main", "commit": "131ca742f6e8d1eb4c938a2519a94840ba129c2f" },
"catppuccin": { "branch": "main", "commit": "e068ab5f8261f23f6f71ffd8791ae40315b77b9c" }, "catppuccin": { "branch": "main", "commit": "05e8787020dcfdb937bf2ff23855ea2415b4e072" },
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"copilot.vim": { "branch": "release", "commit": "a12fd5672110c8aa7e3c8419e28c96943ca179be" }, "copilot.vim": { "branch": "release", "commit": "a12fd5672110c8aa7e3c8419e28c96943ca179be" },
@@ -15,9 +15,9 @@
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
"lazygit.nvim": { "branch": "main", "commit": "a04ad0dbc725134edbee3a5eea29290976695357" }, "lazygit.nvim": { "branch": "main", "commit": "a04ad0dbc725134edbee3a5eea29290976695357" },
"lualine.nvim": { "branch": "master", "commit": "221ce6b2d999187044529f49da6554a92f740a96" }, "lualine.nvim": { "branch": "master", "commit": "221ce6b2d999187044529f49da6554a92f740a96" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "47059d71b42d74b0a1e9f61c1d99d301039c3b5b" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "a4068c3ebd4cb335b25239e5ea35c22ee6007962" },
"mason.nvim": { "branch": "main", "commit": "2a6940af80375532e5e9e7c1f2fc6319a1b7a69d" }, "mason.nvim": { "branch": "main", "commit": "2a6940af80375532e5e9e7c1f2fc6319a1b7a69d" },
"mini.icons": { "branch": "main", "commit": "24dbea2195c477e57d581215839a6ab915f34b14" }, "mini.icons": { "branch": "main", "commit": "98faae31e9be1cc054ae63485e58ceb185efcad0" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "ebd66767191714e008ce73b769518a763ff31bdc" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "ebd66767191714e008ce73b769518a763ff31bdc" },
"neotest": { "branch": "master", "commit": "fb84d87285698f7055f618083c351984449119b8" }, "neotest": { "branch": "master", "commit": "fb84d87285698f7055f618083c351984449119b8" },
"neotest-dotnet": { "branch": "main", "commit": "e27c67a856ce67cc968b773d01a35ec07459bb8b" }, "neotest-dotnet": { "branch": "main", "commit": "e27c67a856ce67cc968b773d01a35ec07459bb8b" },
@@ -25,20 +25,20 @@
"neotest-jest": { "branch": "main", "commit": "0e7979d51301dfae5ef839d771bd28cf593fde3f" }, "neotest-jest": { "branch": "main", "commit": "0e7979d51301dfae5ef839d771bd28cf593fde3f" },
"neotest-playwright": { "branch": "fork", "commit": "e6202f2b00dd5c3b7b626b147b86deb36c2d64bd" }, "neotest-playwright": { "branch": "fork", "commit": "e6202f2b00dd5c3b7b626b147b86deb36c2d64bd" },
"neotest-python": { "branch": "master", "commit": "51c453d57f8d5156671b42ea57fafa2e1c9fb641" }, "neotest-python": { "branch": "master", "commit": "51c453d57f8d5156671b42ea57fafa2e1c9fb641" },
"neotest-vitest": { "branch": "main", "commit": "ab5a73d6ec9d33e807d6c67ce5169c4ca4a5d7f3" }, "neotest-vitest": { "branch": "main", "commit": "c3c69715da4b158069fd4262083e7219a5c14cfb" },
"none-ls.nvim": { "branch": "main", "commit": "01f8e62ea11603e59ad9ff7afcfa94fd183f76d6" }, "none-ls.nvim": { "branch": "main", "commit": "01f8e62ea11603e59ad9ff7afcfa94fd183f76d6" },
"nuget.nvim": { "branch": "main", "commit": "574cb236bccd8c6e276da923c65f9dbf1f789f73" }, "nuget.nvim": { "branch": "main", "commit": "574cb236bccd8c6e276da923c65f9dbf1f789f73" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-autopairs": { "branch": "master", "commit": "7b9923abad60b903ece7c52940e1321d39eccc79" }, "nvim-autopairs": { "branch": "master", "commit": "7b9923abad60b903ece7c52940e1321d39eccc79" },
"nvim-cmp": { "branch": "main", "commit": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca" }, "nvim-cmp": { "branch": "main", "commit": "2ffe79f1f021def8dd1fcd81deb16f1bb0d989f3" },
"nvim-dap": { "branch": "master", "commit": "9e848e09a697ee95302a3ef2dd43fd6eb709e570" }, "nvim-dap": { "branch": "master", "commit": "9e848e09a697ee95302a3ef2dd43fd6eb709e570" },
"nvim-dap-python": { "branch": "master", "commit": "1808458eba2b18f178f990e01376941a42c7f93b" }, "nvim-dap-python": { "branch": "master", "commit": "1808458eba2b18f178f990e01376941a42c7f93b" },
"nvim-dap-ui": { "branch": "master", "commit": "1a66cabaa4a4da0be107d5eda6d57242f0fe7e49" }, "nvim-dap-ui": { "branch": "master", "commit": "1a66cabaa4a4da0be107d5eda6d57242f0fe7e49" },
"nvim-lspconfig": { "branch": "master", "commit": "d224a1920728ba129880efc700d4a0180ac4ecbb" }, "nvim-lspconfig": { "branch": "master", "commit": "d5b6e3db4c17b0146f63a2fc47e2027a754b2cb1" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
"nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" }, "nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" },
"nvim-treesitter-context": { "branch": "master", "commit": "b311b30818951d01f7b4bf650521b868b3fece16" }, "nvim-treesitter-context": { "branch": "master", "commit": "b311b30818951d01f7b4bf650521b868b3fece16" },
"nvim-web-devicons": { "branch": "master", "commit": "dad71387de386a946b123079d0e53f23028f3abd" }, "nvim-web-devicons": { "branch": "master", "commit": "09d1324e264c6950262dbe02a9bce2933a6800db" },
"omnisharp-extended-lsp.nvim": { "branch": "main", "commit": "51e407a46ddb15e49727139b5b1ae3650cd6a069" }, "omnisharp-extended-lsp.nvim": { "branch": "main", "commit": "51e407a46ddb15e49727139b5b1ae3650cd6a069" },
"onedarkpro.nvim": { "branch": "main", "commit": "f5fddfd5122fe00421e199151ae4fe8571a02898" }, "onedarkpro.nvim": { "branch": "main", "commit": "f5fddfd5122fe00421e199151ae4fe8571a02898" },
"plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" }, "plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" },
@@ -53,6 +53,6 @@
"vim-dadbod-completion": { "branch": "master", "commit": "a8dac0b3cf6132c80dc9b18bef36d4cf7a9e1fe6" }, "vim-dadbod-completion": { "branch": "master", "commit": "a8dac0b3cf6132c80dc9b18bef36d4cf7a9e1fe6" },
"vim-dadbod-ui": { "branch": "master", "commit": "afd07819d8efcefc3317205b855ad4e3513b0011" }, "vim-dadbod-ui": { "branch": "master", "commit": "afd07819d8efcefc3317205b855ad4e3513b0011" },
"volt": { "branch": "main", "commit": "620de1321f275ec9d80028c68d1b88b409c0c8b1" }, "volt": { "branch": "main", "commit": "620de1321f275ec9d80028c68d1b88b409c0c8b1" },
"watchexec.nvim": { "branch": "main", "commit": "f112ac542ef60bfd3f5168559df3229d389a16e5" }, "watchexec.nvim": { "branch": "main", "commit": "d424bd730784696e3f97f132581ba6fed39d16b0" },
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
} }
+425 -386
View File
@@ -1,388 +1,427 @@
return { return {
{ {
"williamboman/mason.nvim", "williamboman/mason.nvim",
lazy = false, lazy = false,
config = function() config = function()
require("mason").setup() require("mason").setup()
end, end,
}, },
{ {
"williamboman/mason-lspconfig.nvim", "williamboman/mason-lspconfig.nvim",
lazy = false, lazy = false,
opts = { opts = {
automatic_enable = false, automatic_enable = false,
auto_install = true, auto_install = true,
}, },
}, },
{ {
"linux-cultist/venv-selector.nvim", "linux-cultist/venv-selector.nvim",
dependencies = { dependencies = {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
"mfussenegger/nvim-dap", "mfussenegger/nvim-dap",
"mfussenegger/nvim-dap-python", "mfussenegger/nvim-dap-python",
{ "nvim-telescope/telescope.nvim", branch = "0.1.x", dependencies = { "nvim-lua/plenary.nvim" } }, { "nvim-telescope/telescope.nvim", branch = "0.1.x", dependencies = { "nvim-lua/plenary.nvim" } },
}, },
ft = "python", ft = "python",
keys = { keys = {
{ "<leader>v", "<cmd>VenvSelect<cr>" }, { "<leader>v", "<cmd>VenvSelect<cr>" },
}, },
opts = { opts = {
search = {}, search = {},
options = {}, options = {},
}, },
}, },
{ {
"b0o/SchemaStore.nvim", "b0o/SchemaStore.nvim",
}, },
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
dependencies = { "hoffs/omnisharp-extended-lsp.nvim" }, dependencies = { "hoffs/omnisharp-extended-lsp.nvim" },
lazy = false, lazy = false,
config = function() config = function()
local capabilities = require("cmp_nvim_lsp").default_capabilities() local capabilities = require("cmp_nvim_lsp").default_capabilities()
vim.lsp.handlers["window/showMessage"] = function(_, result, ctx) vim.lsp.handlers["window/showMessage"] = function(_, result, ctx)
local client = vim.lsp.get_client_by_id(ctx.client_id) local client = vim.lsp.get_client_by_id(ctx.client_id)
local lvl = ({ local lvl = ({
ERROR = vim.log.levels.ERROR, ERROR = vim.log.levels.ERROR,
WARNING = vim.log.levels.WARN, WARNING = vim.log.levels.WARN,
INFO = vim.log.levels.INFO, INFO = vim.log.levels.INFO,
LOG = vim.log.levels.DEBUG, LOG = vim.log.levels.DEBUG,
})[result.type] })[result.type]
vim.notify(result.message, lvl, { vim.notify(result.message, lvl, {
title = string.format("LSP[%s]", client and client.name or "Unknown"), title = string.format("LSP[%s]", client and client.name or "Unknown"),
}) })
end end
vim.lsp.handlers["$/progress"] = function(_, result, ctx) vim.lsp.handlers["$/progress"] = function(_, result, ctx)
local client = vim.lsp.get_client_by_id(ctx.client_id) local client = vim.lsp.get_client_by_id(ctx.client_id)
if result.value.kind == "begin" then if result.value.kind == "begin" then
vim.notify( vim.notify(
string.format("LSP[%s] %s", client and client.name or "Unknown", result.value.title), string.format("LSP[%s] %s", client and client.name or "Unknown", result.value.title),
vim.log.levels.INFO vim.log.levels.INFO
) )
end end
end end
local base_on_attach = vim.lsp.config.eslint.on_attach local base_on_attach = vim.lsp.config.eslint.on_attach
vim.lsp.config("eslint", { vim.lsp.config("eslint", {
on_attach = function(client, bufnr) on_attach = function(client, bufnr)
if not base_on_attach then if not base_on_attach then
return return
end end
base_on_attach(client, bufnr) base_on_attach(client, bufnr)
vim.api.nvim_create_autocmd("BufWritePre", { vim.api.nvim_create_autocmd("BufWritePre", {
buffer = bufnr, buffer = bufnr,
command = "LspEslintFixAll", command = "LspEslintFixAll",
}) })
end, end,
}) })
vim.lsp.enable("eslint") vim.lsp.enable("eslint")
vim.lsp.config("omnisharp", { vim.lsp.config("omnisharp", {
handlers = { handlers = {
["textDocument/definition"] = require("omnisharp_extended").handler, ["textDocument/definition"] = require("omnisharp_extended").handler,
}, },
capabilities = capabilities, capabilities = capabilities,
}) })
vim.lsp.enable("omnisharp") vim.lsp.enable("omnisharp")
vim.lsp.config("fsautocomplete", { vim.lsp.config("fsautocomplete", {
capabilities = capabilities, capabilities = capabilities,
}) })
vim.lsp.enable("fsautocomplete") vim.lsp.enable("fsautocomplete")
vim.lsp.config("lua_ls", { vim.lsp.config("lua_ls", {
capabilities = capabilities, capabilities = capabilities,
}) })
vim.lsp.enable("lua_ls") vim.lsp.enable("lua_ls")
local vue_language_server_path = vim.fn.stdpath("data") local vue_language_server_path = vim.fn.stdpath("data")
.. "/mason/packages/vue-language-server/node_modules/@vue/language-server" .. "/mason/packages/vue-language-server/node_modules/@vue/language-server"
local tsserver_filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue" } local vue_plugin = {
name = "@vue/typescript-plugin",
local vue_plugin = { location = vue_language_server_path,
name = "@vue/typescript-plugin", languages = { "vue" },
location = vue_language_server_path, configNamespace = "typescript",
languages = { "vue" }, }
configNamespace = "typescript",
} -- NOTE: need a way to handle typescript 7 and
-- projects using older versions of typescript
local ts_ls_config = { -- likely need to revisit this once things get
init_options = { -- sorted out between vue ls and ts ls.
plugins = { local function detect_local_ts_version()
vue_plugin, local pkg_path = vim.fn.getcwd() .. "/node_modules/typescript/package.json"
}, local ok, content = pcall(vim.fn.readfile, pkg_path)
},
filetypes = tsserver_filetypes, if ok and content and #content > 0 then
} local decoded = vim.json.decode(table.concat(content, "\n"))
local vue_ls_config = {} if decoded and decoded.version then
return tonumber(decoded.version:match("^(%d+)"))
vim.lsp.config("vue_ls", vue_ls_config) end
vim.lsp.config("ts_ls", ts_ls_config) end
return nil
vim.lsp.enable("vue_ls") end
vim.lsp.enable("ts_ls")
local ts_version = detect_local_ts_version()
vim.lsp.config("jsonls", {
capabilities = capabilities, if ts_version and ts_version >= 7 then
settings = { vim.lsp.config("tsgo", {
json = { cmd = function(dispatchers, config)
schemas = require("schemastore").json.schemas(), local cmd = "tsc"
validate = { enable = true },
format = { enable = true }, if config and config.root_dir then
}, local local_cmd = vim.fs.joinpath(config.root_dir, "node_modules/.bin", cmd)
},
}) if vim.fn.executable(local_cmd) == 1 then
cmd = local_cmd
vim.lsp.enable("jsonls") end
end
vim.lsp.config("html", {
filetypes = { "html", "ejs", "gohtml" }, return vim.lsp.rpc.start({ cmd, "--lsp", "--stdio" }, dispatchers)
capabilities = capabilities, end,
}) filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact" },
})
vim.lsp.enable("html")
vim.lsp.enable("tsgo")
vim.lsp.config("emmet_language_server", { else
filetypes = { "html", "css", "javascriptreact", "typescriptreact", "vue", "gohtml" }, local tsserver_filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue" }
capabilities = capabilities,
}) local ts_ls_config = {
init_options = {
vim.lsp.enable("emmet_language_server") plugins = {
vue_plugin,
vim.lsp.config("cssls", { },
filetypes = { "css", "scss", "less" }, },
capabilities = capabilities, filetypes = tsserver_filetypes,
}) }
vim.lsp.enable("cssls") vim.lsp.config("vue_ls", {})
vim.lsp.config("ts_ls", ts_ls_config)
vim.lsp.config("tailwindcss", {
capabilities = capabilities, vim.lsp.enable("vue_ls")
}) vim.lsp.enable("ts_ls")
end
vim.lsp.enable("tailwindcss")
vim.lsp.config("jsonls", {
vim.lsp.config("pyright", { capabilities = capabilities,
capabilities = capabilities, settings = {
}) json = {
schemas = require("schemastore").json.schemas(),
vim.lsp.enable("pyright") validate = { enable = true },
format = { enable = true },
vim.lsp.config("lemminx", { },
capabilities = capabilities, },
}) })
vim.lsp.enable("lemminx") vim.lsp.enable("jsonls")
vim.lsp.config("gopls", { vim.lsp.config("html", {
capabilities = capabilities, filetypes = { "html", "ejs", "gohtml" },
filetypes = { "go", "gomod", "gowork", "gotmpl", "gohtml" }, capabilities = capabilities,
settings = { })
gopls = {
buildFlags = { "-tags=integration" } vim.lsp.enable("html")
}
} vim.lsp.config("emmet_language_server", {
}) filetypes = { "html", "css", "javascriptreact", "typescriptreact", "vue", "gohtml" },
capabilities = capabilities,
vim.lsp.enable("gopls") })
vim.lsp.config("rust_analyzer", { vim.lsp.enable("emmet_language_server")
settings = {
["rust-analyzer"] = { vim.lsp.config("cssls", {
files = { filetypes = { "css", "scss", "less" },
watcher = "server", capabilities = capabilities,
}, })
check = {
command = "clippy", vim.lsp.enable("cssls")
},
diagnostics = { vim.lsp.config("tailwindcss", {
enable = false, capabilities = capabilities,
}, })
},
}, vim.lsp.enable("tailwindcss")
capabilities = capabilities,
}) vim.lsp.config("pyright", {
capabilities = capabilities,
vim.lsp.enable("rust_analyzer") })
vim.lsp.config("gh_actions_ls", { vim.lsp.enable("pyright")
capabilities = capabilities,
filetypes = { "yaml" }, vim.lsp.config("lemminx", {
settings = { capabilities = capabilities,
yaml = { })
schemas = {
["https://json.schemastore.org/github-workflow.json"] = "/*/.github/workflows/*", vim.lsp.enable("lemminx")
},
}, vim.lsp.config("gopls", {
}, capabilities = capabilities,
}) filetypes = { "go", "gomod", "gowork", "gotmpl", "gohtml" },
settings = {
vim.lsp.enable("gh_actions_ls") gopls = {
buildFlags = { "-tags=integration" },
vim.lsp.config("sqlls", { },
capabilities = capabilities, },
filetypes = { "sql" }, })
})
vim.lsp.enable("gopls")
vim.lsp.enable("sqlls")
vim.lsp.config("rust_analyzer", {
vim.api.nvim_create_autocmd("LspAttach", { settings = {
group = vim.api.nvim_create_augroup("UserLspConfig", {}), ["rust-analyzer"] = {
callback = function(ev) files = {
local client = vim.lsp.get_client_by_id(ev.data.client_id) watcher = "server",
},
if not client then check = {
vim.notify("LSP client not found", vim.log.levels.ERROR) command = "clippy",
return },
end diagnostics = {
enable = false,
if not client.server_capabilities then },
vim.notify("LSP server not ready yet", vim.log.levels.WARN) },
return },
end capabilities = capabilities,
})
client.on_error = function(err)
vim.notify(string.format("LSP server error: %s", err.message), vim.log.levels.ERROR) vim.lsp.enable("rust_analyzer")
end
vim.lsp.config("gh_actions_ls", {
client.on_status = function(status) capabilities = capabilities,
if status == "stopped" then filetypes = { "yaml" },
vim.notify("LSP server stopped", vim.log.levels.WARN) settings = {
elseif status == "running" then yaml = {
vim.notify("LSP server running", vim.log.levels.INFO) schemas = {
end ["https://json.schemastore.org/github-workflow.json"] = "/*/.github/workflows/*",
end },
},
local omnisharp = require("omnisharp_extended") },
})
if client.name == "omnisharp" then
vim.keymap.set( vim.lsp.enable("gh_actions_ls")
"n",
"gd", vim.lsp.config("sqlls", {
omnisharp.telescope_lsp_definition, capabilities = capabilities,
{ desc = "Go to definition", buffer = ev.buf } filetypes = { "sql" },
) })
vim.keymap.set( vim.lsp.enable("sqlls")
"n",
"gi", vim.api.nvim_create_autocmd("LspAttach", {
omnisharp.telescope_lsp_implementation, group = vim.api.nvim_create_augroup("UserLspConfig", {}),
{ desc = "Go to implementation", buffer = ev.buf } callback = function(ev)
) local client = vim.lsp.get_client_by_id(ev.data.client_id)
vim.keymap.set( if not client then
"n", vim.notify("LSP client not found", vim.log.levels.ERROR)
"gr", return
omnisharp.telescope_lsp_references, end
{ desc = "Go to references", buffer = ev.buf }
) if not client.server_capabilities then
vim.notify("LSP server not ready yet", vim.log.levels.WARN)
vim.keymap.set( return
"n", end
"<leader>D",
omnisharp.telescope_lsp_type_definition, client.on_error = function(err)
{ desc = "Go to type definition", buffer = ev.buf } vim.notify(string.format("LSP server error: %s", err.message), vim.log.levels.ERROR)
) end
else
vim.keymap.set( client.on_status = function(status)
"n", if status == "stopped" then
"gd", vim.notify("LSP server stopped", vim.log.levels.WARN)
vim.lsp.buf.definition, elseif status == "running" then
{ desc = "Go to definition", buffer = ev.buf } vim.notify("LSP server running", vim.log.levels.INFO)
) end
end
vim.keymap.set(
"n", local omnisharp = require("omnisharp_extended")
"gD",
vim.lsp.buf.declaration, if client.name == "omnisharp" then
{ desc = "Go to declaration", buffer = ev.buf } vim.keymap.set(
) "n",
"gd",
vim.keymap.set( omnisharp.telescope_lsp_definition,
"n", { desc = "Go to definition", buffer = ev.buf }
"gi", )
vim.lsp.buf.implementation,
{ desc = "Go to implementation", buffer = ev.buf } vim.keymap.set(
) "n",
"gi",
vim.keymap.set( omnisharp.telescope_lsp_implementation,
"n", { desc = "Go to implementation", buffer = ev.buf }
"gr", )
vim.lsp.buf.references,
{ desc = "Go to references", buffer = ev.buf } vim.keymap.set(
) "n",
end "gr",
omnisharp.telescope_lsp_references,
vim.api.nvim_create_autocmd({ "FileType" }, { { desc = "Go to references", buffer = ev.buf }
callback = function() )
local parsers = require("nvim-treesitter.parsers")
vim.keymap.set(
if parsers then "n",
vim.opt.foldmethod = "expr" "<leader>D",
vim.opt.foldexpr = "nvim_treesitter#foldexpr()" omnisharp.telescope_lsp_type_definition,
else { desc = "Go to type definition", buffer = ev.buf }
vim.opt.foldmethod = "syntax" )
end else
end, vim.keymap.set(
}) "n",
"gd",
vim.api.nvim_create_autocmd("BufWritePre", { vim.lsp.buf.definition,
pattern = "*.go", { desc = "Go to definition", buffer = ev.buf }
callback = function() )
local params = vim.lsp.util.make_range_params()
params.context = { only = { "source.organizeImports" } } vim.keymap.set(
local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params) "n",
for cid, res in pairs(result or {}) do "gD",
for _, r in pairs(res.result or {}) do vim.lsp.buf.declaration,
if r.edit then { desc = "Go to declaration", buffer = ev.buf }
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 vim.keymap.set(
end "n",
end "gi",
vim.lsp.buf.format({ async = false }) vim.lsp.buf.implementation,
end, { desc = "Go to implementation", buffer = ev.buf }
}) )
vim.keymap.set( vim.keymap.set(
"n", "n",
"<leader>ca", "gr",
vim.lsp.buf.code_action, vim.lsp.buf.references,
{ desc = "Code actions", buffer = ev.buf } { desc = "Go to references", buffer = ev.buf }
) )
end
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, { desc = "Rename", buffer = ev.buf })
vim.api.nvim_create_autocmd({ "FileType" }, {
vim.keymap.set( callback = function()
"n", local parsers = require("nvim-treesitter.parsers")
"<leader>e",
vim.diagnostic.open_float, if parsers then
{ desc = "Display error for current line", buffer = ev.buf } vim.opt.foldmethod = "expr"
) vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
else
vim.keymap.set( vim.opt.foldmethod = "syntax"
"n", end
"<leader>ea", end,
":Telescope diagnostics bufnr=0<CR>", })
{ desc = "Display errors for current buffer", buffer = ev.buf }
) vim.api.nvim_create_autocmd("BufWritePre", {
pattern = "*.go",
vim.keymap.set("n", "K", vim.lsp.buf.hover, { desc = "Display symbol info", buffer = ev.buf }) callback = function()
end, local params = vim.lsp.util.make_range_params()
}) params.context = { only = { "source.organizeImports" } }
end, 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,
},
} }