vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Selecting word makes CTRL + Click -> "Go to Definition" stop working

Open FMorschel opened this issue 8 months ago • 3 comments

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.100.2
  • OS Version: Windows 11 Pro

Steps to Reproduce:

  1. Create a .py file with the following content:
class AA:
    pass

class B(AA):
    pass
  1. Select AA on line 4 (inside B(AA))
  2. Use CTRL + Click (F12 and context menu work normally)
  3. See that the cursor doesn't move to the declaration

If you unselect AA, the command works as expected.

I can also reproduce this in Dart, it is not a language-specific problem.

https://github.com/user-attachments/assets/1c2b5ed7-1701-4132-9bf8-f3f14bb4ec49

This example is inside the Dart SDK:

https://github.com/user-attachments/assets/19c2d69d-6383-402f-b504-da9d0124e208

The first time I noticed it and tried screen recording for this issue, the issue stopped occurring. I had a break and put my computer in Sleep/Hibernate (not Suspended) mode, and when I came back, I could reproduce this fine again. Maybe something to do with that? I have no idea.

CC @DanTup

FMorschel avatar May 20 '25 17:05 FMorschel

If you unselect AA, the command works as expected.

Can you put the curser after the AA, like AA| and try the F12 way

jrieken avatar May 22 '25 07:05 jrieken

can confirm it is a timing based issue

  1. double click word
  2. hold ctrl and left click mouse i. clicking too fast results in entire line highlighted ii. clicking too slow results in ctrl+click working iii. clicking right in-between results in a de-selection of the word and no jumping

https://github.com/user-attachments/assets/d2ab277c-3e54-48ad-bd3b-f93018b922b8

~~I can confirm that the underline (and blue highlight) doesn't work until you move the mouse~~ ~~however ctrl+click still works correctly~~

~~can you show with workbench.action.toggleScreencastMode enabled please?~~ ~~what other languages have you tried?~~ ~~both Dart and Python come from extensions~~

RedCMD avatar May 22 '25 08:05 RedCMD

If you unselect AA, the command works as expected.

Can you put the curser after the AA, like AA| and try the F12 way

Both F12 and context menu (RMB) work as expected everytime (I've not tried but I guess command pallet would work too).

The first time I found this was when using Find buttons for next/previous (it highlights all similar in file and selects the current one).

FMorschel avatar May 22 '25 09:05 FMorschel

I have the same problem. Moreover, using the F12 shortcut key doesn't work, and the "go to definition" option doesn't appear when I right - click the mouse.

Lucyyang1991 avatar Jul 27 '25 06:07 Lucyyang1991

I know why the jump is invalid. In the.vscode\settings.json file in the project folder, the "python.languageServer": "None" must be deleted, and then all interpretations and jumps will be restored.

Lucyyang1991 avatar Jul 27 '25 14:07 Lucyyang1991

I think I figured out what is causing this for me. The problem is that it has no idea if I'm using:

  1. Select + CTRL + LMB down + Move (copy selection where the LMB up happens)
  2. CTRL + Click (Go to definition)

I'm not sure how we can handle that better. Probably what @RedCMD said before about timings (thanks for looking at this) has some influence in replicating this. Maybe also consider if the cursor moved (or if it currently does, increase the minimum delta - maybe to outside the selected area).

FMorschel avatar Oct 06 '25 18:10 FMorschel