Make sure you have harper-ls installed on your system and available in your PATH.
Since version 29, Emacs has had native support for the Language Server Protocol through Eglot, so all you have to do is configure it to use harper-ls in your init.el:
where text-mode can be set to any, some, or all major modes that correspond to the languages harper-ls supports. Typically, if you want to use harper-ls to edit Markdown files and you have markdown-mode installed, you can configure it like this:
A possible gotcha you may be encountering if you don't see any diagnostics is when Eglot automatically deduces the language ID being sent to harper-ls based on the major mode you used. In which case, you can set the language ID to one that is supported:
Additionally, you can also configure things like which linters to use or how you want code actions to appear. Below is an example config where everything is set to their default values:
(setq-default eglot-workspace-configuration
'(:harper-ls (:userDictPath ""
:workspaceDictPath ""
:fileDictPath ""
:linters (:SpellCheck t
:SpelledNumbers :json-false
:AnA t
:SentenceCapitalization t
:UnclosedQuotes t
:WrongQuotes :json-false
:LongSentences t
:RepeatedWords t
:Spaces t
:Matcher t
:CorrectNumberSuffix t)
:codeActions (:ForceStable :json-false)
:markdown (:IgnoreLinkTitle :json-false)
:diagnosticSeverity "hint"
:isolateEnglish :json-false
:dialect "American"
:maxFileLength 120000
:ignoredLintsPath ""
:excludePatterns [])))
Note
This example only contains some of the available linters, check out our rules page to view the full list.
For more information on what each of these configs do, you can head over to the configuration section of our harper-ls documentation.
Common Config Changes
Programmers often find certain rules have too much of a hair-trigger.
The below config is a simple cut-and-paste that gives you much fewer false-positives.
Emacs
Our Emacs integration is powered by
harper-ls.Required Setup
Make sure you have
harper-lsinstalled on your system and available in yourPATH.Since version 29, Emacs has had native support for the Language Server Protocol through Eglot, so all you have to do is configure it to use
harper-lsin yourinit.el:where
text-modecan be set to any, some, or all major modes that correspond to the languagesharper-lssupports. Typically, if you want to useharper-lsto edit Markdown files and you havemarkdown-modeinstalled, you can configure it like this:Optional Configuration
Additionally, you can also configure things like which linters to use or how you want code actions to appear. Below is an example config where everything is set to their default values:
For more information on what each of these configs do, you can head over to the configuration section of our
harper-lsdocumentation.Common Config Changes
Programmers often find certain rules have too much of a hair-trigger. The below config is a simple cut-and-paste that gives you much fewer false-positives.
Additional Links
harper-lsfor Emacs