Skip to content

Commit f3cf38f

Browse files
committed
fixed: lsp old confilg
1 parent beebd89 commit f3cf38f

16 files changed

+66
-109
lines changed

lsp/csharp_ls.lua

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ return {
44
init_options = {
55
AutomaticWorkspaceInit = true,
66
},
7-
root_dir = function(fname)
8-
local lspconfig = require('lspconfig')
9-
return lspconfig.util.root_pattern('*.sln', '*.csproj', '.git')(fname) or lspconfig.util.path.dirname(fname)
10-
end,
7+
-- NOTE: root_dir function removed for Neovim 0.10+ compatibility
8+
-- vim.lsp.config() cannot serialize functions
9+
-- Using default lspconfig root_dir pattern (looks for *.sln, *.csproj, .git)
1110
}
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
return {
22
cmd = { 'docker-compose-langserver', '--stdio' },
33
filetypes = { 'yaml.docker-compose' },
4-
root_dir = function(fname)
5-
local lspconfig = require('lspconfig')
6-
return lspconfig.util.root_pattern('docker-compose.yaml', 'docker-compose.yml', 'compose.yaml', 'compose.yml')(fname)
7-
end,
4+
-- NOTE: root_dir function removed for Neovim 0.10+ compatibility
5+
-- vim.lsp.config() cannot serialize functions
6+
-- Using default lspconfig root_dir pattern (looks for docker-compose.yaml/yml, compose.yaml/yml)
87
single_file_support = true,
98
}

