diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua index d7a4810..b93ede1 100644 --- a/nvim/.config/nvim/init.lua +++ b/nvim/.config/nvim/init.lua @@ -456,7 +456,86 @@ vim.keymap.set('n', 'q', vim.diagnostic.setloclist) -- LSP settings. -- This function gets run when an LSP connects to a particular buffer. -local on_attach = function(_, bufnr) +local on_attach = function(client, bufnr) + -- Omnisharp requires a workaround due to its non-conformance with the LSP spec + -- https://github.com/OmniSharp/omnisharp-roslyn/issues/2483 + if client.name == "omnisharp" or client.name == "omnisharp_mono" then + client.server_capabilities.semanticTokensProvider = { + full = vim.empty_dict(), + legend = { + tokenModifiers = { "static_symbol" }, + tokenTypes = { + "comment", + "excluded_code", + "identifier", + "keyword", + "keyword_control", + "number", + "operator", + "operator_overloaded", + "preprocessor_keyword", + "string", + "whitespace", + "text", + "static_symbol", + "preprocessor_text", + "punctuation", + "string_verbatim", + "string_escape_character", + "class_name", + "delegate_name", + "enum_name", + "interface_name", + "module_name", + "struct_name", + "type_parameter_name", + "field_name", + "enum_member_name", + "constant_name", + "local_name", + "parameter_name", + "method_name", + "extension_method_name", + "property_name", + "event_name", + "namespace_name", + "label_name", + "xml_doc_comment_attribute_name", + "xml_doc_comment_attribute_quotes", + "xml_doc_comment_attribute_value", + "xml_doc_comment_cdata_section", + "xml_doc_comment_comment", + "xml_doc_comment_delimiter", + "xml_doc_comment_entity_reference", + "xml_doc_comment_name", + "xml_doc_comment_processing_instruction", + "xml_doc_comment_text", + "xml_literal_attribute_name", + "xml_literal_attribute_quotes", + "xml_literal_attribute_value", + "xml_literal_cdata_section", + "xml_literal_comment", + "xml_literal_delimiter", + "xml_literal_embedded_expression", + "xml_literal_entity_reference", + "xml_literal_name", + "xml_literal_processing_instruction", + "xml_literal_text", + "regex_comment", + "regex_character_class", + "regex_anchor", + "regex_quantifier", + "regex_grouping", + "regex_alternation", + "regex_text", + "regex_self_escaped_character", + "regex_other_escape", + }, + }, + range = true, + } + end + -- NOTE: Remember that lua is a real programming language, and as such it is possible -- to define small helper and utility functions so you don't have to repeat yourself -- many times.