From 7648c06f0719ff50e2d05a93d4a4fdea76399319 Mon Sep 17 00:00:00 2001 From: MasterGordon Date: Tue, 10 Sep 2024 21:28:02 +0200 Subject: [PATCH] updated ocaml and c# --- lazy-lock.json | 1 + lua/basics.lua | 13 +++ lua/plugins.lua | 3 +- lua/plugins/formatter.lua | 41 ++++++-- lua/plugins/lsp.lua | 208 ++++++++++++++++++-------------------- 5 files changed, 146 insertions(+), 120 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 8dec556..f4e116a 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -54,6 +54,7 @@ "popui.nvim": { "branch": "master", "commit": "4d903e46fdb5eef25fa79ef1b598f5340a2674b0" }, "popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" }, "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, + "roslyn.nvim": { "branch": "main", "commit": "e284f0e6c34b01cd1db9fdb71c75ae85d732a43b" }, "statuscol.nvim": { "branch": "main", "commit": "93d8bcda516fc86e11c03f9ef577bae9a72fba0e" }, "supermaven-nvim": { "branch": "main", "commit": "d71257f431e190d9236d7f30da4c2d659389e91f" }, "tailwind-tools.nvim": { "branch": "master", "commit": "48523580c6af449a7a57610ce5596c716cf4363a" }, diff --git a/lua/basics.lua b/lua/basics.lua index 41a5917..18f8cc9 100644 --- a/lua/basics.lua +++ b/lua/basics.lua @@ -28,3 +28,16 @@ set.signcolumn = "auto:2" -- set leader vim.g.mapleader = " " + +vim.filetype.add( + { + extension = { + zsh = "sh", + sh = "sh" + }, + filename = { + [".zshrc"] = "sh", + [".zshenv"] = "sh" + } + } +) diff --git a/lua/plugins.lua b/lua/plugins.lua index 5b84d98..70fa652 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -80,7 +80,8 @@ require("lazy").setup( "williamboman/mason.nvim", "williamboman/mason-lspconfig.nvim", "neovim/nvim-lspconfig", - "jay-babu/mason-null-ls.nvim" + "jay-babu/mason-null-ls.nvim", + "seblj/roslyn.nvim" } }, { diff --git a/lua/plugins/formatter.lua b/lua/plugins/formatter.lua index ec12171..5b0cd1f 100644 --- a/lua/plugins/formatter.lua +++ b/lua/plugins/formatter.lua @@ -63,16 +63,35 @@ require("formatter").setup( stdin = true } end + }, + xml = { + function() + return { + exe = "xmllint", + args = {"--format", "-"}, + stdin = true + } + end + }, + cs = { + function() + return { + exe = "dotnet-csharpier", + args = {"--write-stdout"}, + stdin = true + } + end + }, + -- ocaml + ocaml = { + function() + return { + exe = "ocamlformat", + args = {"--name", vim.api.nvim_buf_get_name(0), "-"}, + stdin = true + } + end } - -- cs = { - -- function() - -- return { - -- exe = "dotnet", - -- args = {"csharpier", "--write-stdout"}, - -- stdin = true - -- } - -- end - -- } } } ) @@ -81,7 +100,7 @@ vim.api.nvim_exec( [[ augroup FormatAutogroup autocmd! - autocmd BufWritePost *.h,*.cpp,*.rs,*.lua,*.tsx,*.ts,*.js,*.jsx,*.json,*.jsonc,*.swift FormatWrite + autocmd BufWritePost *.cs,*.h,*.cpp,*.rs,*.lua,*.tsx,*.ts,*.js,*.jsx,*.json,*.jsonc,*.swift,*.xml,*.sln,*.csproj,*.ml FormatWrite augroup END ]], true @@ -90,7 +109,7 @@ local formatGrp = vim.api.nvim_create_augroup("Format", {clear = true}) vim.api.nvim_create_autocmd( "BufWritePre", { - pattern = "*.cs,*.php", + pattern = "*.php", command = "lua vim.lsp.buf.format { async = false }", group = formatGrp } diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index e4502e6..b6c4c7d 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -26,13 +26,13 @@ local common_servers = { "lua_ls", "html", "vimls", - "yamlls" + "yamlls", + "ocamllsp" } local extra_servers = { "vtsls", "eslint", "jsonls", - "omnisharp", "rust_analyzer", "tailwindcss" } @@ -199,115 +199,107 @@ nvim_lsp.tailwindcss.setup { debounce_text_changes = 150 }, capabilities = capabilities, - -- on_init = function(client) - -- local path = client.workspace_folders and client.workspace_folders[1] and client.workspace_folders[1].name - -- local config_path = path .. "/.vscode/settings.json" - -- if vim.uv.fs_stat(config_path) then - -- local file = vim.fn.readfile(config_path) - -- local vscode_settings = vim.fn.json_decode(file) - -- client.config.settings = - -- vim.tbl_deep_extend( - -- "force", - -- client.config.settings, - -- { - -- tailwindCSS = { - -- rootFontSize = vscode_settings["tailwindCSS.rootFontSize"] - -- } - -- } - -- ) - -- client.notify(vim.lsp.protocol.Methods.workspace_didChangeConfiguration, {settings = client.config.settings}) - -- end - -- end, settings = tailwindcss_settings } -nvim_lsp.omnisharp.setup { - cmd = {"OmniSharp"}, - enable_editorconfig_support = true, - enable_roslyn_analyzers = true, - enable_import_completion = true, - on_attach = function(client, bufnr) - 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 - } - on_attach(client, bufnr) - end, - flags = { - debounce_text_changes = 150 - }, - capabilities = capabilities -} +require("roslyn").setup( + { + config = {}, + exe = { + "dotnet", + vim.fs.joinpath(vim.fn.stdpath("data"), "roslyn", "Microsoft.CodeAnalysis.LanguageServer.dll") + }, + filewatching = true + } +) + +-- nvim_lsp.omnisharp.setup { +-- cmd = {"OmniSharp"}, +-- enable_editorconfig_support = true, +-- enable_roslyn_analyzers = true, +-- enable_import_completion = true, +-- on_attach = function(client, bufnr) +-- 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 +-- } +-- on_attach(client, bufnr) +-- end, +-- flags = { +-- debounce_text_changes = 150 +-- }, +-- capabilities = capabilities +-- } nvim_lsp.rust_analyzer.setup { on_attach = on_attach,