foambubble / foam

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

When using workspaces, wikilink are not working #1277

Closed PeterJ504 closed 1 year ago

PeterJ504 commented 1 year ago

Describe the bug

When using workspaces, the wikilink is pointing to the incorrect directory. Instead of c:\directory\filename.md, it's pointing to c:\directory\directory\filename.md.

Small Reproducible Example

No response

Steps to Reproduce the Bug or Issue

Create test files

file1.md

   # file 1
   ## Link
   [[file 2]]
   ## Display
   ![[file 2]]

and file2.md

   # file 2
   This is file 2

Display and links both work correctly.

Create workspace and add a new folder

{
  "folders": [
    {
      "path": "."
    },
    {
      "path": "../folder2"
    }
  ],
  "settings": {}
}

Display works correctly but the link is broken.

Expected behavior

As a user, I expected the links to work the same way in a workspace,

Screenshots or Videos

screen_3

Operating System Version

Windows

Visual Studio Code Version

Version: 1.81.1

Additional context

No response

riccardoferretti commented 1 year ago

Thanks for reporting this.

As a possible workaround, can you try having the workspace file in the parent directory:

{ "folders": [ { "path": "./folder1" }, { "path": "./folder2" } ], "settings": {} }

Will look more into it when I am at my laptop

PeterJ504 commented 1 year ago

I get the same error.

riccardoferretti commented 1 year ago

When I try to reproduce your example, the issue I find is that the file is called file2.md whereas the wikilink is [[file 2]]. The name of the file and the wikilink do not match.

You should use [[file2]] Or name your file file 2.md

PeterJ504 commented 1 year ago

I apologize for screwing up the the name when I typed it into the report but the even when I change the name as you suggest, the problem still occurs. In the screenshot and the arrow that I highlighted, you can clearly see that the name is being picked up incorrectly.

Do you want to reopen this report or shall I create a new one?

riccardoferretti commented 1 year ago

Can you please attach a zip file with a small reproducible example?

PeterJ504 commented 1 year ago

test.zip Go into folder1 and open the project using the workspace file. Open file1.md and then try to click on the links to file2 and file3.

riccardoferretti commented 1 year ago

foam-1277

(just realized the recording is missing the first part, where I click on the link to [[file2]], which works as well)

PeterJ504 commented 1 year ago

It looks like your are opening the project using the folder instead of using the workspace. If you open the project using the workspace file, then you will see the problem.

  1. unzip the file into a directory.
  2. double click on the folder1.code-workspace file. This will open up the workspace in vscode. Notice in the explorer that is says Folder1 Workspace. (see attached screenshot)
  3. Then in folder 1, click on file1.md and file1 will open (see panel 2).
  4. In panel2, click on the link for file2. There you will see the error. Screenshot 2023-09-30 183125
riccardoferretti commented 1 year ago

foam-1277

PeterJ504 commented 1 year ago

At the end of your gif, you show the preview of file1. Click on one of the links in that preview and it should give you the error.

PeterJ504 commented 12 months ago

Any news on this? Shall I open a new issue?

riccardoferretti commented 12 months ago

Yes please open a new one with a reproducible example and specific steps to recreate the problem