Skip to content

Conversation

@jevakallio
Copy link
Collaborator

@jevakallio jevakallio commented Jul 25, 2020

This PR aims to fix the long standing issue where link reference definitions are not being generated for newly created files

Combined with the following changes in Markdown Links, this should make the editing experience a lot more fluid:

Changes

  • Add notes to NoteGraph when they are created
  • Trigger events from NoteGraph to notify listeners about added/updated notes
  • Update reference definitions in active editor when new note is added

Behaviour

  • New documents are indexed into the NoteGraph immediately, so linking to them from any document works immediately. Previously, you had to go to the newly created document and save it to get it to be registered.
  • When the new file is created using Cmd+Click or just Cmd+Hover, the link is added to the "source" document immediately.
  • When the new file is created using "Go to definition" (F12), the link is only added the next time you go back to the "source" document and save it.
    • This is because VS Code does not allow changing the content in non-active editors, so when the new file is generated and the editor is switched immediately
    • To fix this, we'd need to be able to capture the RevealDefinition action before it happens and pre-emptively create the reference before the file exists. The action is defined in Markdown Notes extension, which is out of scope for this PR
    • Another alternative would be to run the new Janitor command (WIP Implement janitor command to extension #155), but there's still a few kinks to be ironed out
    • For the time being, you can work around using the Cmd+Hover trick before navigating to the file

Demo

new-dcs

@jevakallio jevakallio requested review from jojanaho and jsjoeio July 25, 2020 10:29
Copy link
Contributor

@jsjoeio jsjoeio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Super readable. Nice work @jevakallio ! 🌮

@jevakallio jevakallio merged commit a3ab4f5 into master Jul 25, 2020
@jevakallio jevakallio deleted the feature/update-notegraph-when-new-notes-are-created branch July 25, 2020 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants