This commit is here just to shore everything up before embarking on yet another full refresh of the config. This is likely going to be the last commit and it is very important if you are using this repo to check for a hopefully newly created "NIVM" repo. (Note: this may take time, I will archive this repo when I have a working NIVM)
227 lines
5.3 KiB
Lua
227 lines
5.3 KiB
Lua
-- WARN: Here be dragons
|
|
-- This section of the config is rather long and complex please be very sure to
|
|
-- read it all before making any changes
|
|
|
|
local utilities = require("sherlock5512.utilities")
|
|
local log = require("tjdevries.log")
|
|
local required = {'mason',
|
|
'mason-lspconfig',
|
|
'lspconfig',
|
|
'cmp_nvim_lsp',
|
|
'fidget',
|
|
'neodev',
|
|
'mason-null-ls',
|
|
'mason-nvim-dap',
|
|
'dap',
|
|
'dapui'}
|
|
local modules = utilities.require_modules(required)
|
|
|
|
if not modules then
|
|
log.error("some modules could not be loaded")
|
|
return
|
|
end
|
|
|
|
local capabilities = modules['cmp_nvim_lsp'].default_capabilities()
|
|
|
|
modules['neodev'].setup()
|
|
modules["mason"].setup()
|
|
modules["mason-lspconfig"].setup {
|
|
ensure_installed = {"lua_ls"}
|
|
}
|
|
|
|
modules["mason-lspconfig"].setup_handlers {
|
|
|
|
function (server_name)
|
|
modules["lspconfig"][server_name].setup {
|
|
capabilities = capabilities
|
|
}
|
|
end,
|
|
["omnisharp"] = function ()
|
|
modules["lspconfig"]["omnisharp"].setup {
|
|
capabilities = capabilities,
|
|
on_attach = function (client,_)
|
|
client.server_capabilities.semanticTokensProvider = nil;
|
|
local gr = vim.api.nvim_create_augroup("CS-OnAttach",{})
|
|
vim.api.nvim_create_autocmd({"BufWritePre"}, {
|
|
group = gr,
|
|
pattern = {"*.cs"},
|
|
desc = "(C#) Format before write",
|
|
callback = function ()
|
|
vim.lsp.buf.format()
|
|
end
|
|
}
|
|
)
|
|
end
|
|
}
|
|
end
|
|
}
|
|
|
|
modules['mason-null-ls'].setup({
|
|
ensure_installed = {},
|
|
automatic_installation = false,
|
|
automatic_setup = true,
|
|
})
|
|
|
|
|
|
modules['fidget'].setup{
|
|
text = {
|
|
spinner = "dots"
|
|
}
|
|
}
|
|
|
|
-- Built in diagnostic settings are also configured here
|
|
|
|
vim.diagnostic.config({
|
|
virtual_text = true,
|
|
signs = true,
|
|
underline = true,
|
|
update_in_insert = true,
|
|
severity_sort = false,
|
|
})
|
|
|
|
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
|
for type, icon in pairs(signs) do
|
|
local hl = "DiagnosticSign" .. type
|
|
vim.fn.sign_define(hl, {text = icon, texthl = hl, numhl = hl})
|
|
end
|
|
|
|
local auGroupDiagHover = vim.api.nvim_create_augroup("Diagnostic_hover",{clear = true})
|
|
vim.api.nvim_create_autocmd("CursorHold",{
|
|
pattern = {"*"},
|
|
callback = function ()
|
|
vim.diagnostic.open_float(nil, {focus=false, scope="cursor"})
|
|
end,
|
|
group = auGroupDiagHover
|
|
})
|
|
|
|
-- ## DAP ## warning: here be dragons
|
|
modules['mason-nvim-dap'].setup({
|
|
automatic_setup = true,
|
|
})
|
|
|
|
|
|
modules['dapui'].setup({
|
|
icons = {
|
|
expanded = "",
|
|
collapsed = "",
|
|
current_frame = "",
|
|
},
|
|
expand_lines = vim.fn.has("nvim-0.7") == 1,
|
|
layouts = {
|
|
{
|
|
elements = {
|
|
-- Elements can be strings or table with id and size keys.
|
|
{ id = "scopes", size = 0.25 },
|
|
"breakpoints",
|
|
"stacks",
|
|
"watches",
|
|
},
|
|
size = 40, -- 40 columns
|
|
position = "left",
|
|
},
|
|
{
|
|
elements = {
|
|
"repl",
|
|
"console",
|
|
},
|
|
size = 0.25, -- 25% of total lines
|
|
position = "bottom",
|
|
},
|
|
},
|
|
controls = {
|
|
-- Requires Neovim nightly (or 0.8 when released)
|
|
enabled = true,
|
|
-- Display controls in this element
|
|
element = "repl",
|
|
icons = {
|
|
pause = "",
|
|
play = "",
|
|
step_into = "",
|
|
step_over = "",
|
|
step_out = "",
|
|
step_back = "",
|
|
run_last = "",
|
|
terminate = "",
|
|
},
|
|
},
|
|
floating = {
|
|
max_height = nil, -- These can be integers or a float between 0 and 1.
|
|
max_width = nil, -- Floats will be treated as percentage of your screen.
|
|
border = "single", -- Border style. Can be "single", "double" or "rounded"
|
|
mappings = {
|
|
close = { "q", "<Esc>" },
|
|
},
|
|
},
|
|
windows = { indent = 1 },
|
|
render = {
|
|
max_type_length = nil, -- Can be integer or nil.
|
|
max_value_lines = 100, -- Can be integer or nil.
|
|
}
|
|
})
|
|
|
|
modules['dap'].listeners.after.event_initialized["dapui_config"] = function()
|
|
modules['dapui'].open()
|
|
end
|
|
modules['dap'].listeners.before.event_terminated["dapui_config"] = function()
|
|
modules['dapui'].close()
|
|
end
|
|
modules['dap'].listeners.before.event_exited["dapui_config"] = function()
|
|
modules['dapui'].close()
|
|
end
|
|
|
|
-- Also configure lspsaga here.
|
|
-- Separate require check since we don't NEED lspsaga
|
|
local ok,lspsaga = pcall(require,"lspsaga")
|
|
if not ok then
|
|
return
|
|
end
|
|
|
|
-- do some safe config
|
|
|
|
local config = { --shared config
|
|
code_action = {
|
|
num_shortcut = true,
|
|
show_server_name = true,
|
|
extend_gitsigns = true,
|
|
},
|
|
lightbulb = {
|
|
enable = true,
|
|
enable_in_insert = false,
|
|
sign = true,
|
|
virtual_text = false,
|
|
},
|
|
hover = {
|
|
open_browser = '!$BROWSER'
|
|
}
|
|
}
|
|
if vim.fn.exists('+winbar') ~= 0 then
|
|
local add = {
|
|
symbol_in_winbar = {
|
|
in_custom = false,
|
|
enable = true,
|
|
seperator = '>',
|
|
show_file = true,
|
|
click_support = false
|
|
}
|
|
}
|
|
config = vim.tbl_deep_extend('error', config,add)
|
|
end
|
|
|
|
if vim.fn.has('nvim-0.9.0') ~= 0 then
|
|
local add = { ui = {title = true} }
|
|
config = vim.tbl_deep_extend('error', config,add )
|
|
end
|
|
lspsaga.setup(config)
|
|
|
|
-- Configure keybinds for lspsaga
|
|
local map = vim.keymap.set
|
|
map('n','<leader>ld', '<cmd>Lspsaga hover_doc<CR>' ,{desc = '[lspsaga] hoverdoc'})
|
|
map('n','<leader>la', '<cmd>Lspsaga code_action<CR>', {desc = '[lspsaga] codeaction'})
|
|
map('n','<leader>lr', '<cmd>Lspsaga rename<CR>', {desc = '[lspsaga] rename'})
|
|
map('n','<leader>lo', '<cmd>Lspsaga outline<CR>', {desc = '[lspsaga] outline'})
|
|
|
|
|
|
local wk = require('which-key')
|
|
|
|
wk.register({ l = {name = "LSP" }},{ prefix = '<leader>'})
|