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

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

Open
irnc opened this issue Oct 10, 2023 · 5 comments
Open

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

irnc opened this issue Oct 10, 2023 · 5 comments
Labels
bug Something isn't working
Milestone

Comments

@irnc
Copy link

irnc commented Oct 10, 2023

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
Copy link
Collaborator

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).

  • Before (and now when there is no wikilink definition section) the only definition was the one added by Foam.
  • Now VS Code adds as definition the one of the link at the bottom of the file.

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.

@riccardoferretti riccardoferretti added the bug Something isn't working label Oct 10, 2023
@riccardoferretti riccardoferretti added this to the backlog milestone Oct 10, 2023
@t2hv33
Copy link

t2hv33 commented Nov 6, 2023

@irnc
Copy link
Author

irnc commented Nov 6, 2023

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
Copy link

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

@riccardoferretti
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants