75 lines
1.9 KiB
Lua
75 lines
1.9 KiB
Lua
local vim = vim
|
||
-- vim.cmd [[
|
||
-- augroup LspCompletion
|
||
-- autocmd!
|
||
-- autocmd InsertEnter * setlocal omnifunc=v:lua.vim.lsp.omnifunc
|
||
-- autocmd TextChangedI * if pumvisible() == 0 | silent! lua vim.fn.complete(vim.fn.col('.'), vim.fn["vim.lsp.omnifunc"]()) | endif
|
||
-- augroup END
|
||
-- ]]
|
||
vim.lsp.enable('lua_ls')
|
||
vim.lsp.enable('gopls', {
|
||
settings = {
|
||
gopls = {
|
||
analyses = {
|
||
unusedparams = true,
|
||
unusedwrite = true,
|
||
shadow = true,
|
||
},
|
||
staticcheck = true,
|
||
usePlaceholders = true,
|
||
hints = {
|
||
assignVariableTypes = true,
|
||
compositeLiteralFields = true,
|
||
compositeLiteralTypes = true,
|
||
functionTypeParameters = true,
|
||
parameterNames = true,
|
||
rangeVariableTypes = true,
|
||
},
|
||
},
|
||
},
|
||
})
|
||
-- Configure nimlangserver
|
||
local lspconfig = require('lspconfig')
|
||
lspconfig.nim_langserver.setup({
|
||
cmd = { "nimlangserver" },
|
||
filetypes = { "nim" },
|
||
root_dir = function(fname)
|
||
return lspconfig.util.find_git_ancestor(fname) or
|
||
lspconfig.util.find_node_modules_ancestor(fname) or
|
||
lspconfig.util.path.dirname(fname)
|
||
end,
|
||
settings = {
|
||
nim = {
|
||
nimsuggestPath = "nimsuggest",
|
||
nimprettyPath = "nimpretty",
|
||
}
|
||
},
|
||
})
|
||
require("lsp_signature").setup({
|
||
debug = false,
|
||
bind = true, -- registers signature handler
|
||
doc_lines = 10,
|
||
max_height = 12,
|
||
max_width = function() return math.floor(vim.api.nvim_win_get_width(0) * 0.8) end,
|
||
wrap = true,
|
||
floating_window = true, -- show the popup
|
||
floating_window_above_cur_line = true,
|
||
floating_window_off_x = 1,
|
||
floating_window_off_y = 0,
|
||
|
||
-- IMPORTANT: don’t inline (you can change later if you want)
|
||
hint_enable = true,
|
||
hint_inline = function() return false end,
|
||
|
||
hint_prefix = "🐼 ",
|
||
hint_scheme = "String",
|
||
hi_parameter = "LspSignatureActiveParameter",
|
||
handler_opts = { border = "rounded" },
|
||
|
||
always_trigger = false,
|
||
extra_trigger_chars = { "(", "," }, -- good default
|
||
zindex = 200,
|
||
padding = "",
|
||
timer_interval = 200,
|
||
})
|