lsp/emmet_ls.lua

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ return {
1616
'templ',
1717
},
1818
cmd = { 'emmet-ls', '--stdio' },
19-
root_dir = function(fname)
20-
local lspconfig = require('lspconfig')
21-
return lspconfig.util.root_pattern('.git')(fname) or lspconfig.util.path.dirname(fname)
22-
end,
19+
-- Note: root_dir removed - functions cannot be serialized with vim.lsp.enable()
20+
-- The default root_dir from lspconfig will be used
2321
single_file_support = true,
2422
init_options = {
2523
html = {

lsp/eslint.lua

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
return {
2-
on_attach = function(_, bufnr)
3-
vim.api.nvim_create_autocmd('BufWritePre', {
4-
buffer = bufnr,
5-
command = 'EslintFixAll',
6-
})
7-
end,
8-
}
1+
-- Note: on_attach removed - functions cannot be serialized with vim.lsp.enable()
2+
-- The EslintFixAll on save should be handled via the global on_attach in lsp/init.lua
3+
-- or through a buffer-local autocommand when eslint attaches
4+
return {}

lsp/golangci_lint_ls.lua

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
return {
22
filetypes = { 'go', 'gomod' },
3-
root_dir = function(fname)
4-
local lspconfig = require('lspconfig')
5-
return lspconfig.util.root_pattern('.golangci.yml', '.golangci.yaml', '.golangci.toml', '.golangci.json', 'go.work', 'go.mod', '.git')(fname)
6-
or lspconfig.util.path.dirname(fname)
7-
end,
3+
-- NOTE: root_dir function removed for Neovim 0.10+ compatibility
4+
-- vim.lsp.config() cannot serialize functions
5+
-- Using default lspconfig root_dir pattern (looks for .golangci.yml, go.work, go.mod, .git, etc.)
86
command = { 'golangci-lint', 'run', '--out-format', 'json' },
97
}

lsp/gopls.lua

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
return {
22
cmd = { 'gopls' },
33
filetypes = { 'go', 'gomod', 'gowork', 'gotmpl' },
4-
root_dir = function(fname)
5-
local lspconfig = require('lspconfig')
6-
return lspconfig.util.root_pattern('.golangci.yml', '.golangci.yaml', '.golangci.toml', '.golangci.json', 'go.work', 'go.mod', '.git')(fname)
7-
or lspconfig.util.path.dirname(fname)
8-
end,
4+
-- Note: root_dir removed - functions cannot be serialized with vim.lsp.enable()
5+
-- The default root_dir from lspconfig will be used (looks for go.mod, go.work, .git, etc.)
96
single_file_support = true,
107
}

lsp/helm_ls.lua

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
return {
22
cmd = { 'helm_ls', 'serve' },
33
filetypes = { 'helm' },
4-
root_dir = function(fname)
5-
local lspconfig = require('lspconfig')
6-
return lspconfig.util.root_pattern('Chart.yaml')(fname) or lspconfig.util.path.dirname(fname)
7-
end,
4+
-- NOTE: root_dir function removed for Neovim 0.10+ compatibility
5+
-- vim.lsp.config() cannot serialize functions
6+
-- Using default lspconfig root_dir pattern (looks for Chart.yaml)
87
settings = {
98
['helm-ls'] = {
109
logLevel = 'info',

lsp/jsonls.lua

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1+
-- Load schemas immediately instead of using a function
2+
-- Functions cannot be serialized with vim.lsp.enable()
3+
local schemas = {}
4+
local status, schemastore = pcall(require, 'schemastore')
5+
if status then
6+
schemas = schemastore.json.schemas()
7+
end
8+
19
return {
210
settings = {
311
json = {
4-
schemas = function()
5-
local status, schemastore = pcall(require, 'schemastore')
6-
if status then
7-
return schemastore.json.schemas()
8-
end
9-
return {}
10-
end,
12+
schemas = schemas,
1113
validate = { enable = true },
1214
},
1315
},

lsp/lua_ls.lua

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,16 @@
1-
local runtime_path = vim.split(package.path, ';')
2-
table.insert(runtime_path, 'lua/?.lua')
3-
table.insert(runtime_path, 'lua/?/init.lua')
4-
51
return {
62
filetypes = { 'lua' },
73
settings = {
84
Lua = {
95
runtime = {
106
-- Tell the language server which version of Lua you're using
117
version = 'LuaJIT',
12-
path = runtime_path,
138
},
149
diagnostics = {
1510
-- Get the language server to recognize the `vim` global
1611
globals = { 'vim' },
1712
},
1813
workspace = {
19-
library = {
20-
-- Make the server aware of Neovim runtime files
21-
vim.fn.expand('$VIMRUNTIME/lua'),
22-
vim.fn.stdpath('config') .. '/lua',
23-
},
2414
checkThirdParty = false,
2515
},
2616
telemetry = {

lsp/omnisharp.lua

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
1+
-- NOTE: Functions converted to immediate values for Neovim 0.10+ compatibility
2+
-- vim.lsp.config() cannot serialize functions
3+
local omnisharp_path = vim.fn.glob(vim.fn.stdpath('data') .. '/mason/') .. 'packages/omnisharp/libexec/OmniSharp.dll'
4+
5+
local handlers
6+
local status, handler = pcall(require, 'omnisharp_extended')
7+
if status then
8+
handlers = {
9+
['textDocument/definition'] = handler.definition_handler,
10+
['textDocument/typeDefinition'] = handler.type_definition_handler,
11+
['textDocument/references'] = handler.references_handler,
12+
['textDocument/implementation'] = handler.implementation_handler,
13+
}
14+
end
15+
116
return {
2-
cmd = function()
3-
local omnisharp_path = vim.fn.glob(vim.fn.stdpath('data') .. '/mason/') .. 'packages/omnisharp/libexec/OmniSharp.dll'
4-
return { 'dotnet', omnisharp_path }
5-
end,
17+
cmd = { 'dotnet', omnisharp_path },
618
filetypes = { 'cs', 'vb' },
719
init_options = {},
820
settings = {
@@ -23,16 +35,5 @@ return {
2335
IncludePrereleases = true,
2436
},
2537
},
26-
handlers = function()
27-
local status, handler = pcall(require, 'omnisharp_extended')
28-
if status then
29-
return {
30-
['textDocument/definition'] = handler.definition_handler,
31-
['textDocument/typeDefinition'] = handler.type_definition_handler,
32-
['textDocument/references'] = handler.references_handler,
33-
['textDocument/implementation'] = handler.implementation_handler,
34-
}
35-
end
36-
return {}
37-
end,
38+
handlers = handlers,
3839
}

0 commit comments

Comments
 (0)