diff --git a/init.lua b/init.lua index 88658ef3033..c6a2b67b5e1 100644 --- a/init.lua +++ b/init.lua @@ -565,48 +565,50 @@ require('lazy').setup({ -- - settings (table): Override the default settings passed when initializing the server. -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ local servers = { - -- clangd = {}, + clangd = {}, -- gopls = {}, -- pyright = {}, - -- rust_analyzer = {}, - -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs + rust_analyzer = {}, + -- ... etc. see `:help lspconfig-all` for a list of all the pre-configured lsps -- - -- Some languages (like typescript) have entire language plugins that can be useful: + -- some languages (like typescript) have entire language plugins that can be useful: -- https://github.com/pmizio/typescript-tools.nvim -- - -- But for many setups, the LSP (`tsserver`) will work just fine + -- but for many setups, the lsp (`tsserver`) will work just fine -- tsserver = {}, -- + jdtls = { cmd = { 'jdtls' } }, + omnisharp = {}, lua_ls = { -- cmd = {...}, -- filetypes = { ...}, -- capabilities = {}, settings = { - Lua = { + lua = { completion = { - callSnippet = 'Replace', + callsnippet = 'replace', }, - -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings + -- you can toggle below to ignore lua_ls's noisy `missing-fields` warnings -- diagnostics = { disable = { 'missing-fields' } }, }, }, }, } - -- Ensure the servers and tools above are installed - -- To check the current status of installed tools and/or manually install + -- ensure the servers and tools above are installed + -- to check the current status of installed tools and/or manually install -- other tools, you can run - -- :Mason + -- :mason -- - -- You can press `g?` for help in this menu. + -- you can press `g?` for help in this menu. require('mason').setup() - -- You can add other tools here that you want Mason to install - -- for you, so that they are available from within Neovim. + -- you can add other tools here that you want mason to install + -- for you, so that they are available from within neovim. local ensure_installed = vim.tbl_keys(servers or {}) vim.list_extend(ensure_installed, { - 'stylua', -- Used to format Lua code + 'stylua', -- used to format lua code }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } @@ -614,9 +616,9 @@ require('lazy').setup({ handlers = { function(server_name) local server = servers[server_name] or {} - -- This handles overriding only values explicitly passed - -- by the server configuration above. Useful when disabling - -- certain features of an LSP (for example, turning off formatting for tsserver) + -- this handles overriding only values explicitly passed + -- by the server configuration above. useful when disabling + -- certain features of an lsp (for example, turning off formatting for tsserver) server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) require('lspconfig')[server_name].setup(server) end, @@ -625,6 +627,35 @@ require('lazy').setup({ end, }, + { + 'Hoffs/omnisharp-extended-lsp.nvim', + ft = 'cs', -- Only load for C# files + config = function() + require('lspconfig').omnisharp.setup { + root_dir = require('lspconfig').util.root_pattern('*.csproj', '*.sln'), + settings = { + omnisharp = { + enableEditorConfigSupport = true, -- Enable support for editorconfig + enableMsBuildLoadProjectsOnDemand = true, -- Load projects on demand (avoids excessive loading) + enableRoslynAnalyzers = false, -- Enable Roslyn analyzers + scriptFileSupport = true, -- Enable CSX script support if not needed + loggingLevel = 'debug', -- Enable debugging logs for better diagnostics + format = { + enable = false, + }, + }, + }, + on_attach = function(_, bufnr) + vim.keymap.set('n', 'gd', require('omnisharp_extended').lsp_definition, { buffer = bufnr, desc = 'LSP: ' .. '[G]oto [D]efinition' }) + vim.keymap.set('n', 'gr', require('omnisharp_extended').lsp_references, { buffer = bufnr, desc = 'LSP: ' .. '[G]oto [R]eferences' }) + vim.keymap.set('n', 'gI', require('omnisharp_extended').lsp_implementation, { buffer = bufnr, desc = 'LSP: ' .. '[G]oto [I]implementation' }) + vim.keymap.set('n', 'D', require('omnisharp_extended').lsp_type_definition, { buffer = bufnr, desc = 'LSP: ' .. 'Type [D]efinition' }) + print 'OmniSharp is ready!' + end, + } + end, + }, + { -- Autoformat 'stevearc/conform.nvim', lazy = false, @@ -644,7 +675,10 @@ require('lazy').setup({ -- Disable "format_on_save lsp_fallback" for languages that don't -- have a well standardized coding style. You can add additional -- languages here or re-enable it for the disabled ones. - local disable_filetypes = { c = true, cpp = true } + local disable_filetypes = { --c = true, + cpp = true, + -- java = true, + } return { timeout_ms = 500, lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype], @@ -652,6 +686,7 @@ require('lazy').setup({ end, formatters_by_ft = { lua = { 'stylua' }, + c = { 'clang_format' }, -- Conform can also run multiple formatters sequentially -- python = { "isort", "black" }, -- @@ -729,7 +764,7 @@ require('lazy').setup({ -- Accept ([y]es) the completion. -- This will auto-import if your LSP supports it. -- This will expand snippets if the LSP sent a snippet. - [''] = cmp.mapping.confirm { select = true }, + [''] = cmp.mapping.confirm { select = true }, -- If you prefer more traditional completion keymaps, -- you can uncomment the following lines @@ -778,14 +813,16 @@ require('lazy').setup({ -- change the command in the config to whatever the name of that colorscheme is. -- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. - 'folke/tokyonight.nvim', + 'ntk148v/habamax.nvim', priority = 1000, -- Make sure to load this before all the other start plugins. init = function() -- Load the colorscheme here. -- Like many other themes, this one has different styles, and you could load -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' - + vim.cmd.colorscheme 'habamax' + vim.cmd 'hi Normal guibg=NONE ctermbg=NONE' + vim.cmd 'hi CursorLine term=bold cterm=bold guibg=NONE' + -- vim.cmd 'hi LineNr guibg=NONE' -- You can configure highlights by doing something like: vim.cmd.hi 'Comment gui=none' end,