fix: remove explicit command to make omnisharp lsp work

This commit is contained in:
Stevan Freeborn
2025-10-01 12:25:29 -05:00
parent e35705786b
commit 3bae16cf42
+3 -12
View File
@@ -81,13 +81,10 @@ return {
vim.lsp.enable("eslint")
local omnisharpCommand = vim.fn.stdpath("data") .. "/mason/bin/OmniSharp.cmd"
vim.lsp.config("omnisharp", {
handlers = {
["textDocument/definition"] = require("omnisharp_extended").handler,
},
cmd = { omnisharpCommand },
capabilities = capabilities,
settings = {
FormattingOptions = {
@@ -103,7 +100,6 @@ return {
IncludePrereleases = true,
},
},
root_markers = { '.git' },
})
vim.lsp.enable("omnisharp")
@@ -267,13 +263,10 @@ return {
vim.api.nvim_create_autocmd({ "FileType" }, {
callback = function()
-- check if treesitter has parser
if require("nvim-treesitter.parsers").has_parser() then
-- use treesitter folding
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
else
-- use alternative foldmethod
vim.opt.foldmethod = "syntax"
end
end,
@@ -284,11 +277,6 @@ return {
callback = function()
local params = vim.lsp.util.make_range_params()
params.context = { only = { "source.organizeImports" } }
-- buf_request_sync defaults to a 1000ms timeout. Depending on your
-- machine and codebase, you may want longer. Add an additional
-- argument after params if you find that you have to write the file
-- twice for changes to be saved.
-- E.g., vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, 3000)
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
@@ -310,18 +298,21 @@ return {
)
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,
})