From fb7538c2f9b817d59796b7866871b312585fa2d7 Mon Sep 17 00:00:00 2001 From: Maciej Lebiest Date: Sun, 28 Jul 2024 16:30:16 +0200 Subject: [PATCH] python lsp servers small reorganization --- Containerfile | 3 +- README.md | 4 -- lua/lazy-load.lua | 4 +- lua/plugins/nvim-lspconfig.lua | 39 +++++++++------- lua/plugins/trouble.lua | 83 ++++++++++++---------------------- 5 files changed, 58 insertions(+), 75 deletions(-) diff --git a/Containerfile b/Containerfile index c26bc50..7d18f41 100644 --- a/Containerfile +++ b/Containerfile @@ -39,8 +39,9 @@ ENV MASON_PKGS=" \ marksman \ phpcs \ phpstan \ - pyright \ python-lsp-server \ + jedi-language-server \ + ruff \ sqlls \ typescript-language-server \ yaml-language-server \ diff --git a/README.md b/README.md index 19a97ec..ac43591 100644 --- a/README.md +++ b/README.md @@ -448,10 +448,6 @@ Rename |----|----| |\vt| switch display of virtual text| |\xx| Open diagnostics window| -|\xw |workspace diagnostics| -|\xd |document diagnostics| -|\xl| loclist| -|\xq |quickfix| |gR | lsp references | #### Sessions diff --git a/lua/lazy-load.lua b/lua/lazy-load.lua index c0119a1..0817f27 100644 --- a/lua/lazy-load.lua +++ b/lua/lazy-load.lua @@ -65,7 +65,9 @@ require("lazy").setup({ }, { 'folke/trouble.nvim', - opts = require('plugins.trouble').config, + opts = {}, + cmd = "Trouble", + --opts = require('plugins.trouble').config, keys = require("plugins.trouble").keys }, diff --git a/lua/plugins/nvim-lspconfig.lua b/lua/plugins/nvim-lspconfig.lua index 4872d6e..5134df4 100644 --- a/lua/plugins/nvim-lspconfig.lua +++ b/lua/plugins/nvim-lspconfig.lua @@ -47,13 +47,13 @@ return { , settings = { pylsp = { plugins = { - rope_autoimport = { enabled = false, memory = false }, - rope_completion = { enabled = true, eager = false }, + rope_autoimport = { enabled = true, memory = true }, + rope_completion = { enabled = false, eager = false }, rope = { ropeFolder = nil }, jedi_completion = { - enabled = true, + enabled = false, include_params = true, include_class_objects = true, include_function_objects = true, @@ -61,13 +61,16 @@ return { eager = true, }, - black = { - enabled = true + jedi_definition = { + enabled = false, }, - jedi_hover = { enabled = true }, - jedi_references = { enabled = true }, - jedi_signature_help = { enabled = true }, - jedi_symbols = { enabled = true }, + mccabe = { + enabled = false + }, + jedi_hover = { enabled = false }, + jedi_references = { enabled = false }, + jedi_signature_help = { enabled = false }, + jedi_symbols = { enabled = false }, ruff = { enabled = false }, flake8 = { enabled = false -- ruff_lsp @@ -88,10 +91,10 @@ return { autopep8 = { enabled = false }, - pyflakes = { enabled = true }, -- ruff_lsp + pyflakes = { enabled = false }, -- ruff_lsp pycodestyle = { enabled = false }, -- ruff_lsp pydocstyle = { - enabled = true, + enabled = false, ignore = { 'D100', -- disable missing module docstring info 'D101', -- disable missing public class doc @@ -106,14 +109,18 @@ return { } } } - --require 'lspconfig'.ruff_lsp.setup { - --on_attach = on_attach, - --capabilities = capabilities, - --} - require 'lspconfig'.pyright.setup { + require 'lspconfig'.ruff.setup { on_attach = on_attach, capabilities = capabilities, } + require 'lspconfig'.jedi_language_server.setup { + on_attach = on_attach, + capabilities = capabilities, + } + --require 'lspconfig'.pyright.setup { + --on_attach = on_attach, + --capabilities = capabilities, + --} require 'lspconfig'.sourcekit.setup { on_attach = on_attach, capabilities = capabilities, diff --git a/lua/plugins/trouble.lua b/lua/plugins/trouble.lua index 7e71b75..1127782 100644 --- a/lua/plugins/trouble.lua +++ b/lua/plugins/trouble.lua @@ -1,57 +1,34 @@ return { keys = { - { "xx", "TroubleToggle" }, - { "xw", "TroubleToggle workspace_diagnostics" }, - { "xd", "TroubleToggle document_diagnostics" }, - { "xl", "TroubleToggle loclist" }, - { "xq", "TroubleToggle quickfix" }, - { "gR", "TroubleToggle lsp_references" } + { + "xx", + "Trouble diagnostics toggle", + desc = "Diagnostics (Trouble)", + }, + { + "xX", + "Trouble diagnostics toggle filter.buf=0", + desc = "Buffer Diagnostics (Trouble)", + }, + { + "cs", + "Trouble symbols toggle focus=false", + desc = "Symbols (Trouble)", + }, + { + "cl", + "Trouble lsp toggle focus=false win.position=right", + desc = "LSP Definitions / references / ... (Trouble)", + }, + { + "xL", + "Trouble loclist toggle", + desc = "Location List (Trouble)", + }, + { + "xQ", + "Trouble qflist toggle", + desc = "Quickfix List (Trouble)", + }, }, - config = { - position = "bottom", -- position of the list can be: bottom, top, left, right - height = 10, -- height of the trouble list when position is top or bottom - width = 50, -- width of the list when position is left or right - icons = true, -- use devicons for filenames - mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist" - fold_open = "", -- icon used for open folds - fold_closed = "", -- icon used for closed folds - group = true, -- group results by file - padding = true, -- add an extra new line on top of the list - action_keys = { -- key mappings for actions in the trouble list - -- map to {} to remove a mapping, for example: - -- close = {}, - close = "q", -- close the list - cancel = "", -- cancel the preview and get back to your last window / buffer / cursor - refresh = "r", -- manually refresh - jump = { "", "" }, -- jump to the diagnostic or open / close folds - open_split = { "" }, -- open buffer in new split - open_vsplit = { "" }, -- open buffer in new vsplit - open_tab = { "" }, -- open buffer in new tab - jump_close = { "o" }, -- jump to the diagnostic and close the list - toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode - toggle_preview = "P", -- toggle auto_preview - hover = "K", -- opens a small popup with the full multiline message - preview = "p", -- preview the diagnostic location - close_folds = { "zM", "zm" }, -- close all folds - open_folds = { "zR", "zr" }, -- open all folds - toggle_fold = { "zA", "za" }, -- toggle fold of current file - previous = "k", -- previous item - next = "j" -- next item - }, - indent_lines = true, -- add an indent guide below the fold icons - auto_open = false, -- automatically open the list when you have diagnostics - auto_close = false, -- automatically close the list when you have no diagnostics - auto_preview = true, -- automatically preview the location of the diagnostic. to close preview and go back to last window - auto_fold = false, -- automatically fold a file trouble list at creation - auto_jump = { "lsp_definitions" }, -- for the given modes, automatically jump if there is only a single result - signs = { - -- icons / text used for a diagnostic - error = "", - warning = "", - hint = "", - information = "", - other = "﫠" - }, - use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client - } }