From 4f9bd815466e2a47ec9237cf41df4240c2246774 Mon Sep 17 00:00:00 2001 From: Jeremy Wall Date: Thu, 20 Jul 2023 10:48:23 -0400 Subject: [PATCH] Fix omnisharp language server bits --- nix/base-system/flake.nix | 3 ++- nix/base-system/init.lua | 43 ++++++++++++++++++++++++++++++--------- nix/darwin/flake.lock | 6 +++--- 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/nix/base-system/flake.nix b/nix/base-system/flake.nix index ac56426..c742f2d 100644 --- a/nix/base-system/flake.nix +++ b/nix/base-system/flake.nix @@ -43,7 +43,7 @@ environment.variables = { EDITOR="nvim"; PAGER="less -R"; - OMNISHARP_BIN = "${pkgs.omnisharp-roslyn}/bin/run"; + OMNISHARP_BIN = "${pkgs.omnisharp-roslyn}/bin/OmniSharp"; }; environment.etc."nvim.lua" = { @@ -131,6 +131,7 @@ (tlaplus.override { adoptopenjdk-bin = jdk; }) + luajitPackages.lua-lsp jdk plantuml-c4 texlive.combined.scheme-basic diff --git a/nix/base-system/init.lua b/nix/base-system/init.lua index 6450f26..eac8da8 100644 --- a/nix/base-system/init.lua +++ b/nix/base-system/init.lua @@ -3,29 +3,41 @@ vim.opt.termguicolors = true vim.cmd.colorscheme 'duskfox' +-- turn on relative line numbers +vim.opt.relativenumber = true + --https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md -local lsconfig = require("lspconfig") +local lspconfig = require("lspconfig") -- Nix language server support -lsconfig.nil_ls.setup{} +lspconfig.nil_ls.setup{} -local vim_pid = vim.fn.pid() +local vim_pid = vim.fn.getpid() +local omnisharp_cmd = { tostring(vim.env.OMNISHARP_BIN), '--languageserver', '--hostPID', tostring(vim_pid) } -- This needs a path to the omnisharp dll provided. We depend on the OMNISHARP_BIN environment variable being set to make this work. -lsconfig.omnisharp.setup { - cmd = { - omnisharp_bin = { vim.env.OMNISHARP_BIN, '--languageserver', '--hostPID', to_string(vim_pid) }, - }, +lspconfig.omnisharp.setup { + cmd = omnisharp_cmd, + enable_roslyn_analyzers = true, + enable_editorconfig_support = true, + organize_imports_on_format = true, + -- Omnisharp has issues with the semanticTokens feature. disable it for this language server. + on_attach = function(client, bufnr) + client.server_capabilities.semanticTokensProvider = nil + end, } -- Java language server support -lsconfig.java_language_server.setup{} +lspconfig.java_language_server.setup{} -- Typescript language server support -lsconfig.tsserver.setup{} +lspconfig.tsserver.setup{} -- Rust language server support -lsconfig.rust_analyzer.setup{} +lspconfig.rust_analyzer.setup{} + +-- lua language server setup. +lspconfig.lua_ls.setup{} -- lsp configuration vim.api.nvim_create_autocmd('LspAttach', { @@ -172,6 +184,17 @@ require("nvim-tree").setup{ }, } +require('trouble').setup{ + icons = false, + signs = { + hint = "➡️", + information = "🗒️", + warning = "⚠️", + error = "🔥", + other = "?", + }, +} + vim.keymap.set("n", "", function() require("nvim-tree.api").tree.toggle() end) diff --git a/nix/darwin/flake.lock b/nix/darwin/flake.lock index f5f910b..b165a09 100644 --- a/nix/darwin/flake.lock +++ b/nix/darwin/flake.lock @@ -34,12 +34,12 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-YrrxHkALyausm0D+AM11ASh69rin9vjriAiqN/rJyEY=", - "path": "/nix/store/2nxf006c1lj38nalx661gpv1c8wc36bq-source/nix/base-system", + "narHash": "sha256-HD18bp7KhmwBmkiSS4g6MgdMbxh19lL0o7xJKGh1V7I=", + "path": "/nix/store/a063h2b1fhppg1xc39ccclmlxnalxmk5-source/nix/base-system", "type": "path" }, "original": { - "path": "/nix/store/2nxf006c1lj38nalx661gpv1c8wc36bq-source/nix/base-system", + "path": "/nix/store/a063h2b1fhppg1xc39ccclmlxnalxmk5-source/nix/base-system", "type": "path" } },