From fcc084630ada799cff650d34056efa38c4f1f64d Mon Sep 17 00:00:00 2001 From: th3r00t Date: Sun, 14 Sep 2025 01:38:21 -0400 Subject: [PATCH] Adjusting COC --- lua/lsp.lua | 154 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 140 insertions(+), 14 deletions(-) diff --git a/lua/lsp.lua b/lua/lsp.lua index 082028a..317a086 100644 --- a/lua/lsp.lua +++ b/lua/lsp.lua @@ -1,11 +1,6 @@ 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 --- ]] + +-- Enable LSP servers with proper configuration vim.lsp.enable('lua_ls') vim.lsp.enable('gopls', { settings = { @@ -29,30 +24,161 @@ vim.lsp.enable('gopls', { }, }) vim.lsp.enable('nim_langserver') + +-- Fix: Add proper configuration for pyright/basedpyright +-- For NixOS with basedpyright: +vim.lsp.enable('basedpyright', { + settings = { + basedpyright = { + analysis = { + typeCheckingMode = "basic", + autoSearchPaths = true, + useLibraryCodeForTypes = true, + diagnosticMode = "workspace", + }, + } + } +}) + +-- Alternative: If you have regular pyright installed +-- vim.lsp.enable('pyright', { +-- settings = { +-- python = { +-- analysis = { +-- typeCheckingMode = "basic", +-- autoSearchPaths = true, +-- useLibraryCodeForTypes = true, +-- diagnosticMode = "workspace", +-- } +-- } +-- } +-- }) + +-- Alternative: Manual LSP start if vim.lsp.enable doesn't work +-- vim.api.nvim_create_autocmd('FileType', { +-- pattern = 'python', +-- callback = function() +-- -- Check if basedpyright is available first +-- if vim.fn.executable('basedpyright-langserver') == 1 then +-- vim.lsp.start({ +-- name = 'basedpyright', +-- cmd = { 'basedpyright-langserver', '--stdio' }, +-- root_dir = vim.fs.dirname( +-- vim.fs.find({ 'pyproject.toml', 'setup.py', '.git' }, { upward = true })[1] +-- ), +-- settings = { +-- basedpyright = { +-- analysis = { +-- typeCheckingMode = "basic", +-- autoSearchPaths = true, +-- useLibraryCodeForTypes = true, +-- } +-- } +-- } +-- }) +-- elseif vim.fn.executable('pyright-langserver') == 1 then +-- vim.lsp.start({ +-- name = 'pyright', +-- cmd = { 'pyright-langserver', '--stdio' }, +-- root_dir = vim.fs.dirname( +-- vim.fs.find({ 'pyproject.toml', 'setup.py', '.git' }, { upward = true })[1] +-- ), +-- settings = { +-- python = { +-- analysis = { +-- typeCheckingMode = "basic", +-- autoSearchPaths = true, +-- useLibraryCodeForTypes = true, +-- } +-- } +-- } +-- }) +-- else +-- print("Neither basedpyright-langserver nor pyright-langserver found") +-- end +-- end, +-- }) + require("lsp_signature").setup({ debug = false, - bind = true, -- registers signature handler + bind = true, 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 = true, 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 + extra_trigger_chars = { "(", "," }, zindex = 200, padding = "", timer_interval = 200, }) + + +-- 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, +-- }, +-- }, +-- }, +-- }) +-- vim.lsp.enable('nim_langserver') +-- 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, +-- })