From c2da0102748883d9e60fa1a98a2b0658ac5cc211 Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado Date: Sun, 25 Feb 2024 01:36:28 -0600 Subject: refactor: only use ruff-lsp, tidy up lsp configs --- lua/plugins/lspconfig.lua | 25 ++++++++++++++++++++++--- lua/plugins/null-ls.lua | 5 +++-- 2 files changed, 25 insertions(+), 5 deletions(-) (limited to 'lua/plugins') diff --git a/lua/plugins/lspconfig.lua b/lua/plugins/lspconfig.lua index 3390b51..304bc5c 100644 --- a/lua/plugins/lspconfig.lua +++ b/lua/plugins/lspconfig.lua @@ -16,6 +16,14 @@ local servers = { allFeatures = true, }, }, + ruff_lsp = { + init_options = { + settings = { + -- Any extra CLI arguments for `ruff` go here. + args = {}, + } + } + }, pyright = {}, lua_ls = { Lua = { @@ -43,8 +51,7 @@ return { 'gopls', 'rust-analyzer', 'mypy', - 'ruff', - 'autopep8', + 'ruff-lsp', 'pyright', 'lua-language-server', }, @@ -142,10 +149,22 @@ return { }) end - setup_server('clangd') + -- setup_server('clangd') + lspconfig['clangd'].setup({ + capabilities = capabilities, + on_attach = on_attach, + settings = servers['clangd'], + cmd = { + 'clangd', + -- fixes: multiple different client offset_encodings detected + '--offset-encoding=utf-16', + }, + }) + setup_server('gopls') setup_server('rust_analyzer') setup_server('pyright') + setup_server('ruff_lsp') setup_server('lua_ls') -- change the gdscript cmd for wsl -> win support, need to set: -- cmd = { 'nc', '172.30.112.1', '6005' }, but the ip changes dynamically diff --git a/lua/plugins/null-ls.lua b/lua/plugins/null-ls.lua index 91f94e6..c1d77c7 100644 --- a/lua/plugins/null-ls.lua +++ b/lua/plugins/null-ls.lua @@ -9,14 +9,15 @@ return { null_ls.setup({ sources = { null_ls.builtins.formatting.clang_format, - null_ls.builtins.formatting.autopep8, + -- should use ruff-lsp + -- null_ls.builtins.formatting.autopep8, + -- null_ls.builtins.diagnostics.ruff, null_ls.builtins.diagnostics.mypy.with({ extra_args = function() local virtual = os.getenv("VIRTUAL_ENV") or os.getenv("CONDA_PREFIX") or "/usr" return { "--python-executable", virtual .. "/bin/python" } end, }), - null_ls.builtins.diagnostics.ruff, }, }) end -- cgit v1.2.3-70-g09d2