Skip to content

feat: recognize Sublime Text's git language id as git commit messages#3782

Open
costajohnt wants to merge 2 commits into
Automattic:masterfrom
costajohnt:feat/3781-sublime-git-commit-language-id
Open

feat: recognize Sublime Text's git language id as git commit messages#3782
costajohnt wants to merge 2 commits into
Automattic:masterfrom
costajohnt:feat/3781-sublime-git-commit-language-id

Conversation

@costajohnt

Copy link
Copy Markdown

Issues

Closes #3781

Description

Sublime Text's LSP client reports languageId: "git" when you edit a git commit message, so harper-ls was not linting those buffers. This adds git to the git-commit parser match arm, next to the existing git-commit / gitcommit / scminput ids, so Sublime commit messages get the same grammar checking as the other editors.

One thing worth your call: Sublime derives the languageId from the syntax scope's second component (basescope2languageid), and its whole text.git.* family (commit, ignore, config, rebase, and so on) collapses to git. So this arm also catches non-commit git files edited in Sublime with harper attached. There is no way to tell them apart at the languageId layer. The blast radius is bounded: GitCommitParser masks through tree-sitter-gitcommit and only lints the subject and message lines, so a .gitignore just picks up some prose false positives, no crash. I left a comment on the arm noting this. If you would rather keep it narrower, the alternative is leaving users to add {"text.git.commit": "git-commit"} to their language-ids.sublime-settings (the reporter's current workaround), but that pushes config onto every Sublime user.

Demo

Not applicable, this is an LSP languageId mapping. Behavior: Sublime sends languageId: "git" for a commit buffer, and harper-ls now routes it to the git commit parser instead of leaving it unlinted.

How Has This Been Tested?

cargo clippy -p harper-ls and cargo fmt --check -p harper-ls are clean. The change mirrors the existing git-commit / scminput arms exactly (same target parser), differing only in the languageId string the client reports.

I did not add a Rust test. The languageId match lives inline in update_document with no unit-test seam, and the analogous scminput addition (#3729) was covered by the VS Code integration suite, which does not apply here since harper ships no Sublime client. Glad to add a test if you have a preferred harness for the languageId routing.

AI Disclosure

  • I used an AI agent interactively.

If Your PR Implements or Enhances a Linter

Not applicable, this adds a language-id mapping rather than a linter rule.

Checklist

  • I have performed a self-review of my own code
  • I have added tests to cover my changes
  • I have considered splitting this into smaller pull requests.

costajohnt and others added 2 commits July 7, 2026 10:21
Sublime Text's LSP client reports `languageId: "git"` when editing a git
commit message, so harper-ls never linted those documents. Add `git` to the
git-commit parser match arm, alongside the existing `git-commit`/`scminput`
ids.

Refs Automattic#3781
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support sublime-text git message

2 participants