microsoft / vscode-pylint

Linting support for python using the pylint library.
https://marketplace.visualstudio.com/items?itemName=ms-python.pylint
MIT License
70 stars 34 forks source link

Pylint makes "Quick Fix" suggestions take 10s+ to load #567

Open masterbbud opened 1 month ago

masterbbud commented 1 month ago

I'm using a combination of several linters in order to analyze my Python code using VSCode, including Pylint (alongside Ruff, CodeSpellChecker, and Pylance). Pylint is notably quite slow, although I have a rather large Python codebase, so this is reasonable. The issue for me is that Pylint causes the "quick fix" suggestions (from hovering over warnings or the shortcut Ctrl + .) to take upwards of 10 seconds to load. This happens on all VSCode warnings, even the ones that are generated by Ruff/Pylance (and are not a Pylint issue). I can't seem to pinpoint anything in the logs, but here is an example of what it looks like to hover over a warned element:

(The item was hovered at 4:54:51 and quick fix suggestions showed up at 4:54:59)

2024-07-25 16:54:51.223 [info] [Trace - 4:54:51 PM] Received notification 'window/logMessage'.
2024-07-25 16:54:51.223 [info] <FILENAME> :
[]

2024-07-25 16:54:51.224 [info] [Trace - 4:54:51 PM] Received notification 'textDocument/publishDiagnostics'.
2024-07-25 16:54:51.226 [info] [Trace - 4:54:51 PM] Received notification 'textDocument/publishDiagnostics'.
2024-07-25 16:54:51.228 [info] [Trace - 4:54:51 PM] Received response 'textDocument/codeAction - (16)' in 6839ms.
2024-07-25 16:54:51.229 [info] [Trace - 4:54:51 PM] Received response 'textDocument/codeAction - (17)' in 6351ms.
2024-07-25 16:54:51.233 [info] [Trace - 4:54:51 PM] Received notification 'window/logMessage'.
2024-07-25 16:54:51.233 [info] <MY PYTHON PATH> -m pylint --reports=n --output-format=json --rcfile=<MY USER PROFILE>\.vscode\pyproject.toml --clear-cache-post-run=y --from-stdin <FILENAME>
2024-07-25 16:54:51.233 [info] [Trace - 4:54:51 PM] Received notification 'window/logMessage'.
2024-07-25 16:54:51.233 [info] CWD Linter: <WORKSPACENAME>
2024-07-25 16:54:59.164 [info] [Trace - 4:54:59 PM] Received notification 'window/logMessage'.
2024-07-25 16:54:59.164 [info] <FILENAME> :
[
    {
        "type": "error",
        "module": "<MODULE>",
        "obj": "",
        "line": 22,
        "column": 0,
        "endLine": 22,
        "endColumn": 52,
        "path": "<PATH>",
        "symbol": "import-error",
        "message": "Unable to import '<MODULENAME>'",
        "message-id": "E0401"
    },
    {
        "type": "error",
        "module": "<MODULE>",
        "obj": "",
        "line": 22,
        "column": 0,
        "endLine": 22,
        "endColumn": 52,
        "path": "<PATH>",
        "symbol": "no-name-in-module",
        "message": "No name 'test_utils' in module '<MODULENAME>'",
        "message-id": "E0611"
    }
]

2024-07-25 16:54:59.165 [info] [Trace - 4:54:59 PM] Received notification 'textDocument/publishDiagnostics'.
2024-07-25 16:54:59.167 [info] [Trace - 4:54:59 PM] Received response 'textDocument/codeAction - (18)' in 13813ms.
2024-07-25 16:54:59.498 [info] [Trace - 4:54:59 PM] Sending request 'textDocument/codeAction - (19)'.
2024-07-25 16:54:59.505 [info] [Trace - 4:54:59 PM] Received response 'textDocument/codeAction - (19)' in 8ms.

Here is my configuration used, in case it helps:

[
    {
        "cwd": "<MY WORKSPACE FOLDER>",
        "workspace": "<MY WORKSPACE>",
        "args": [
            "--rcfile=<MY USER PROFILE>\\.vscode\\pyproject.toml"
        ],
        "severity": {
            "convention": "Information",
            "error": "Error",
            "fatal": "Error",
            "refactor": "Information",
            "warning": "Warning",
            "info": "Information"
        },
        "path": [],
        "ignorePatterns": [],
        "interpreter": [
            "<MY PYTHON PATH>"
        ],
        "importStrategy": "useBundled",
        "showNotifications": "off",
        "extraPaths": [
            ".."
        ]
    }
]

I only use Pylint for a small number of rules - I would be very happy to turn off Pylint "quick fix" suggestions entirely (but not the linter warnings), if that is something that I can configure. Please let me know of the best path to take.