kortina / vscode-markdown-notes

Install from: https://ark.dance/md-notes
GNU General Public License v3.0
421 stars 64 forks source link

Use CodeAction API to highlight broken references and suggest fixes #127

Open kortina opened 3 years ago

kortina commented 3 years ago

If you reference an existing note, such as [[test.md]] in a markdown file, and then update the name of that note on the filesystem, eg, mv test.md test-note.md, you'll end up with a broken reference.

The CodeAction API provides a way to denote issues like this and provide quickfix sugestions:

https://code.visualstudio.com/api/references/vscode-api#CodeAction

The Code Spell Checker extension uses this API to denote misspelled words with a blue squiggle underline and provide suggested fixes:

image

image

feature idea

It would be cool if Markdown Notes:

  1. Underlined [[broken-wiki-links.md]] with a blue squiggle
  2. Provided suggestions using some algo (eg, longest common subsequence) to fix the broken links
kortina commented 3 years ago

cc @thomaskoppelaar what do you think of this idea?

thomaskoppelaar commented 3 years ago

This would be incredible to have! It's something I've seen requested in the foam community a lot as well. I believe vscode-memo has this feature already, that might be worth checking out.

Potential issues/ edge cases: as [[file.md]] and [[File | description]] both point to the same file, it might be challenging replacing old filenames with new ones using the same style. I'm certain keeping file extensions and descriptions won't be too complicated, but adhering to the same style of using dashes or spaces, or capitalizing words might be more difficult.