feat: Properly handle omnisharp semanticTokens
We need to massage the tokens a bit.
This commit is contained in:
parent
9364b5c328
commit
70c86fae96
@ -38,7 +38,6 @@
|
|||||||
"tree-sitter-toml"
|
"tree-sitter-toml"
|
||||||
"tree-sitter-yaml"
|
"tree-sitter-yaml"
|
||||||
"tree-sitter-json"
|
"tree-sitter-json"
|
||||||
#"tree-sitter-ini"
|
|
||||||
"tree-sitter-html"
|
"tree-sitter-html"
|
||||||
"tree-sitter-css"
|
"tree-sitter-css"
|
||||||
"tree-sitter-nix"
|
"tree-sitter-nix"
|
||||||
|
@ -64,14 +64,26 @@ local vim_pid = vim.fn.getpid()
|
|||||||
-- "FormatterOptions:EnableEditorConfigSupport=true"
|
-- "FormatterOptions:EnableEditorConfigSupport=true"
|
||||||
local omnisharp_cmd = { 'omnisharp', '--languageserver', '-v', '--hostPID', tostring(vim_pid), }
|
local omnisharp_cmd = { 'omnisharp', '--languageserver', '-v', '--hostPID', tostring(vim_pid), }
|
||||||
|
|
||||||
|
local function toSnakeCase(str)
|
||||||
|
return string.gsub(str, "%s*[- ]%s*", "_")
|
||||||
|
end
|
||||||
|
|
||||||
lspconfig.omnisharp.setup {
|
lspconfig.omnisharp.setup {
|
||||||
cmd = omnisharp_cmd,
|
cmd = omnisharp_cmd,
|
||||||
enable_roslyn_analyzers = true,
|
enable_roslyn_analyzers = true,
|
||||||
enable_editorconfig_support = true,
|
enable_editorconfig_support = true,
|
||||||
enable_import_completion = true,
|
enable_import_completion = true,
|
||||||
-- Omnisharp has issues with the semanticTokens feature. disable it for this language server.
|
-- Omnisharp has issues with the semanticTokens feature we need to massage it a bit.
|
||||||
on_attach = function(client, bufnr)
|
on_attach = function(client, bufnr)
|
||||||
client.server_capabilities.semanticTokensProvider = nil
|
-- https://github.com/OmniSharp/omnisharp-roslyn/issues/2483#issuecomment-1492605642
|
||||||
|
local tokenModifiers = client.server_capabilities.semanticTokensProvider.legend.tokenModifiers
|
||||||
|
for i, v in ipairs(tokenModifiers) do
|
||||||
|
tokenModifiers[i] = toSnakeCase(v)
|
||||||
|
end
|
||||||
|
local tokenTypes = client.server_capabilities.semanticTokensProvider.legend.tokenTypes
|
||||||
|
for i, v in ipairs(tokenTypes) do
|
||||||
|
tokenTypes[i] = toSnakeCase(v)
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
handlers = {
|
handlers = {
|
||||||
["textDocument/definition"] = require('omnisharp_extended').handler,
|
["textDocument/definition"] = require('omnisharp_extended').handler,
|
||||||
@ -187,21 +199,21 @@ require('nvim-treesitter.configs').setup {
|
|||||||
extended_mode = true,
|
extended_mode = true,
|
||||||
max_file_lines = nil,
|
max_file_lines = nil,
|
||||||
},
|
},
|
||||||
textobjects = {
|
--textobjects = {
|
||||||
select = {
|
-- select = {
|
||||||
enable = true,
|
-- enable = true,
|
||||||
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
-- lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
||||||
keymaps = {
|
-- keymaps = {
|
||||||
-- You can use the capture groups defined in textobjects.scm
|
-- -- You can use the capture groups defined in textobjects.scm
|
||||||
['aa'] = '@parameter.outer',
|
-- ['aa'] = '@parameter.outer',
|
||||||
['ia'] = '@parameter.inner',
|
-- ['ia'] = '@parameter.inner',
|
||||||
['af'] = '@function.outer',
|
-- ['af'] = '@function.outer',
|
||||||
['if'] = '@function.inner',
|
-- ['if'] = '@function.inner',
|
||||||
['ac'] = '@class.outer',
|
-- ['ac'] = '@class.outer',
|
||||||
['ic'] = '@class.inner',
|
-- ['ic'] = '@class.inner',
|
||||||
},
|
-- },
|
||||||
},
|
-- },
|
||||||
},
|
--},
|
||||||
--incremental_selection = {
|
--incremental_selection = {
|
||||||
-- enable = true,
|
-- enable = true,
|
||||||
-- keymaps = {
|
-- keymaps = {
|
||||||
|
6
nix/darwin/flake.lock
generated
6
nix/darwin/flake.lock
generated
@ -34,12 +34,12 @@
|
|||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1,
|
"lastModified": 1,
|
||||||
"narHash": "sha256-LdDXr6idLkkTeHwlq0ZA7kri4HMr124xABHowvooD/c=",
|
"narHash": "sha256-RQLwfX1ZM8lLATzqM41ZhBnB+LRK71D3Q5nyaG3c30A=",
|
||||||
"path": "/nix/store/hhwybysgssx8f4ivff8yhagm6iyqgis9-source/nix/base-system",
|
"path": "/nix/store/3yf62sm1x6h8bb01hxwln2sgi1czwcqy-source/nix/base-system",
|
||||||
"type": "path"
|
"type": "path"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"path": "/nix/store/hhwybysgssx8f4ivff8yhagm6iyqgis9-source/nix/base-system",
|
"path": "/nix/store/3yf62sm1x6h8bb01hxwln2sgi1czwcqy-source/nix/base-system",
|
||||||
"type": "path"
|
"type": "path"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user