tth05 / obsidian-completr

Auto-completion plugin for the obsidian editor.
MIT License
291 stars 18 forks source link

Blacklist feature #23

Open MatteCrystal opened 2 years ago

MatteCrystal commented 2 years ago

While using this plugin I noticed one flaw that becomes more apparent over time especially if you're a poor speller. If you spell a word wrong that word can become indexed. If you don't notice fix this miss-spelling as it happens then often you're stuck knowing something is misspelled somewhere in all your notes but you want to know where in order to fix the issue.

I think I have a great solution for this problem though although I could see this potentially being a hard-to-implement feature. Anyways this is what I'm thinking.

Ideas for how to blacklist:

  1. When the dropdown to choose a word appears you could a little x next to each suggestion which would allow a word to be blacklisted. Or maybe hitting a certain key combo while hovering the word in the list could add it to the blacklist. Or right-clicking the the suggested word could add it to the backlist.
  2. Right-clicking a word (the actual typed word not a suggested word) could show an, add to blacklist option, in the right-click menu. If a file is already blacklisted then this should instead change to un-blacklist. Or if that's not possible maybe make the button a toggle.
  3. Add a list of blacklisted words to plugin options (I think this might exist already but I can't remember)

Once a word is blacklisted there should be ways to easily see that it's blacklisted as well as un-blacklist it.

Ideas for how to un blacklist:

  1. right-click word and click un-blacklist
  2. When typing a word show all suggestions like normal but if there is 1 or more blacklisted words then also show a button at the very bottom of the list that says show blacklisted words. Clicking this should show all blacklisted words that match the currently typed word. Then each of these should be capable of being clicked in order to add them and or un-blacklsit them.

Hopefully, that makes sense. TLDR we need an option to add and remove words from a blacklist that is really easy and intuitive for the end-user without them needing to leave to another screen.

tth05 commented 2 years ago

I totally agree, thanks for the input. I will invest some time in the future to make this work in a decent way, but I'm not super motivated right now. In the mean time you can delete all scanned words and then re-scan your whole vault once in a while, or edit the scanned_words.txt in .obsidian/plugins/obsidian-completr.

tth05 commented 2 years ago

@MatteCrystal I added a blacklisting feature, check out the README. The only tedious thing is removing suggestions from the blacklist (by editing the file by hand). I'm not sure what would be the best way to do is. A list of the blacklist in the settings menu feels out of place, the only other option I know is your suggestion with the hint "Show blacklisted suggestions" at the bottom of the popup, but then you'd need some kind of other hotkey to remove a suggestion from the blacklist. All of that feels weird.

MatteCrystal commented 1 year ago

Time for some super delayed feedback.

So first off, atm it says hitting Shift + D will add the selected word to the blacklist. However, this doesn't seem to be working atm. I'm super late in checking this so obsidian updates may have recently broken this.

Second, yes accessing the blacklist and manually removing stuff won't be the most fun. However, at least for now since this is the preferred method. So I think having an entry at the bottom of completr settings that says open blacklist would be really nice as well as make it obvious to people who didn't read the readme that words can be blacklisted. I would also include the default blacklist file path and shortcut key here in the description.

Finally, possible solutions to a better blacklist.


The ideal solution depends greatly on how much control you have over the look of the suggestion menu and registering where a click was located. If you have full control over that stuff then I don't see why my following suggestion wouldn't work.

use this image as a reference. image

This would make adding and removing blacklisted words extremely easy and intuitive. Even people who don't read the README will likely have little trouble using the feature. If you manage to implement this feature as I described then I don't think there would much need to have a shortcut to add or remove items from the blacklist. It's not really a feature that would be used so often and at such speed that a shortcut would be necessary. (though i supposed it doesn't completely hurt to have the option for a shortcut.)

Also, if the idea of having the - and + next to every word during normal usage annoys you I have another suggestion to fix that as well. In my above picture where the first red dot is. Instead, replace that dot with a cog icon. When that icon is clicked that's when you could slide out the -, +, buttons.

tth05 commented 1 year ago

Woow! Thanks for taking your time to write this, much appreciated :)

Your proposal looks really good to me. I want to do some internal refactoring in the near future and after that I'll definitely add this.

Also, Shift+D works fine for me. Can you check if you changed the hotkey or if it collides with a different one?

MatteCrystal commented 1 year ago

ah looks like Shift + D is working I just didn't have the plugin updated.