Skip to content

Ctrl+Click for jump-to-definition stops working when I use it (in some cases) #13966

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

Closed
haimat opened this issue Sep 17, 2020 · 6 comments
Closed
Assignees
Labels
area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug

Comments

@haimat
Copy link

haimat commented Sep 17, 2020

Environment data

  • VS Code version: 1.49.0
  • Extension version (available under the Extensions sidebar): 2020.8.109390
  • OS and version: Ubuntu 20.04 LTS running on WSL2 under Windows 10
  • Python version (& distribution if applicable, e.g. Anaconda): Vanialla Python 3.8.2 64 bit from Ubuntu repo
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): none
  • Value of the python.languageServer setting: Jedi

Expected behaviour

Holding Ctrl while clicking on a Python variable or function or alike the editor jumps to the definition of that object. This is working as expected in most cases within VS Code.

Actual behaviour

In some cases, at least for my project, this features stops working completely if I Ctrl+Click on to a custom class that I import in my code. My project layout is this:

I have a project root folder, which also is the ${workspaceFolder} in my VS Code workspace. Ctrl+Clicking on any imports from that folder (or its sub folders) works as expected. Then I have added another folder to the workspace, On disk that folder is not within the workspace root folder. Now, when I Ctrl+Click on to an imported class for example that lies in this additional project folder, then nothing happens, the editor does not jump to that class. Moreover, the whole Ctrl+Click functionality does not work any longer, even where it has worked before. I need to restart VS Code that to get that functionality again.

What I also noticed is that before I try to Ctrl+Click on to that "problematic" imports from that additional workspace folder, when I just mouse-hover over that class import, its docstring description is shown correctly in the tooltip window. So that class is found by the edtior and it also can be found when running the application. It's just this Ctrl+Click that leads to the problem described above.

@haimat haimat added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Sep 17, 2020
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Sep 17, 2020
@ericsnowcurrently
Copy link

@haimat, thanks for letting us know about this. Please provide the content of your settings.json and the "Python" output panel. Thanks!

@ericsnowcurrently ericsnowcurrently added the info-needed Issue requires more information from poster label Sep 17, 2020
@haimat
Copy link
Author

haimat commented Sep 18, 2020

@haimat, thanks for letting us know about this. Please provide the content of your settings.json and the "Python" output panel. Thanks!

Here is the content of the project settings:

{
    "python.linting.pylintArgs": [
        "--max-line-length=120",
        "--generate-members",
        "--disable=W0142,W0403,W0613,R0903,R0913,R0914,C0103,F0401,C0330,R0902"
    ],
    "python.linting.flake8Enabled": true,
    "python.linting.flake8Args": [
        "--max-line-length=120",
        "--ignore=E203"
    ],
    "python.formatting.provider": "black",
    "python.formatting.blackPath": "/usr/local/bin/black",
    "python.formatting.blackArgs": [
        "--line-length=120"
    ],
    "python.autoComplete.extraPaths": [
    ],
}

Here is the content of the .vscode-server settings:

{
    "python.pythonPath": "/usr/bin/python"
}

And last but not least there the content of the editor's settings:

{
    "breadcrumbs.enabled": true,
    "editor.renderControlCharacters": false,
    "editor.renderWhitespace": "none",
    "editor.formatOnSave": true,
    "editor.cursorBlinking": "smooth",
    "files.autoSave": "off",
    "workbench.colorTheme": "Darcula Theme 2.0",
    "workbench.sideBar.location": "right",
    "svn.enabled": true,
    "svn.showOutput": true,
    "files.exclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/__pycache__": true,
        "**/.DS_Store": true
    },
    "python.linting.pylintArgs": [
        "--max-line-length=120",
        "--generate-members",
        "--disable=W0142,W0403,W0613,R0903,R0913,R0914,C0103,F0401,C0330,R0902"
    ],
    "python.linting.flake8Enabled": true,
    "python.linting.flake8Args": [
        "--max-line-length=120",
        "--ignore=E203"
    ],
    "python.formatting.provider": "black",
    "python.formatting.blackPath": "/usr/local/bin/black",
    "python.formatting.blackArgs": [
        "--line-length=120"
    ],
    "remote.SSH.remotePlatform": {
        "Sinntelligence-Aerion": "linux"
    },
    "remote.SSH.showLoginTerminal": true,
    "terminal.integrated.env.linux": {
        "DISPLAY": "localhost:10.0"
    },
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "python.jediEnabled": false,
    "vsintellicode.features.python.deepLearning": "enabled",
    "vsintellicode.java.completionsEnabled": false,
    "vsintellicode.typescript.completionsEnabled": false,
    "vsintellicode.sql.completionsEnabled": false,
    "editor.mouseWheelZoom": true,
    "editor.fontSize": 15,
    "window.zoomLevel": 0,
    "markdown.preview.breaks": true,
    "python.languageServer": "Microsoft",
    "python.showStartPage": false,
    "workbench.startupEditor": "newUntitledFile",
}

And here the output of the Python output panel:

