Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension behavior is sensitive to case of command-line arguments #332

Closed
bersbersbers opened this issue May 8, 2023 · 1 comment · Fixed by #349
Closed

Extension behavior is sensitive to case of command-line arguments #332

bersbersbers opened this issue May 8, 2023 · 1 comment · Fixed by #349
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug needs PR

Comments

@bersbersbers
Copy link

Every now and then, this extension fails to ignore my pylint settings in pyproject.toml. I have figured out that this

  • does happen when invoking code.cmd C:\code\project
  • does not happen when invoking code.cmd C:\Code\project

Here's what on my disk:

C:\>dir | findstr ode
04/25/2023  07:39 PM    <DIR>          Code

C:\Code\project>dir pyproject.toml /s /b
C:\Code\project\pyproject.toml

C:\Code\project>dir project.py /s /b
C:\Code\project\project\project.py

code.cmd C:\code\project gives:

2023-05-08 09:27:57.663 [info] Name: Pylint
2023-05-08 09:27:57.663 [info] Module: pylint
2023-05-08 09:27:57.663 [info] Python extension loading
2023-05-08 09:27:57.663 [info] Waiting for interpreter from python extension.
2023-05-08 09:27:57.663 [info] Python extension loaded
2023-05-08 09:27:57.663 [info] Server run command: c:\Users\bers\.pyenv-win-venv\envs\project_3.11\Scripts\python.exe c:\Users\bers\.vscode\extensions\ms-python.pylint-2023.4.0\bundled\tool\lsp_server.py
2023-05-08 09:27:57.663 [info] Server: Start requested.
2023-05-08 09:27:58.881 [info] CWD Server: c:\code\project
2023-05-08 09:27:58.883 [info] Settings used to run Server:
[
    {
        "cwd": "c:\\code\\project",
        "workspace": "file:///c%3A/code/project",
        "args": [],
        "severity": {
            "convention": "Information",
            "error": "Error",
            "fatal": "Error",
            "refactor": "Information",
            "warning": "Warning",
            "info": "Information"
        },
        "path": [],
        "interpreter": [
            "c:\\Users\\bers\\.pyenv-win-venv\\envs\\project_3.11\\Scripts\\python.exe"
        ],
        "importStrategy": "fromEnvironment",
        "showNotifications": "off",
        "extraPaths": []
    }
]

2023-05-08 09:27:58.884 [info] Global settings:
{
    "cwd": "C:\\Users\\bers\\AppData\\Local\\Programs\\Microsoft VS Code",
    "workspace": "C:\\Users\\bers\\AppData\\Local\\Programs\\Microsoft VS Code",
    "args": [],
    "severity": {
        "convention": "Information",
        "error": "Error",
        "fatal": "Error",
        "refactor": "Hint",
        "warning": "Warning",
        "info": "Information"
    },
    "path": [],
    "interpreter": [],
    "importStrategy": "useBundled",
    "showNotifications": "off",
    "extraPaths": []
}

2023-05-08 09:27:58.884 [info] sys.path used to run Server:
   c:\Users\bers\.vscode\extensions\ms-python.pylint-2023.4.0\bundled\tool
   C:\Users\bers\.pyenv\pyenv-win\versions\3.11.2\python311.zip
   C:\Users\bers\.pyenv\pyenv-win\versions\3.11.2\DLLs
   C:\Users\bers\.pyenv\pyenv-win\versions\3.11.2\Lib
   C:\Users\bers\.pyenv\pyenv-win\versions\3.11.2
   c:\Users\bers\.pyenv-win-venv\envs\project_3.11
   c:\Users\bers\.pyenv-win-venv\envs\project_3.11\Lib\site-packages
   c:\Users\bers\.vscode\extensions\ms-python.pylint-2023.4.0\bundled\libs
   c:\code\project
2023-05-08 09:27:58.884 [info] c:\Users\bers\.pyenv-win-venv\envs\project_3.11\Scripts\python.exe -m pylint --version
2023-05-08 09:27:58.885 [info] CWD Linter: c:\code\project
2023-05-08 09:27:59.983 [info] 
pylint 2.17.4
astroid 2.15.4
Python 3.11.2 (tags/v3.11.2:878ead1, Feb  7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)]


