From b9ad9eac83d9fd370e86517f6467d328c568ec8f Mon Sep 17 00:00:00 2001 From: Jeremy Wall Date: Tue, 9 Jan 2024 12:24:39 -0500 Subject: [PATCH] Readd omnisharp and disable roslyn It isnt quite ready for prime time yet. diagnostics arent getting handled. --- nix/base-system/flake.nix | 1 + nix/base-system/init.lua | 70 +++++++++++++++++++-------------------- nix/darwin/flake.lock | 6 ++-- 3 files changed, 39 insertions(+), 38 deletions(-) diff --git a/nix/base-system/flake.nix b/nix/base-system/flake.nix index 422734f..1a69a15 100644 --- a/nix/base-system/flake.nix +++ b/nix/base-system/flake.nix @@ -165,6 +165,7 @@ EOF"; nil-pkg lua-language-server rust-analyzer + omnisharp-roslyn ]); }; }; diff --git a/nix/base-system/init.lua b/nix/base-system/init.lua index 4b0bff5..54d959f 100644 --- a/nix/base-system/init.lua +++ b/nix/base-system/init.lua @@ -138,45 +138,45 @@ lspconfig.nil_ls.setup { capabilities = caps, } -require('roslyn').setup({ - on_attach = function (client, _) - --vim.notify(vim.inspect(client)) - end, - capabilities = caps, - log_level = "Trace", -}); +--require('roslyn').setup({ +-- on_attach = function (client, _) +-- --vim.notify(vim.inspect(client)) +-- end, +-- capabilities = caps, +-- log_level = "Trace", +--}); local vim_pid = vim.fn.getpid() -- "FormatterOptions:EnableEditorConfigSupport=true" ---local omnisharp_cmd = { 'omnisharp', '--languageserver', '-v', '--hostPID', tostring(vim_pid), } --- ---local function toSnakeCase(str) --- return string.gsub(str, "%s*[- ]%s*", "_") ---end --- ---lspconfig.omnisharp.setup { --- cmd = omnisharp_cmd, --- enable_roslyn_analyzers = true, --- enable_editorconfig_support = true, --- enable_import_completion = true, --- -- Omnisharp has issues with the semanticTokens feature we need to massage it a bit. --- on_attach = function(client, bufnr) --- -- 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, --- handlers = { --- ["textDocument/definition"] = require('omnisharp_extended').handler, --- }, --- capabilities = caps, ---} +local omnisharp_cmd = { 'omnisharp', '--languageserver', '-v', '--hostPID', tostring(vim_pid), } + +local function toSnakeCase(str) + return string.gsub(str, "%s*[- ]%s*", "_") +end + +lspconfig.omnisharp.setup { + cmd = omnisharp_cmd, + enable_roslyn_analyzers = true, + enable_editorconfig_support = true, + enable_import_completion = true, + -- Omnisharp has issues with the semanticTokens feature we need to massage it a bit. + on_attach = function(client, bufnr) + -- 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, + handlers = { + ["textDocument/definition"] = require('omnisharp_extended').handler, + }, + capabilities = caps, +} --ocaml lspconfig.ocamllsp.setup { diff --git a/nix/darwin/flake.lock b/nix/darwin/flake.lock index b6925c3..0638e49 100644 --- a/nix/darwin/flake.lock +++ b/nix/darwin/flake.lock @@ -37,12 +37,12 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-LPZptn4TgP1Rk6u1FQauqeRdswDP5VxmhlE8AfFVRFE=", - "path": "/nix/store/89vbp2wn5hvs421h8c220jazqfcrbwf0-source/nix/base-system", + "narHash": "sha256-VDkul+Z32T3/AhU5fY7Wtaf7n6U3WOPFG63Z7lL2WjQ=", + "path": "/nix/store/ljim4cw8ldrl6azj7kwmy2fa0vgnhgm6-source/nix/base-system", "type": "path" }, "original": { - "path": "/nix/store/89vbp2wn5hvs421h8c220jazqfcrbwf0-source/nix/base-system", + "path": "/nix/store/ljim4cw8ldrl6azj7kwmy2fa0vgnhgm6-source/nix/base-system", "type": "path" } },