lsp-grammarly
Grammarly Language Server integration for Emacs.
lsp-grammarly
LSP Clients for Grammarly
lsp-mode client leveraging grammarly-language-server.

Table of Contents
💾 Quickstart
(use-package lsp-grammarly
:ensure t
:hook (text-mode . (lambda ()
(require 'lsp-grammarly)
(lsp)))) ; or lsp-deferred
The use-package can be installed via MELPA if missing.
📇 Commands
⚠️ Warning
We are moving to the newer grammarly-language-server that uses the official API. Some features are disabled for now, but we will later add them back.
List of commands interact with language server and Grammarly.com.
| Commands | Description |
|---|---|
lsp-grammarly-login |
Login to Grammarly.com |
lsp-grammarly-logout |
Logout from Grammarly.com |
lsp-grammarly-resume |
Start grammarly check for currnet document (buffer) |
lsp-grammarly-pause |
Stop grammarly checker from current document (buffer) |
lsp-grammarly-stats |
Log out current document status, score, readability, words count, etc. |
🔧 Configuration
lsp-grammarly supports following configuration. Each configuration is described in
detail in Grammarly Extension Settings.
grammarly.patternsvialsp-grammarly-patternsgrammarly.selectorsvialsp-grammarly-selectorsgrammarly.config.documentDialectvialsp-grammarly-dialectgrammarly.config.documentDomainvialsp-grammarly-domaingrammarly.config.suggestions.ConjunctionAtStartOfSentencevialsp-grammarly-suggestions-conjunction-at-start-of-sentencegrammarly.config.suggestions.Fluencyvialsp-grammarly-suggestions-fluencygrammarly.config.suggestions.InformalPronounsAcademicvialsp-grammarly-suggestions-informal-pronouns-academicgrammarly.config.suggestions.MissingSpacesvialsp-grammarly-suggestions-missing-spacesgrammarly.config.suggestions.NounStringsvialsp-grammarly-suggestions-noun-stringsgrammarly.config.suggestions.NumbersBeginningSentencesvialsp-grammarly-suggestions-numbers-beginning-sentencesgrammarly.config.suggestions.NumbersZeroThroughTenvialsp-grammarly-suggestions-numbers-zero-through-tengrammarly.config.suggestions.OxfordCommavialsp-grammarly-suggestions-oxford-commagrammarly.config.suggestions.PassiveVoicevialsp-grammarly-suggestions-passive-voicegrammarly.config.suggestions.PersonFirstLanguagevialsp-grammarly-suggestions-person-first-languagegrammarly.config.suggestions.PossiblyBiasedLanguageAgeRelatedvialsp-grammarly-suggestions-possibly-biased-language-age-relatedgrammarly.config.suggestions.PossiblyBiasedLanguageDisabilityRelatedvialsp-grammarly-suggestions-possibly-biased-language-disability-relatedgrammarly.config.suggestions.PossiblyBiasedLanguageFamilyRelatedvialsp-grammarly-suggestions-possibly-biased-language-family-relatedgrammarly.config.suggestions.PossiblyBiasedLanguageGenderRelatedvialsp-grammarly-suggestions-possibly-biased-language-gender-relatedgrammarly.config.suggestions.PossiblyBiasedLanguageHumanRightsvialsp-grammarly-suggestions-possibly-biased-language-human-rightsgrammarly.config.suggestions.PossiblyBiasedLanguageHumanRightsRelatedvialsp-grammarly-suggestions-possibly-biased-language-human-rights-relatedgrammarly.config.suggestions.PossiblyBiasedLanguageLgbtqiaRelatedvialsp-grammarly-suggestions-possibly-biased-language-lgbtqia-relatedgrammarly.config.suggestions.PossiblyBiasedLanguageRaceEthnicityRelatedvialsp-grammarly-suggestions-possibly-biased-language-race-ethnicity-relatedgrammarly.config.suggestions.PossiblyPoliticallyIncorrectLanguagevialsp-grammarly-suggestions-possibly-politically-incorrect-languagegrammarly.config.suggestions.PrepositionAtTheEndOfSentencevialsp-grammarly-suggestions-preposition-at-the-end-of-sentencegrammarly.config.suggestions.PunctuationWithQuotationvialsp-grammarly-suggestions-punctuation-with-quotationgrammarly.config.suggestions.ReadabilityFillerwordsvialsp-grammarly-suggestions-readability-fillerwordsgrammarly.config.suggestions.ReadabilityTransformsvialsp-grammarly-suggestions-readability-transformsgrammarly.config.suggestions.SentenceVarietyvialsp-grammarly-suggestions-sentence-varietygrammarly.config.suggestions.SpacesSurroundingSlashvialsp-grammarly-suggestions-spaces-surrounding-slashgrammarly.config.suggestions.SplitInfinitivevialsp-grammarly-suggestions-split-infinitivegrammarly.config.suggestions.StylisticFragmentsvialsp-grammarly-suggestions-stylistic-fragmentsgrammarly.config.suggestions.UnnecessaryEllipsesvialsp-grammarly-suggestions-unnecessary-ellipsesgrammarly.config.suggestions.Varietyvialsp-grammarly-suggestions-varietygrammarly.config.suggestions.Vocabularyvialsp-grammarly-suggestions-vocabulary
📝 Roadmap
List of todos, but I have not got time to implement these features.
- Create another package that displays information from Grammarly.com
(To display useful information,
score,readability,word counts, etc).
💸 Using a Paid Grammarly Account
📢 Note that nothing needs to be done for using the free version of grammarly.
You can either login with vscode-grammarly
using VSCode or hit M-x lsp-grammarly-login. They both share the same credentials
so you can login with either side.
🔍 Method 1: Login with VSCode (easier)
Install VSCode and, from the extension panel, select vscode-grammarly click on the drop-down arrow and select "Install pre-release version". (There is an issue with the release version that causes authentication to fail, but this issue does not appear to affect the pre-release version. Alternatively, you may try version 0.18.0, which users report as working fine.)

Then call command palette (default to Ctrl+Shift+p)
and type to search grammarly login command.

You should see Grammarly Website and login with your Grammarly account.

🎉 Make sure you click on the button Open Visual Studio Code. Done! You
can now close VSCode and go back to Emacs!
🔍 Method 2: Login with Emacs (a bit complicated)
⚠️ Warning
This method is no longer working with the new language server and currently WIP, please login with VSCode!
Hit M-x lsp-grammarly-login and you should see the Grammarly's website pop out
from your favorite browser. See below screenshot,
After login, click the button Open URL:vscode, If you have VSCode installed, then
this button would be Open Visual Studio Code instead yet it doesn't matter.

Then click F12 to open the DevTool window. You should able to see an URI like the following

Copy and paste the URI back to Emacs and hit return.

🎉 Done! Now you should be loggin!
Authentication from Grammarly website
Login with your Grammarly account (This step does not require VSCode to be installed)!

🛠️ Contribute
If you would like to contribute to this project, you may either clone and make pull requests to this repository. Or you can clone the project and establish your own branch of this tool. Any methods are welcome!
🔬 Development
To run the test locally, you will need the following tools:
Install all dependencies and development dependencies:
eask install-deps --dev
To test the package's installation:
eask package
eask install
To test compilation:
eask compile
🪧 The following steps are optional, but we recommend you follow these lint results!
The built-in checkdoc linter:
eask lint checkdoc
The standard package linter:
eask lint package
📝 P.S. For more information, find the Eask manual at https://emacs-eask.github.io/.
⚜️ License
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
See LICENSE for details.