The backlinks data file used by the extension has changed what information it saves to its data file. It now also stores the backlink description text. This was required to allow the extension to update the descripion text in Obsidian after it has been edited in VSCode. On first launch of v1.2.0 the extensions data file will automatically be updated to include existing backlinks description text from the VSCode file (Note: A backup of the file is created before the update). The downside of this process is that it has to retrieve all the text up to the begining of the line, that is the only way possible as there is no way for the extension to know what else is on that line. That is the reason for making this change in the first place, so the extension will be able to know where the backlink begins. It will insert 2 more backlink separators, one at the end and one at the begining. This will mean you will need to edit the backlink text slightly. Here are some examples...
Before update...
let fileJsonObject = []; // TODO: Your description text | File: Obsidian Filename | ID: 1701935244
After update... This would cause an error in your code.
| let fileJsonObject = []; // TODO: Your description text | File: Obsidian Filename | ID: 1701935244 |
To correct this simply move the first seperator to the begining of the backlinks description text, like this.
let fileJsonObject = []; // | TODO: Your description text | File: Obsidian Filename | ID: 1701935244 |
I apologise for any inconvenience this may cause anyone. Since it is a very new extension with not a lot of downloads yet I'm hoping the impact will be minimal. This change was absolutely necessary to include any new features in the future. If this causes any major issues for you please do contact me, it does create a backup of the data file in the extensions global storage folder first so all backlinks can be restored if necessary. If you need to you can always just re-create your backlinks and then delete the old ones.
Connect to Obsidian directly from within Visual Studio Code.
Obsidian is a powerful and extensible knowledge base that works on top of your local folder of plain text files. You can get more information and download it from here
Obsidian.MD A second brain, for you, forever.
Obsidian Advanced Uri Plugin, you can find the documentation here. This is required to communicate with Obsidian from Visual Studio Code.
Note: The Default Vault, Default Note and Default Vault Path
settings are created automatically when running the commands...
Obsidian MD: Set Default Vault and Note (Global)
and for workspace settings...
Obsidian MD: Set Default Vault and Note (Workspace)
The following commands are available from the command pallette: (Windows: CTRL+Shift+P or F1) (Mac: CMD+Shift+P)
This is the command to open the menu system to communicate with Obsidian. See the The command Structure Outline for details. If this is the first time it is run, and the default vault and default note are not defined in the settings, the command Obsidian MD: Set Default Vault and Note (Global)
will be run prompting you for the default vault and default note. These are required by the extension to operate so please set them when prompted.
Sets your default vault and the default note within that vault in your global settings.json file.
Sets your default vault and the default note within that vault in your workspace settings.json file. This will override your global settings allowing you to define a specific vault and default note on a per project basis.
Backlinks are links created in your default note or daily note in Obsidian that link back to a specific line within any file in your Visual Studio Code project. When inserting a backlink you will first be prompted for a decription prefix (These can be edited in the extensions settings). You can press Esc for no prefix if you wish. Next you will be prompted for a text desription which will be used as the text for the backlink (This is required). The backlinks should be placed inside a comment so as to not cause code errors.
Link:
[NOTE: Some Description | File: Example.txt | ID: 1701328121](vscode://file/c:/programming/code/my_code/vscode/test-folder/Example.txt:1)
Button:
name NOTE: Some Description | File: Example.txt | ID: 1701325515
type link
action vscode://file/c:/programming/code/my_code/vscode/test-folder/Example.txt:1
Button with Class Defined:
name NOTE: Some Description | File: Example.txt | ID: 1701325515
type link
class buttonclassname
action vscode://file/c:/programming/code/my_code/vscode/test-folder/Example.txt:1
In the examples you are free to edit the prefix (NOTE:) and the description (Some Description).
Do Not edit the File: Example.txt
portion. That will be updated automatically if the file is renamed.
Do Not edit the ID: 1701328121
portion. This is a unique Identifier used by the extension to maintain the Backlink.
Do Not edit the File: vscode://file...
portion. This is the actual link to the Visual Studio Code files line for the Backlink. This is maintained by the extension.
Note: Link and Buttons Text Format is Identical:
NOTE: Some Description | File: obsidian-md-vsc | ID: 1701328992
(Default Note)
NOTE: Some Description | File: 2023-11-30 | ID: 1701330039
(Daily Note)
Backlink Examples from Obsidian...
Without Default Vault and Note set... (will run the command Obsidian MD: Set Default Vault and Note (Global)
)
With Default Vault and Note set... (will run the command Obsidian MD: Connect with Obsidian
(Default Hotkey - ALT+O))
Command Menu Home... To activate, run the command Obsidian MD: Connect with Obsidian
(Default Hotkey - ALT+O)
Open in Obsidian Submenu...
Daily Note Submenu...
Daily Note Prepend/Append to Header Submenu...
Note: Some menu commands will only appear under specific conditions, for example...
All the Insert selected text...
items will not be shown when no text is selected
See the Release Notes for details.