nevrome / wellspell.addin

R Package - Quick Spellcheck Addin for RStudio
MIT License
21 stars 3 forks source link

Incompatibility with visual markdown editor #34

Open tuberculo opened 3 years ago

tuberculo commented 3 years ago

When using visual markdown mode on Rstudio version 1.4, the addin does not work.

nevrome commented 3 years ago

Thanks for reporting this. I found some relevant documentation here and here, but I do not get this to work in the visual editor environment. I always get an empty string from rstudioapi::selectionGet() instead of my selection with rstudioapi 0.13.0.9000 and RStudio 1.4.1087.

Do you know how to use this? A PR would be very welcome.

tuberculo commented 3 years ago

I also get an empty string when using rstudioapi::selectionGet(). However, based on kevinushey example, I've tried rstudioapi::selectionGet(id = rstudioapi::documentId(allowConsole = FALSE)) and this command works in both modes.

nevrome commented 3 years ago

I see - ok. I wonder if we should turn off the error selection ("highlighting") for the grammar check. That would allow us to use this interface and potentially pave the way to solve #35 as well. But we would loose a feature. What do you think @GegznaV?

GegznaV commented 3 years ago

Yes, several months ago I discovered an unsolved issue with RStudio visual mode and RStudio add-ins. Especially those, which use shortcut keys. I did not research this month if there already is an official solution/workaround.

@nevrome Is there an official way to check if visual editor mode is activated in the document of interest?

Are we talking about turning off this kind of highlighting image ?

nevrome commented 3 years ago

Is there an official way to check if visual editor mode is activated in the document of interest?

Good question! I think a simple function that returns TRUE or FALSE depending on whether the visual editor mode is turned on does not exist unfortunately. Maybe we should open an issue and ask for that feature? The best we seem to have is this: https://cran.r-project.org/web/packages/rstudioapi/vignettes/visual-mode.html

Are we talking about turning off this kind of highlighting

Ja - but I only thought about turning it off for the grammar check, not the spell check. The grammar check should then report the offending text in the issue list on the bottom. It's less cool, but maybe a bit more easy for us to maintain. For the visual editor mode we can't do more anyway, even for the spellcheck.