User belongs to experiment group 'ShowPlayIcon - start'
User belongs to experiment group 'ShowExtensionSurveyPrompt - control'
User belongs to experiment group 'DebugAdapterFactory - experiment'
User belongs to experiment group 'PtvsdWheels37 - experiment'
User belongs to experiment group 'UseTerminalToGetActivatedEnvVars - control'
User belongs to experiment group 'LocalZMQKernel - experiment'
User belongs to experiment group 'CollectLSRequestTiming - control'
User belongs to experiment group 'CollectNodeLSRequestTiming - experiment'
User belongs to experiment group 'EnableIPyWidgets - experiment'
User belongs to experiment group 'DeprecatePythonPath - control'
User belongs to experiment group 'RunByLine - control'
User belongs to experiment group 'CustomEditorSupport - control'
User belongs to experiment group 'pythonaa'
User belongs to experiment group 'pythonTipPromptWording'
Error 2020-09-18 10:42:06: Failed to check if file needs to be fixed [EntryNotFound (FileSystemError): Unable to read file 'vscode-remote://wsl+ubuntu/home/mfb/.config/Code/User/settings.json' (EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, open '/home/mfb/.config/Code/User/settings.json')
	at _handleError (/home/mfb/.vscode-server/bin/e790b931385d72cf5669fcefc51cdf65990efa5d/out/vs/server/remoteExtensionHostProcess.js:730:74)
	at processTicksAndRejections (internal/process/task_queues.js:94:5)
	at async v.readText (/home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:1:495755)
	at async p.doesFileNeedToBeFixed (/home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:56:953520)
	at async /home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:56:952647
	at async Promise.all (index 0)
	at async p.getFilesToBeFixed (/home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:56:952593)
	at async p.updateTestSettings (/home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:56:952220)] {
  code: 'FileNotFound',
  name: 'EntryNotFound (FileSystemError)'
}
> conda --version
> pyenv root
> python3.7 ~/.vscode-server/extensions/ms-python.python-2020.8.109390/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3.6 ~/.vscode-server/extensions/ms-python.python-2020.8.109390/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3 ~/.vscode-server/extensions/ms-python.python-2020.8.109390/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python2 ~/.vscode-server/extensions/ms-python.python-2020.8.109390/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/bin/python ~/.vscode-server/extensions/ms-python.python-2020.8.109390/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python ~/.vscode-server/extensions/ms-python.python-2020.8.109390/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> conda info --json
Python interpreter path: /usr/bin/python
> /usr/bin/python ~/.vscode-server/extensions/ms-python.python-2020.8.109390/pythonFiles/pyvsc-run-isolated.py flake8 --max-line-length=120 --ignore=E203 --format=%(row)d,%(col)d,%(code).1s,%(code)s:%(text)s /data/Projects/Poloplast/dev/pipecheck/server/app/main/util.py
cwd: /data/Projects/Poloplast/dev
> /usr/bin/python ~/.vscode-server/extensions/ms-python.python-2020.8.109390/pythonFiles/pyvsc-run-isolated.py flake8 --max-line-length=120 --ignore=E203 --format=%(row)d,%(col)d,%(code).1s,%(code)s:%(text)s /data/Projects/Poloplast/dev/pipecheck/server/app/main/util.py
cwd: /data/Projects/Poloplast/dev
> /usr/bin/python ~/.vscode-server/extensions/ms-python.python-2020.8.109390/pythonFiles/pyvsc-run-isolated.py -c "import jupyter"
> /usr/bin/python ~/.vscode-server/extensions/ms-python.python-2020.8.109390/pythonFiles/pyvsc-run-isolated.py -c "import jupyter"
> /usr/bin/python ~/.vscode-server/extensions/ms-python.python-2020.8.109390/pythonFiles/pyvsc-run-isolated.py -c "import notebook"
> /usr/bin/python ~/.vscode-server/extensions/ms-python.python-2020.8.109390/pythonFiles/pyvsc-run-isolated.py -c "import notebook"
Starting Microsoft Python language server.
##########Linting Output - flake8##########
> conda --version
> /usr/bin/python ~/.vscode-server/extensions/ms-python.python-2020.8.109390/pythonFiles/pyvsc-run-isolated.py flake8 --max-line-length=120 --ignore=E203 --format=%(row)d,%(col)d,%(code).1s,%(code)s:%(text)s /data/Projects/Poloplast/dev/pipecheck/server/app/main/mainapp.py
cwd: /data/Projects/Poloplast/dev
> /usr/bin/python ~/.vscode-server/extensions/ms-python.python-2020.8.109390/pythonFiles/pyvsc-run-isolated.py flake8 --max-line-length=120 --ignore=E203 --format=%(row)d,%(col)d,%(code).1s,%(code)s:%(text)s /data/Projects/Poloplast/dev/pipecheck/server/app/main/mainapp.py
cwd: /data/Projects/Poloplast/dev
##########Linting Output - flake8##########
457,9,F,F841:local variable 'p_ok' is assigned to but never used
458,9,F,F841:local variable 'p_notok' is assigned to but never used
469,9,F,F841:local variable 'crop_x' is assigned to but never used
470,9,F,F841:local variable 'crop_y' is assigned to but never used
471,9,F,F841:local variable 'crop_size' is assigned to but never used
508,9,F,F841:local variable 'p_ok' is assigned to but never used
509,9,F,F841:local variable 'p_notok' is assigned to but never used
Error 2020-09-18 10:48:56: Failed to check if file needs to be fixed [EntryNotFound (FileSystemError): Unable to read file 'vscode-remote://wsl+ubuntu/home/mfb/.config/Code/User/settings.json' (EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, open '/home/mfb/.config/Code/User/settings.json')
	at _handleError (/home/mfb/.vscode-server/bin/e790b931385d72cf5669fcefc51cdf65990efa5d/out/vs/server/remoteExtensionHostProcess.js:730:74)
	at runMicrotasks (<anonymous>)
	at processTicksAndRejections (internal/process/task_queues.js:94:5)
	at async v.readText (/home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:1:495755)
	at async p.doesFileNeedToBeFixed (/home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:56:953520)
	at async /home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:56:952647
	at async Promise.all (index 0)
	at async p.getFilesToBeFixed (/home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:56:952593)
	at async p.updateTestSettings (/home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:56:952220)] {
  code: 'FileNotFound',
  name: 'EntryNotFound (FileSystemError)'
}
Error 2020-09-18 10:48:56: Failed to check if file needs to be fixed [EntryNotFound (FileSystemError): Unable to read file 'vscode-remote://wsl+ubuntu/data/Development/Python/sinntelligence/.vscode/settings.json' (EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, open '/data/Development/Python/sinntelligence/.vscode/settings.json')
	at _handleError (/home/mfb/.vscode-server/bin/e790b931385d72cf5669fcefc51cdf65990efa5d/out/vs/server/remoteExtensionHostProcess.js:730:74)
	at runMicrotasks (<anonymous>)
	at processTicksAndRejections (internal/process/task_queues.js:94:5)
	at async v.readText (/home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:1:495755)
	at async p.doesFileNeedToBeFixed (/home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:56:953520)
	at async /home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:56:952647
	at async Promise.all (index 1)
	at async p.getFilesToBeFixed (/home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:56:952593)
	at async p.updateTestSettings (/home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:56:952220)] {
  code: 'FileNotFound',
  name: 'EntryNotFound (FileSystemError)'
}
Starting Microsoft Python language server.
Error 2020-09-18 10:48:56: Failed to activate a workspace, Class name = v, completed in 82ms, has a falsy return value, Arg 1: <Uri:/data/Development/Python/sinntelligence>, Return Value: undefined [Error: command 'python.analysis.restartLanguageServer' already exists
	at _.registerCommand (/home/mfb/.vscode-server/bin/e790b931385d72cf5669fcefc51cdf65990efa5d/out/vs/server/remoteExtensionHostProcess.js:698:270)
	at Object.registerCommand (/home/mfb/.vscode-server/bin/e790b931385d72cf5669fcefc51cdf65990efa5d/out/vs/server/remoteExtensionHostProcess.js:1001:119)
	at s.registerCommand (/home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:54:495185)
	at new r (/home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:54:178371)
	at Object.t.resolveInstance (/home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:47:265970)
	at /home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:47:265172
	at Array.map (<anonymous>)
	at Object.t.resolveInstance (/home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:47:265740)
	at /home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:47:265172
	at Object.t.resolve (/home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:47:265439)
	at /home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:47:256520
	at e._get (/home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:47:256286)
	at e.getTagged (/home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:47:255088)
	at e.getNamed (/home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:47:255180)
	at a.get (/home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:56:1055572)
	at C.createRefCountedServer (/home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:47:303140)
	at async C.activate (/home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:47:301001)
	at async Promise.all (index 4)
	at async v.activateWorkspace (/home/mfb/.vscode-server/extensions/ms-python.python-2020.8.109390/out/client/extension.js:47:296083)]
