obsidian-at-symbol-linking
obsidian-at-symbol-linking copied to clipboard
[Bug] Selecting alias of the same name as the contact filename from popup list enters link to `[[contact]]` not `[[contact|contact]]`
Describe the bug
If I have a contact file named @bob and it also has aliases: [ "@bob" ], typing the characters @bo into a note shows the suggestions popup list with two @bobs listed, only one with an arrow next to it indicating that it's an alias. Selecting the alias link to @bob from this list enters [[@bob]] into the note when it should be entering [[@bob|@bob]].
If the alias was something else, e.g. "@bob2", then selecting the alias link to @bob would enter [[@bob|@bob2]]. It seems the plugin is choosing to ignore entering the alias if it's identical to the contact filename when arguably this shouldn't be happening, hence a bug report rather than a feature request. I'm picking the alias @bob after all, not the @bob note which is also listed in the popup.
So far I've been linking via wikilink syntax instead of using the @ symbol: Typing [[@bo suggests the alias @Bob and correctly enters [[@bob|@bob]].
To Reproduce Steps to reproduce the behavior:
- Create a contact named
@bob. - Give it an alias of
"@bob". - Link to bob: Type
@bo, select the@bobalias link (has an arrow next to it). - Result is
[[@bob]]not[[@bob|@bob]].
Expected behavior
[[@bob|@bob]].
Screenshots -
In case it matters, I have the "Include @ symbol" option disabled for the plugin.
Aha. This looks to be related to #14, which was fixed, but the fix was too broad it seems. If "Include @ symbol" is disabled, it shouldn't prevent an alias of the same name being entered, i.e. [[@bob|@bob]]. If "Include @ symbol" is disabled and there is no "@bob" alias, just enter [[@bob]]. If "Include @ symbol" is enabled, we'd also expect [[@bob|@bob]], even when the file doesn't specify an "@bob" alias.
Thanks.
To be clear, even if the filename is A and its alias is A (i.e. no @s involved), selecting the alias link from the popup list which @ triggers simply enters [[A]], not [[A|A]].
I think this is working now? If you use "Absolute path in vault" for the new link format, it seems to generate a markdown link in the form [[A|A]]