From 92c4037565be6d7f0e54d9d94d0c21a754911f2c Mon Sep 17 00:00:00 2001 From: YI Date: Fri, 8 Dec 2023 22:26:50 +0800 Subject: [PATCH] neovim: add ominisharp and ionide config --- dot_config/nvim/lua/lsp/utils.lua | 8 ++++++++ dot_config/nvim/lua/plugins.lua | 10 ++++++++++ dot_config/nvim/lua/plugins/lspconfig.lua | 6 ++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/dot_config/nvim/lua/lsp/utils.lua b/dot_config/nvim/lua/lsp/utils.lua index 4bc5484..da2c82c 100644 --- a/dot_config/nvim/lua/lsp/utils.lua +++ b/dot_config/nvim/lua/lsp/utils.lua @@ -43,6 +43,14 @@ function M.common_on_attach(client, bufnr) bufnnoremap("ls", "Telescope lsp_document_symbols") bufnnoremap("l/", "Telescope lsp_workspace_symbols") + -- https://github.com/neovim/neovim/issues/21391 + if client.name == "omnisharp" then + client.server_capabilities.semanticTokensProvider.legend = { + tokenModifiers = { "static" }, + tokenTypes = { "comment", "excluded", "identifier", "keyword", "keyword", "number", "operator", "operator", "preprocessor", "string", "whitespace", "text", "static", "preprocessor", "punctuation", "string", "string", "class", "delegate", "enum", "interface", "module", "struct", "typeParameter", "field", "enumMember", "constant", "local", "parameter", "method", "method", "property", "event", "namespace", "label", "xml", "xml", "xml", "xml", "xml", "xml", "xml", "xml", "xml", "xml", "xml", "xml", "xml", "xml", "xml", "xml", "xml", "xml", "xml", "xml", "xml", "regexp", "regexp", "regexp", "regexp", "regexp", "regexp", "regexp", "regexp", "regexp" } + } + end + require"lsp-format".on_attach(client) end diff --git a/dot_config/nvim/lua/plugins.lua b/dot_config/nvim/lua/plugins.lua index 4a18f26..dd0dd3f 100644 --- a/dot_config/nvim/lua/plugins.lua +++ b/dot_config/nvim/lua/plugins.lua @@ -134,6 +134,16 @@ return require('packer').startup({ use {"williamboman/mason.nvim"} use {"williamboman/mason-lspconfig.nvim"} + use { + 'ionide/Ionide-vim', + config = function() + -- Don't auto setup fsautocomplte for now, we will set it up with lspconfig, + -- which will also set some useful shortcuts. + vim.g["fsharp#lsp_auto_setup"] = 0 + end + } + + -- use({'scalameta/nvim-metals', requires = { "nvim-lua/plenary.nvim" }}) use { diff --git a/dot_config/nvim/lua/plugins/lspconfig.lua b/dot_config/nvim/lua/plugins/lspconfig.lua index 2cf72f2..9c41ba0 100644 --- a/dot_config/nvim/lua/plugins/lspconfig.lua +++ b/dot_config/nvim/lua/plugins/lspconfig.lua @@ -1,13 +1,15 @@ local get_servers_to_install = function() local servers_to_install = { "clangd", "pyright", "jsonls", "dockerls", "rust_analyzer", "elixirls", - "jdtls", "zls", "gopls", "texlab", "rnix", "omnisharp" + "jdtls", "zls", "gopls", "texlab", "rnix" } return servers_to_install end local get_no_installing_servers = function() - local servers_unable_to_install = {"bashls", "hls", "tsserver", "jsonls"} + local servers_unable_to_install = { + "bashls", "hls", "tsserver", "jsonls", "omnisharp", "fsautocomplete" + } return servers_unable_to_install end