ayamir / nvimdots

A well configured and structured Neovim.
BSD 3-Clause "New" or "Revised" License
2.94k stars 462 forks source link

no fidget progress for pylsp #817

Open fecet opened 1 year ago

fecet commented 1 year ago

Version confirmation

Following prerequisites

Neovim version

NVIM v0.10.0-dev-546+g3bf887f6e0

Operating system/version

Arch

Terminal name/version

alacritty

$TERM environment variable

No response

Branch info

main (Default/Latest)

Fetch Preferences

HTTPS (use_ssh = false)

Affected language servers

pylsp

How to reproduce the issue

open any python file

Actual behavior

no progress

Expected behavior

No response

Support info

Language client log: /home/rok/.local/state/nvim/lsp.log Detected filetype: python

1 client(s) attached to this buffer:

Client: pylsp (id: 1, bufnr: [1]) filetypes: python autostart: true root directory: /home/rok/Nutstore Files/codes/tlem cmd: /home/rok/.local/share/nvim/mason/bin/pylsp

Configured servers list: html, jsonls, pylsp, lua_ls, clangd, bashls Installed 󰄳 bash-language-server bashls 󰄳 clang-format 󰄳 clangd 󰄳 html-lsp html 󰄳 json-lsp jsonls 󰄳 lua-language-server lua_ls 󰄳 prettier 󰄳 python-lsp-server pylsp 󰄳 rustfmt 󰄳 shfmt 󰄳 stylua 󰄳 vint

Logs

No response

Additional information

No response

Jint-lzxy commented 1 year ago

We need more information to know what exactly happened:

First clean lsp logs:

truncate -c -s 0 ~/.local/state/nvim/lsp.log

Then add this line to the bottom of lsp.lua

vim.lsp.set_log_level(vim.log.levels.TRACE)

Send context(s) related to workDoneProgress here :)

ayamir commented 1 year ago

IMO It's not a bug. pylsp loads too fast to show fidget progress because we have disabled lots of time-cost plugins like flake8 and pyflakes etc.

fecet commented 1 year ago

Hmm that's right, I can see progress after enable other plugins. But how to distinguish whether it's because black and ruff are too fast or they don't support progress?

Jint-lzxy commented 1 year ago

Hmm that's right, I can see progress after enable other plugins. But how to distinguish whether it's because black and ruff are too fast or they don't support progress?

@fecet Check lsp.log as I mentioned above. If workDoneProgress sent by neovim receives a response, then this server indeed supports progress.

fecet commented 1 year ago

I can see strings like "window/workDoneProgress/create" if enable flake8. Otherwise, workDoneProgress only have two matches and the context are

