markdown-link-updater icon indicating copy to clipboard operation
markdown-link-updater copied to clipboard

path aren't updated inside files of a moved folder

Open MasterHansCoding opened this issue 1 year ago • 2 comments

Here is my structure, with the reference from file1.md to file2.md

image

I move the folder4 inside folder3 like this:

image

And as you can see the path inside the file1.md didn't actualized to "../" more.

Is it a normal behavior?

The extension is working because, if I move folder6 inside folder5, the relative path inside file1.md is updating:

image

Thus, there is a limitation: path aren't actualized inside the moved file.

MasterHansCoding avatar Mar 08 '24 15:03 MasterHansCoding

The problem is that when a folder is moved, the workspace.onDidRenameFiles() function detects a renaming on the folder and not on the files inside. Thus, in handleRenameEvent() this part doesn't get any content :

const fileContent = markdownFiles.find(
    (file) => path.posix.normalize(file.path) === pathAfter
  )?.content;

image

I am working on it 👍

MasterHansCoding avatar Jun 08 '24 08:06 MasterHansCoding

Solved ! You can get the extension (.vsix) from this waiting PR and install it on your own Visual Studio: https://github.com/mathiassoeholm/markdown-link-updater/pull/34

MasterHansCoding avatar Jun 08 '24 12:06 MasterHansCoding