2023-05-08 09:27:59.983 [info] Version info for linter running for c:\code\project:
pylint 2.17.4
astroid 2.15.4
Python 3.11.2 (tags/v3.11.2:878ead1, Feb  7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)]

2023-05-08 09:27:59.984 [info] SUPPORTED pylint>=2.12.2
FOUND pylint==2.17.4

2023-05-08 09:28:01.307 [info] [Trace - 9:28:01 AM] Sending notification 'textDocument/didOpen'.
2023-05-08 09:28:01.336 [info] [Trace - 9:28:01 AM] Received notification 'window/logMessage'.
2023-05-08 09:28:01.336 [info] document = file:///c%3A/Code/project/project/project.py
2023-05-08 09:28:01.336 [info] [Trace - 9:28:01 AM] Received notification 'window/logMessage'.
2023-05-08 09:28:01.336 [info] code_workspace = c:\Code\project\project
2023-05-08 09:28:01.336 [info] [Trace - 9:28:01 AM] Received notification 'window/logMessage'.
2023-05-08 09:28:01.337 [info] VERSION_TABLE = {'c:\\code\\project': (2, 17, 4)}
2023-05-08 09:28:01.337 [info] [Trace - 9:28:01 AM] Received notification 'window/logMessage'.
2023-05-08 09:28:01.337 [info] adding extra_args: None
2023-05-08 09:28:01.337 [info] [Trace - 9:28:01 AM] Received notification 'window/logMessage'.
2023-05-08 09:28:01.337 [info] c:\Users\bers\.pyenv-win-venv\envs\project_3.11\Scripts\python.exe -m pylint --reports=n --output-format=json --from-stdin c:\Code\project\project\project.py
2023-05-08 09:28:01.338 [info] [Trace - 9:28:01 AM] Received notification 'window/logMessage'.
2023-05-08 09:28:01.338 [info] CWD Linter: c:\Code\project\project

code.cmd C:\Code\project gives:

2023-05-08 09:27:00.800 [info] Name: Pylint
2023-05-08 09:27:00.800 [info] Module: pylint
2023-05-08 09:27:00.800 [info] Python extension loading
2023-05-08 09:27:00.800 [info] Waiting for interpreter from python extension.
2023-05-08 09:27:00.800 [info] Python extension loaded
2023-05-08 09:27:00.800 [info] Server run command: c:\Users\bers\.pyenv-win-venv\envs\project_3.11\Scripts\python.exe c:\Users\bers\.vscode\extensions\ms-python.pylint-2023.4.0\bundled\tool\lsp_server.py
2023-05-08 09:27:00.800 [info] Server: Start requested.
2023-05-08 09:27:01.957 [info] CWD Server: c:\Code\project
2023-05-08 09:27:01.958 [info] Settings used to run Server:
[
    {
        "cwd": "c:\\Code\\project",
        "workspace": "file:///c%3A/Code/project",
        "args": [],
        "severity": {
            "convention": "Information",
            "error": "Error",
            "fatal": "Error",
            "refactor": "Information",
            "warning": "Warning",
            "info": "Information"
        },
        "path": [],
        "interpreter": [
            "c:\\Users\\bers\\.pyenv-win-venv\\envs\\project_3.11\\Scripts\\python.exe"
        ],
        "importStrategy": "fromEnvironment",
        "showNotifications": "off",
        "extraPaths": []
    }
]

2023-05-08 09:27:01.958 [info] Global settings:
{
    "cwd": "C:\\Users\\bers\\AppData\\Local\\Programs\\Microsoft VS Code",
    "workspace": "C:\\Users\\bers\\AppData\\Local\\Programs\\Microsoft VS Code",
    "args": [],
    "severity": {
        "convention": "Information",
        "error": "Error",
        "fatal": "Error",
        "refactor": "Hint",
        "warning": "Warning",
        "info": "Information"
    },
    "path": [],
    "interpreter": [],
    "importStrategy": "useBundled",
    "showNotifications": "off",
    "extraPaths": []
}