[TRACE][2023-06-24 01:42:18] .../lua/vim/lsp.lua:1428   "LSP[pylsp]"    "initialize_params" {  capabilities = {    general = {      positionEncodings = { "utf-16" }    },    textDocument = {      callHierarchy = {        dynamicRegistration = false      },      codeAction = {        codeActionLiteralSupport = {          codeActionKind = {            valueSet = { "", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }          }        },        dataSupport = true,        dynamicRegistration = true,        isPreferredSupport = true,        resolveSupport = {          properties = { "edit" }        }      },      completion = {        completionItem = {          commitCharactersSupport = true,          deprecatedSupport = true,          documentationFormat = { "markdown", "plaintext" },          insertReplaceSupport = true,          insertTextModeSupport = {            valueSet = { 1, 2 }          },          labelDetailsSupport = true,          preselectSupport = true,          resolveSupport = {            properties = { "documentation", "detail", "additionalTextEdits" }          },          snippetSupport = true,          tagSupport = {            valueSet = { 1 }          }        },        completionItemKind = {          valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }        },        completionList = {          itemDefaults = { "commitCharacters", "editRange", "insertTextFormat", "insertTextMode", "data" }        },        contextSupport = true,        dynamicRegistration = false,        insertTextMode = 1      },      declaration = {        linkSupport = true      },      definition = {        dynamicRegistration = true,        linkSupport = true      },      documentHighlight = {        dynamicRegistration = false      },      documentSymbol = {        dynamicRegistration = false,        hierarchicalDocumentSymbolSupport = true,        symbolKind = {          valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }        }      },      formatting = {        dynamicRegistration = true      },      hover = {        contentFormat = { "markdown", "plaintext" },        dynamicRegistration = true      },      implementation = {        linkSupport = true      },      inlayHint = {        dynamicRegistration = false,        resolveSupport = {          properties = {}        }      },      publishDiagnostics = {        relatedInformation = true,        tagSupport = {          valueSet = { 1, 2 }        }      },      rangeFormatting = {        dynamicRegistration = true      },      references = {        dynamicRegistration = false      },      rename = {        dynamicRegistration = true,        prepareSupport = true      },      semanticTokens = {        augmentsSyntaxTokens = true,        dynamicRegistration = false,        formats = { "relative" },        multilineTokenSupport = false,        overlappingTokenSupport = true,        requests = {          full = {            delta = true          },          range = false        },        serverCancelSupport = false,        tokenModifiers = { "declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary" },        tokenTypes = { "namespace", "type", "class", "enum", "interface", "struct", "typeParameter", "parameter", "variable", "property", "enumMember", "event", "function", "method", "macro", "keyword", "modifier", "comment", "string", "number", "regexp", "operator", "decorator" }      },      signatureHelp = {        dynamicRegistration = false,        signatureInformation = {          activeParameterSupport = true,          documentationFormat = { "markdown", "plaintext" },          parameterInformation = {            labelOffsetSupport = true          }        }      },      synchronization = {        didSave = true,        dynamicRegistration = false,        willSave = true,        willSaveWaitUntil = true      },      typeDefinition = {        linkSupport = true      }    },    window = {      showDocument = {        support = true      },      showMessage = {        messageActionItem = {          additionalPropertiesSupport = false        }      },      workDoneProgress = true    },    workspace = {      applyEdit = true,      configuration = true,      didChangeWatchedFiles = {        dynamicRegistration = true,        relativePatternSupport = true      },      inlayHint = {        refreshSupport = true      },      semanticTokens = {        refreshSupport = true      },      symbol = {        dynamicRegistration = false,        hierarchicalWorkspaceSymbolSupport = true,        symbolKind = {          valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }        }      },      workspaceEdit = {        resourceOperations = { "rename", "create", "delete" }      },      workspaceFolders = true    }  },  clientInfo = {    name = "Neovim",    version = "0.10.0"  },  initializationOptions = vim.empty_dict(),  processId = 1672930,  rootPath = "/home/rok/Nutstore Files/codes/tlem",  rootUri = "file:///home/rok/Nutstore%20Files/codes/tlem",  trace = "off",  workspaceFolders = { {      name = "/home/rok/Nutstore Files/codes/tlem",      uri = "file:///home/rok/Nutstore%20Files/codes/tlem"    } }}

so I guss that's indicate that ruff and black doesn't support progress?

Jint-lzxy commented 1 year ago

To streamline the message:

.../lua/vim/lsp.lua:1428    "LSP[pylsp]"    "initialize_params" { ... workDoneProgress = true ... },

So ys pylsp does support progress, but b/c pylsp doesn't need too much time to complete the work, it is not reflected in the information stack owned by fidget.

so I guss that's indicate that ruff and black doesn't support progress?

Not really, this is actually b/c we have blocked messages emitted by null-ls: https://github.com/ayamir/nvimdots/blob/f1125a96acc769a21a7443ae1812dfdfe81812de/lua/modules/configs/ui/fidget.lua#L4-L6

We made this decision b/c null-ls would continuously (and uncontrollably) generate a large amount of irrelevant messages (e.g., starting document diagnosis, publishing document diagnosis, finished, etc.).

fecet commented 1 year ago

we don't use null-ls in python, ruff and black are integrated in pylsp as plugins

Jint-lzxy commented 1 year ago

we don't use null-ls in python, ruff and black are integrated in pylsp as plugins

Oh sorry about this - I forgot ruff and black have already been integrated into pylsp.. So how pylsp manages its plugins totally depends on its implementation. Plugins don't have unique client IDs that belong to them.

Jint-lzxy commented 1 year ago

@fecet is it gd to close this issue now?

fecet commented 1 year ago

https://github.com/python-lsp/python-lsp-server/issues/374