harper icon indicating copy to clipboard operation
harper copied to clipboard

feat: Obsidian add to dictionary button

Open ThreeMagpiesArguingSemantics opened this issue 1 year ago • 22 comments

Very simply the words "toolchain" and "cmake" are marked red in my text, but i cannot tell Harper that these are not misspellings. I cannot find a way from obsidian to add more dictionaries or ignore words.

Obsidian has a bad but built-in spellcheck, with "add to dictionary". At the minimum, checking that list from Harper would be a nice option.

Even better if it could specify it as a technical term and even save the capitalization, since acronyms commonly ignore other grammar rules around capitalization, and i want to correct miss-capitalization of technical terms. "did you mead SD-card?"

@ThreeMagpiesArguingSemantics, although we still need to get dictionaries working properly in the Obsidian plugin. I just wrapped up work on #529, which will allow you to ignore words. Would you mind testing it once I have a release ready?

elijah-potter avatar Jan 31 '25 15:01 elijah-potter

@ThreeMagpiesArguingSemantics, we've just pushed out an update. Mind giving it a whirl?

elijah-potter avatar Jan 31 '25 20:01 elijah-potter

@ThreeMagpiesArguingSemantics, we've just pushed out an update. Mind giving it a whirl?

Oo with pleasure! Not sure I'll have much time to use obsidian until Monday, but I'll definitely try it out as soon as i get an opportunity.

We've also added the ability to add to the personal dictionary in the plugin in #683. Mind trying that out as well?

elijah-potter avatar Feb 18 '25 16:02 elijah-potter

Would it be possible to add this to the VS Code extension as well? It's really handy in cspell, and makes life really difficult to add exceptions.

tablackburn avatar Mar 18 '25 19:03 tablackburn

@tablackburn, you should be getting code actions that allow for additions to the dictionary. Would you mind misspelling a word and sending a screenshot of what actions are presented to you?

elijah-potter avatar Mar 18 '25 20:03 elijah-potter

@elijah-potter

Image

tablackburn avatar Mar 19 '25 14:03 tablackburn

@tablackburn, would you try disabling cSpell? It looks like it's overriding Harper's diagnostics.

elijah-potter avatar Mar 19 '25 14:03 elijah-potter

@elijah-potter after disabling cSpell and restarting extensions as prompted, the result is the same

Image

tablackburn avatar Mar 19 '25 17:03 tablackburn

@tablackburn, you should be getting code actions that allow for additions to the dictionary. Would you mind misspelling a word and sending a screenshot of what actions are presented to you?

Are you saying I should see an "add to dictionary" in the popup for flagged errors in VS Code? I've never seen one. Do I need to set something up to get it?

hippietrail avatar Mar 19 '25 17:03 hippietrail

@tablackburn, you should be getting code actions that allow for additions to the dictionary. Would you mind misspelling a word and sending a screenshot of what actions are presented to you?

Are you saying I should see an "add to dictionary" in the popup for flagged errors in VS Code? I've never seen one. Do I need to set something up to get it?

I don't know if that's the expected behavior, but that's what I'd like to see, particularly with different options to add to the user's dictionary or a dictionary in the current workspace/repository.

tablackburn avatar Mar 19 '25 19:03 tablackburn

Are you saying I should see an "add to dictionary" in the popup for flagged errors in VS Code? I've never seen one. Do I need to set something up to get it?

Yeah, you should be getting those. I use Neovim, so this has flown completely under my radar. @mcecode, any idea why this would be happening?

elijah-potter avatar Mar 19 '25 19:03 elijah-potter

Hi @tablackburn, I think the "PROBLEMS" tab of the VS Code panel only shows "Quick Fixes" type of code actions when you right click a problem. Going over the CSpell language server code a bit, I think they mark all of their code actions as "Quick Fixes" and that's why you also see their "add to dictionary" actions there. harper-ls, on the other hand, marks "add to dictionary" actions as "Commands" and those can be seen when you trigger code actions in the editor, like so:

Image

mcecode avatar Mar 20 '25 05:03 mcecode

Image

I can't find any way to get this "More Actions" section. I thought it might be because I mostly use Windsurf, a fork of VS Code. But I also don't see it in vanilla VS Code. Here are all the variations I can get VS Code to show me... idle: Image hovering over: Image View Problem: Image Quick Fix: Image

hippietrail avatar Mar 20 '25 05:03 hippietrail

I can't find any way to get this "More Actions" section.

That's really weird, it doesn't show up when you click the light bulb or use Ctrl/Cmd+.?

mcecode avatar Mar 20 '25 05:03 mcecode

I can't find any way to get this "More Actions" section.

That's really weird, it doesn't show up when you click the light bulb or use Ctrl/Cmd+.?

Aha! I very rarely click the lightbulb, and apparently never have for Harper errors! I always hover over the error and use the popup dialog. This seems like an inconsistent/unintuitive UI choice in VS Code to me. And Cmd+. actually doesn't work when you try it after seeing it as the Quick Fix shortcut in the popup when hovering over an error.

Unless I'm missing something else, the lightbulb doesn't appear instantly so hovering is faster.

hippietrail avatar Mar 20 '25 06:03 hippietrail

This seems like an inconsistent/unintuitive UI choice in VS Code to me.

Yeah, it does. I always use Ctrl/Cmd+. so it was never an issue for me, but I can image it would be for people who prefer to use the GUI more than keybindings. Maybe that's why the CSpell Language Server marks all of their code actions as "Quick Fixes" since their language server seems to be tightly integrated with VS Code.

mcecode avatar Mar 20 '25 07:03 mcecode

Maybe that's why the CSpell Language Server marks all of their code actions as "Quick Fixes" since their language server seems to be tightly integrated with VS Code.

Would it be prudent to copy this decision?

elijah-potter avatar Mar 20 '25 14:03 elijah-potter

Maybe that's why the CSpell Language Server marks all of their code actions as "Quick Fixes" since their language server seems to be tightly integrated with VS Code.

Would it be prudent to copy this decision?

It depends. Maybe we can queue it as low priority for now since I don't really see a lot of VS Code users confused about this, but at the same time, they could be like Andrew and Trent that just weren't aware that this was a feature because they use VS Code different from how I do.

mcecode avatar Mar 21 '25 03:03 mcecode

Maybe that's why the CSpell Language Server marks all of their code actions as "Quick Fixes" since their language server seems to be tightly integrated with VS Code.

Would it be prudent to copy this decision?

It depends. Maybe we can queue it as low priority for now since I don't really see a lot of VS Code users confused about this, but at the same time, they could be like Andrew and Trent that just weren't aware that this was a feature because they use VS Code different from how I do.

Yes I'm hesitant to say "go ahead and do it" even though it bit me because it feels a bit heavy-handed as a way to handle what seems like an oversight in VS Code. I'll try to see if other VS Code users are talking about it and if there are any open or closed issues on it.

hippietrail avatar Mar 21 '25 04:03 hippietrail