> /usr/bin/python ~/.vscode-server/extensions/ms-python.python-2020.8.109390/pythonFiles/pyvsc-run-isolated.py flake8 --max-line-length=120 --ignore=E203 --format=%(row)d,%(col)d,%(code).1s,%(code)s:%(text)s /data/Development/Python/sinntelligence/cameras/tiscam_wrapper.py
cwd: /data/Development/Python/sinntelligence
> /usr/bin/python ~/.vscode-server/extensions/ms-python.python-2020.8.109390/pythonFiles/pyvsc-run-isolated.py flake8 --max-line-length=120 --ignore=E203 --format=%(row)d,%(col)d,%(code).1s,%(code)s:%(text)s /data/Development/Python/sinntelligence/cameras/tiscam_wrapper.py
cwd: /data/Development/Python/sinntelligence
##########Linting Output - flake8##########

@haimat
Copy link
Author

haimat commented Sep 18, 2020

btw. I just noticed that holding Ctrl and moving the mouse cursor of the import of the additional workspace folder is enough to lead to this error. I do not even have to click on the import to get there ...

@ericsnowcurrently ericsnowcurrently changed the title Ctrl+Click stops working when I use it (in some cases) Ctrl+Click for jump-to-definition stops working when I use it (in some cases) Oct 26, 2020
@ericsnowcurrently ericsnowcurrently added area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. investigating We are looking into the cause of the issue and removed info-needed Issue requires more information from poster triage labels Oct 26, 2020
@haimat
Copy link
Author

haimat commented Nov 25, 2020

Here is an update: Using pylance as Python language server does solve this issue for me.

@ipkiss42
Copy link

This looks like a duplicate of #13441.

@karrtikr karrtikr added triage and removed investigating We are looking into the cause of the issue labels Mar 23, 2021
@karrtikr
Copy link

karrtikr commented Apr 6, 2021

Closing as we're moving to Pylance long term and it solves the issue.

@karrtikr karrtikr closed this as completed Apr 6, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

5 participants