nothingislost / obsidian-dynamic-highlights

An experimental Obsidian plugin that highlights all occurrences of the word under the cursor
MIT License
132 stars 7 forks source link

With this plugin enabled, internal links don't always open #58

Open Hunter-Bobeck opened 2 years ago

Hunter-Bobeck commented 2 years ago

I determined this plugin to be the cause of the issue. I messaged about the issue here on the Obsidian Discord server: https://discord.com/channels/686053708261228577/694233507500916796/979900541796765696

nothingislost commented 2 years ago

Yeah, so this is not a great way to open an issue. Please provide replication steps using an empty vault with this plugin enabled and explain the issue seen.

I see your comments in Discord but they are not easy to follow and I can not replicate the issue you describe there, nor can I think of any reason offhand that this plugin would cause any sort of clicking issues.

wealthychef1 commented 2 years ago

Hello, I can second this issue actually and provide perhaps a clearer description To reproduce, simply enable Dynamic Highlights and click on a link. It often does not work. The fix for me is to either disable "highlight all occurrences under cursor" or set the delay to a long enough time.

2022-06-17 09 42 52 CleanShot Obsidian

Here is a test vault which reproduces the problem. All I did is create a note with a link and turn on Dynamic Highlighter.
LMK if you cannot reproduce.

reproducer.zip

wealthychef1 commented 2 years ago

Hmm, after playing some more I don't think the "fix" that I posted works reliably. I only know that turning off Dynamic Highlights completely does solve the problem. Wait ... oh hell this is intermittent. Sometimes it happens, sometimes not, but Dynamic Highlights is in there. I hope you can reproduce and perhaps give a pointer to how to deal with this.

In my much bigger vault with 7000 notes, it absolutely is necessary to disable that toggle. It might require a bigger vault to reproduce, because it feels like what is happening is that when the mouse hovers over a word, some computation is in progress that gets interrupted by the click and prevents the link from being resolved somehow. ?

Here is what the bug looks like in practice. I clicked on [[Inbox]] and it did this. You can see the cursor is where I clicked in the word. If I change the Highlight delay to 1000, this never happens. If it's at 0, then it happens frequently but not every time.

2022-06-17 10 25 32 CleanShot Obsidian

nothingislost commented 2 years ago

Thank you for the additional detail. I can now replicate this but still need to work on tracking down the cause. One thing I noticed, is that when disabling the "highlight all occurrences" settings, you must reload the app. When disabled, and restarted, this issue seems to go away. Not a solution but should be a workaround for now.

wealthychef1 commented 2 years ago

Thanks! I'm glad you have a reproducer. It would be nice to have the full feature set but the "static" highlight feature is the one I mostly use.

nothingislost commented 2 years ago

@wealthychef1 try out https://github.com/nothingislost/obsidian-dynamic-highlights/releases/tag/0.3.1 and see if that works for you now

edit: note that the 0.3.x branch will only work with the latest insider Obsidian versions 0.15.x

wealthychef1 commented 2 years ago

I'm sorry but I don't know how to just "try out" a plugin of a different version. CAn you explain how to do so and I will happily check it ou.

nothingislost commented 2 years ago

I'm sorry but I don't know how to just "try out" a plugin of a different version. CAn you explain how to do so and I will happily check it ou.

Assuming you're running the latest Obsidian insider build 0.15.x you can just go to the community plugin browser in the app and upgrade the Dynamic Highlights plugin.

wealthychef1 commented 2 years ago

thanks for that. I updated and my initial tests strongly suggest that it's working now. I'll check back again here after another day or banging on it.
One question, for the highlighting, would it be possible to expose a choice of style for that? I find the fine blue dashed lines are not "extreme" enough for my weak eyesight. Thanks and sorry for cramming that in here.

Here is what I do in the meantime, it works fine but is just less slick than if it were in the UI. :-)

/* Dynamic Highlights matching */
span.cm-matched-word {
      background-color: #ffccffaa !important;

}
span.cm-current-word {
      background-color: #ccffffaa !important;

}
wealthychef1 commented 2 years ago

I'm having some issues perhaps because I don't undesrstand the plugin. But possibly because it's broken. What I'm finding is that some words get highlighted and some don't.

https://user-images.githubusercontent.com/4825448/175400031-e8bceabd-25b5-4f8f-8090-56db3c2d67d7.mp4

nothingislost commented 2 years ago

Highlight occurrences only highlights if you have 2 or more instances of the word under the cursor in your document :) I don't seem to see multiple occurrences of the words which you say aren't working in that doc.

wealthychef1 commented 2 years ago

I guess it was an IQ test and I failed! Thanks for pointing that out...

wealthychef1 commented 2 years ago

I consider this issue resolved by the way, it continues to function as expected throughout my day's use.