2023-05-08 09:27:01.958 [info] sys.path used to run Server:
   c:\Users\bers\.vscode\extensions\ms-python.pylint-2023.4.0\bundled\tool
   C:\Users\bers\.pyenv\pyenv-win\versions\3.11.2\python311.zip
   C:\Users\bers\.pyenv\pyenv-win\versions\3.11.2\DLLs
   C:\Users\bers\.pyenv\pyenv-win\versions\3.11.2\Lib
   C:\Users\bers\.pyenv\pyenv-win\versions\3.11.2
   c:\Users\bers\.pyenv-win-venv\envs\project_3.11
   c:\Users\bers\.pyenv-win-venv\envs\project_3.11\Lib\site-packages
   c:\Users\bers\.vscode\extensions\ms-python.pylint-2023.4.0\bundled\libs
   c:\Code\project
2023-05-08 09:27:01.965 [info] c:\Users\bers\.pyenv-win-venv\envs\project_3.11\Scripts\python.exe -m pylint --version
2023-05-08 09:27:01.965 [info] CWD Linter: c:\Code\project
2023-05-08 09:27:04.758 [info] 
pylint 2.17.4
astroid 2.15.4
Python 3.11.2 (tags/v3.11.2:878ead1, Feb  7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)]


2023-05-08 09:27:04.857 [info] Version info for linter running for c:\Code\project:
pylint 2.17.4
astroid 2.15.4
Python 3.11.2 (tags/v3.11.2:878ead1, Feb  7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)]

2023-05-08 09:27:04.858 [info] SUPPORTED pylint>=2.12.2
FOUND pylint==2.17.4

2023-05-08 09:27:35.499 [info] [Trace - 9:27:35 AM] Sending notification 'textDocument/didOpen'.
2023-05-08 09:27:35.678 [info] [Trace - 9:27:35 AM] Received notification 'window/logMessage'.
2023-05-08 09:27:35.678 [info] document = file:///c%3A/Code/project/project/project.py
2023-05-08 09:27:35.679 [info] [Trace - 9:27:35 AM] Received notification 'window/logMessage'.
2023-05-08 09:27:35.679 [info] code_workspace = c:\Code\project
2023-05-08 09:27:35.682 [info] [Trace - 9:27:35 AM] Received notification 'window/logMessage'.
2023-05-08 09:27:35.683 [info] VERSION_TABLE = {'c:\\Code\\project': (2, 17, 4)}
2023-05-08 09:27:36.136 [info] [Trace - 9:27:36 AM] Received notification 'window/logMessage'.
2023-05-08 09:27:36.136 [info] adding extra_args: (2, 17, 4)
2023-05-08 09:27:36.141 [info] [Trace - 9:27:36 AM] Received notification 'window/logMessage'.
2023-05-08 09:27:36.141 [info] c:\Users\bers\.pyenv-win-venv\envs\project_3.11\Scripts\python.exe -m pylint --reports=n --output-format=json --clear-cache-post-run=y --from-stdin c:\Code\project\project\project.py
2023-05-08 09:27:36.163 [info] [Trace - 9:27:36 AM] Sending request 'textDocument/codeAction - (1)'.
2023-05-08 09:27:36.169 [info] [Trace - 9:27:36 AM] Received notification 'window/logMessage'.
2023-05-08 09:27:36.169 [info] CWD Linter: c:\Code\project

Note how the second "CWD Linter" is different; code_workspace is different; and the lookup into VERSION_TABLE is different ("adding extra_args"), and so python.exe -m pylint ... is different.

I noticed similar behavior in #280 (comment), but the issue seems to go much deeper than adding or not adding "--clear-cache-post-run=y".

@github-actions github-actions bot added the triage-needed Issue is not triaged. label May 8, 2023
@karthiknadig karthiknadig added bug Issue identified by VS Code Team member as probable bug needs PR and removed triage-needed Issue is not triaged. labels May 9, 2023
@karthiknadig karthiknadig self-assigned this May 9, 2023
@karthiknadig
Copy link
Member

Thanks for the detailed analysis. I will look into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug needs PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants