LanguageTool plugin

I like to get grammar and spelling corrections as I type, and the best open source tool for this that I have found is LanguageTool. I was surprised that no one have developed a plugin for it yet, so I decided to write my own. However, there seems to be no option for a plugin to edit the text editor view, similar to how it is currently done with the red underline for the spellchecker. Also, I think I would need a way to open a popup window in the exact location of the clicked text.

Is there a way to do this with the plugin API?

My other idea is to use a separate panel to display the errors, but this would not be ideal UX wise.

4 Likes

I'd love this either built-in or as a plugin. I'd also like it on Android, where I do a lot of writing. I've currently got the Firefox plugin as I write this, and it is useful and has a very clean user interface. However, it should be said that the free version is not very robust. A little help is better than none, and a non-Native English speaker might get more help, but their paid version probably offers much more.

First, thanks for the support.

I figure out I have to register a plugin for CodeMirror. Currently, I am working on this. I had planned to support costume installations of LanguageTool but I would need help with making sure that all feature work.

I don't think the Android app supports plugins.

I'll be happy to beta test. But I'm not particularly good at finding a lot of flaws or improvements. If it works, I'll be happy.

I got good news, a beta version is now available on GitHub
Please try and leave issues if you encounter bugs or need a specific feature.

3 Likes

I publish the plugin but it only works in development mode, issue here

Could you install the plugin and report if it works for you?

Apparently I don't even know enough to be able to beta test for you. When I try and open a plugin from a file, it looks for a jpl file. I don't see one. So, now you know the state of my ignorance. I'll be happy to check tomorrow if you clue me in as to how to install the plugin, or do I need to change to some development mode to just install it?

Anyway, I'm swamped now, but this weekend I'll certainly have some time.

Sorry I can't do what I offered to do.

Sorry I wasn't more clear. The plugin is published on the Joplin repository. In the settings, just search for LanguageTool to install it. Apparently it works now on my system, but more eyes the better.

If you found a bug, please file an issue on GitHub.

OK quick notes and suggestions:

  • only works in developer mode
  • The suggestions after right clicking take too long to pop up. I tended to give up. Perhaps 2 second delay, which I'm not used to. Maybe it is only 1 second and not so bad once I began expecting it, but odd.
  • When a mistake is found (in my case synchronize from the default database), it was the English instead of American spelling. The change should change all the instances. As is, you are just changing a dozen or so instances.
  • No way to add to personal dictionary words that you use
  • No way to say, ignore this error or instance of the error to get rid of all the red marks that are inappropriate for you.

Anyway, still, pleased at the start. I think this is a big step forward. Language tool is pretty good, and if you get this working well, I'm likely to buy the pro version, but I think that requires a different api pointer.

Thank you

1 Like

Thanks for trying the plugin and willing to beta test it. Here are some responses to your points

How did you install it in developer mode? I can only do it from my local development folder, which is not public.

The long time it takes to popup should be fixed in version 0.0.5. For long notes, the underline is expected to take long to appear.

You can change the language and region in the settings, for example set it to en-us for American spelling. By default, it autodetects the language. In my experience, it defaults to the US, so I don't know how you set it up.

Personalized dictionaries and pro access require more complex API queries, but is doable.

Ignoring suggestions is something I had not thought of. I tend to just ignore the red markings. I think there should be a way to do it.

Thanks

Using Windows 11

I'm sorry I didn't get back to you sooner. To use developer mode, I did copied the command from the help menu. Then closed Joplin and ran the command. I was afraid to have 2 versions open. My Joplin is precious. Each database is in a separate folder.

I'm updated to v0.1.0

I copied a 7 or so page essay I wrote quickly to a new note, so it'll have a lot of stuff. I had lots of wrong red lines because I was defining Sanskrit words. However, it was impossible to use the system. All the red seemed to be spelling. There were lots of yellow marks. I could not figure out how to make them work. I tried one click, two clicks right clicks and left clicks. Nothing would happen for perhaps 20 or 30 seconds. I could go looking somewhere else and something would pop up. Sometimes it would go away, sometimes it would offer a suggestion, so then it was LanguageTool. But, sadly, it seemed to appear only on about 10% of the attempts and after so long, I wasn't there anymore.

Since it isn't working right, I need to know exactly how to work it. For example I left out the comma after example in this sentence. I got an orange underline. When I left-clicked the word and this appeared. This is what Firefox does.

languagetoolexample

Nothing I did created a response in less than 15 seconds, and then only about 10% of the time.

My computer is pretty good. Within Firefox it works immediately, so something is wrong.

To see the suggestion, you should right-click on the underlined word and the context menu should appear (quickly). In the menu, there should be a list of suggestions and an explanation of the error. Red lines are for misspelled words, and yellow for other mistakes.

An older version was slow, but that should have been fixed in version 0.0.5.

My problem is that the suggestion don't appear on the context menu, but the errors do get marked. However, it works if I install the plugin from the advance settings.

I'm taking holidays in February, so I wouldn't be able to check make new changes until I'm back in March.

I bought the premium version and use it. I write a lot of stuff using the Android version. Sync to the Windows desktop. Then copy into the New Text window and work through corrections, then paste back over the deleted note. So, I'd love to be able to turn it on inside Joplin itself.

To use the premium LanguageTool, you need to change some settings on the plugin. First you have to change the URL to https://api.languagetoolplus.com/v2/check, and provide your username and API key that you get from your personal settings here.

The settings should look something like this

If you type fast, there might be some words that get marked erroneously because the software does not clear the markings when you finished typing. If I got time on the weekend, I will work on a solution. In the meanwhile, reloading the note (opening another and then click back on the note) will clear the markings and only the real errors will be marked.

Yes, I've done that. What I need to do is get some time and then paste a new large note with lots of my writing into a blank note in the developer database. I just never use the developer database and so don't even think of it.

Sorry, but I don't understand what you mean with the developer database.

If you are afraid of installing the plugin in "regular" Joplin, other users have reported that it works fine on their machine. The code shouldn't touch your notes unless you right-click and change a word, and then it will only change that word. I can't promise it won't do anything to your notes (because it is software) but I have programmed it to not interfere with the database directly and only changes the notes when the user instructs.

The only problem I have is that on my machine it does not work when installed from the repo and I have to install it directly from source.

1 Like

Are there any plans to move this to the Joplin plugin registry?

1 Like

Hiya! :waving_hand: Utter newbie plugin developer here — and I’ve already seen that this is far more than I can swallow at this time :joy:

Soooo I managed so far to…

  • figure out how to ‘compile’ the plugin using `npm` — it took me way longer than hinted on the ‘generate’ README, mostly because those instructions are seriously outdated by several generations (pun intended!). The current Joplin docs suggest doing everything with `yarn` as package manager anyway…
  • figure out what exactly to put into the filepath for the ‘in development’ plugin

That resulted into a new plugin showing up, marked as `DEV` — so far, so good — but everything in it is greyed out. No additional preferences/menus are shown anywhere.

On this thread, ‘entering developer mode’ is mentioned. Now I had never ever done that before, bit it sort of worked. It seems that it starts with a brand new environment — all notes are gone, all my configurations are gone, etc. I guess that’s how it’s supposed to work. Oh well.

The new plugin shows up as before, marked as `DEV`, but, again, everything in it is still greyed out. And still no additional preferences/menus are shown anywhere. So… ‘nothing works’.

Now… one very good reason for LT not really working might be the lack of an API key. It seems that LT now only generates API keys for paying customers. It makes sense: if you wish to do more and need an API key, but don’t wish to get charged extra for that awesome privilege, well, it’s all open source, so you can simply download it to your favourite host (or locally) and just do whatever you wish there. However, I was expecting that, by default, this plugin would still do something useful using the free access API.

Needless to say, I did not install the LanguageTool Server. It’s developed in Java. Sorry, but no, thank you! I had already too many bad experiences with Java in the past three decades — enough is enough!

That said, I wonder where exactly — or what exactly — I need to click to ‘activate’ the plugin somehow. `DEV` plugins don’t seem to be the cute on/off slider, so I don’t have any easy way of knowing if anything works at all. Probably I might get some hints on the dev tools console?… What would you recommend that I try next?

try updating @joplin/lib in package.json to the current version (3.5.1), I was getting errors just trying to install the dependencies until I did that. After doing that I was able to build the plugin and I see it's settings show up under Tools | Options, and see that the plugin is running:

Looks like it's not compatible with codemirror 6 though: