Second, tell Sublime which language ID to report for that scope. By default Sublime sends git for everything in its text.git.* family, and harper-ls routes commit messages by the git-commit language ID, so the buffer is not linted. Add the mapping to your user language-ids.sublime-settings, which LSP for Sublime Text reads to override the language ID it derives from a scope:
{"text.git.commit":"git-commit"}
Third, stop LSP from discarding the results. Commit messages live under .git/ (for example .git/COMMIT_EDITMSG), and LSP for Sublime Text ignores diagnostics for any file matching folder_exclude_patterns, which includes .git by default. Remove .git from that list for commit buffers only by creating Packages/User/Git Commit.sublime-settings:
Sublime Text
Our Sublime Text integration is powered by
harper-ls.Required Setup
Make sure you have
harper-lsinstalled and available on your global or Sublime Text'sPATH. You can do this using the supported installation methods.Ensure you have LSP for Sublime Text installed.
Optional Configuration
Open
Preferences > Package Settings > LSP > Settingsand add theharper-lsclient configuration to the "clients" section:{ "clients": { "harper-ls": { "enabled": true, "command": [ "harper-ls", "--stdio" ], "selector": "source.markdown | text.html.markdown | text.plain", "settings": { "harper-ls": { "userDictPath": "", "workspaceDictPath": "", "fileDictPath": "", "linters": { "SpellCheck": true, "SpelledNumbers": false, "AnA": true, "SentenceCapitalization": true, "UnclosedQuotes": true, "WrongApostrophe": false, "LongSentences": true, "RepeatedWords": true, "Spaces": true, "CorrectNumberSuffix": true }, "codeActions": { "ForceStable": false }, "markdown": { "IgnoreLinkTitle": false }, "diagnosticSeverity": "hint", "isolateEnglish": false, "dialect": "American", "maxFileLength": 120000, "ignoredLintsPath": "", "excludePatterns": [] } } } } }For more information on what each of these configs do, you can head over to the configuration section of our
harper-lsdocumentation.Linting Git Commit Messages
Commit messages need three extra pieces of configuration in Sublime Text.
First, add the commit message scope to the
selectorin yourharper-lsclient configuration above, so LSP attaches to commit buffers at all:"selector": "source.markdown | text.html.markdown | text.plain | text.git.commit",Second, tell Sublime which language ID to report for that scope. By default Sublime sends
gitfor everything in itstext.git.*family, andharper-lsroutes commit messages by thegit-commitlanguage ID, so the buffer is not linted. Add the mapping to your userlanguage-ids.sublime-settings, which LSP for Sublime Text reads to override the language ID it derives from a scope:{ "text.git.commit": "git-commit" }Third, stop LSP from discarding the results. Commit messages live under
.git/(for example.git/COMMIT_EDITMSG), and LSP for Sublime Text ignores diagnostics for any file matchingfolder_exclude_patterns, which includes.gitby default. Remove.gitfrom that list for commit buffers only by creatingPackages/User/Git Commit.sublime-settings:{ "folder_exclude_patterns": [".svn", ".hg", "CVS", ".Trash", ".Trash-*"] }This is the default Sublime Text list without
.git. As a syntax-specific setting, it only applies to views using the Git Commit syntax.With all three in place,
git commitbuffers opened in Sublime Text are checked with the same Git commit parser used by the other editor integrations.