foambubble / foam

A personal knowledge management and sharing system for VSCode
https://foambubble.github.io/
Other
15.52k stars 667 forks source link

Go to Definition mouse gesture on wikilink doesn't open linked note #1294

Open irnc opened 1 year ago

irnc commented 1 year ago

Describe the bug

After VS Code upgrade to 1.83.0 behaviour of Go to Definition mouse gesture (cmd+click or option+click) on wikilinks changed.

Prior it opened linked note, now it moves focus to the link definition at Wikilink definitions section.

Issue could be reproduced when foam.edit.linkReferenceDefinitions setting is set to withExtensions, i.e. Wikilink definitions section are generated. Setting it to off and removing the Wikilink definitions restores desired behaviour, Go to Definition now opens the note file.

Small Reproducible Example

No response

Steps to Reproduce the Bug or Issue

  1. Open note file with Wikilink defintions section.
  2. Use Go to Definition mouse gesture (cmd+click or option+click) on link with a reference in Wikilink definitions section.
  3. See that focus moves to the Wikilink definitions section instead of opening the linked note file.

Expected behavior

As a user, I expect that Go to Definition mouse gesture would open the linked note, even when Wikilink definitions section are present.

Screenshots or Videos

No response

Operating System Version

macOS

Visual Studio Code Version

1.83.0

Additional context

No response

riccardoferretti commented 1 year ago

Thanks for reporting this @irnc.

What I believe is happening is that VS Code in 1.83.0 is adding a definition to the wikilink (you can see that by putting the cursor is on a wikilink and then running the Go to definition command, using the F12 key).

I am not sure why they decided to do so. One might say it's correct, as the wikilink is "defined" in that line. On the other hand when you Go to definition on a type in a typescript file, you don't got to the import statement, but to the resource that defines the type. So if anything I would have expected VS Code to navigate to the file associated to the wikilink definition.

I don't know if there is much that can be done on Foam's side. Maybe there is a way to increase the priority of our definition (cmd+click navigates to the first definition). This needs a bit of research. Might also be worth raising an issue on the VS Code project.

t2hv33 commented 1 year ago
irnc commented 1 year ago

I don't know of any configuration that would bring previous behaviour back. As Riccardo said, this needs a bit of research to investigate and resolve the issue.

For me workaround was in switching off wikilink references generation, as notes editing workflow doesn't need them. Rationale behind this decision was simple: because it is a concern of a publishing phase, it should be addressed at a later stage.

Apricot1024 commented 10 months ago

Excuse me, did you find the way to solve this problem or even temporary method? @irnc @t2hv33

riccardoferretti commented 10 months ago

The workaround I have used is to disable generating wikilink references. I haven't found a good path to actually solve the problem.