Automattic / Automattic/harper

Tries to correct user-added capitalisations to dictionary capitalisation

Open
#2,156 1 comment 3 reactions 0 assignees View on GitHub
bug linting spelling
Dominant language
Rust
Stars
15.4k
Forks
627
Avg merge
1d 15h
Merged PRs (30d)
106

Description

**Describe the bug**
Adding a specific capitalisation of a word to the user dictionary does not prevent Orthographic Consistency errors: `The canonical dictionary spelling is ...`

**To Reproduce**
With VS Code extension (0.71.0), write a sentence containing the word "al" in lowercase, such as `The poet was called al-Ghazal.`. In Quick Fixes/More Actions over the word "al", add it to the user dictionary. Confirm that lowercase "al" has been added to the user dictionary.

The sentence will still have an underline for "al", giving the message `This word's canonical spelling is all-caps.Harper (OrthographicConsistency)` on hover. It will offer a Quick Fix to replace with "AL".

This occurs for many, but not all, types of capitalisation change:
- Adding lowercase for existing uppercase ("AL" → "al")
- Adding mixed case for existing title case ("Edna" → "eDNA")
- Adding all-caps for existing mixed case ("pH" → "PH")
- Adding mixed case for existing lowercase ("ml" → "mL")

However, all-caps versions of lowercase words seem to be accepted without needing to be added to the dictionary ("phlogiston" → "PHLOGISTON") and all-caps versions of mixed case words are accepted if they are added to the user's dictionary ("McMillan" → "MCMILLAN"). Mixed case to a different mixed case seems to sometimes allow a user version ("iPhones" → "iPhoneS") but sometimes not ("iPad" → "Ipad").

**Expected behaviour**
If a certain capitalisation of a word is in the user's dictionary, Harper should not recommend changing that capitalisation to the version in Harper's dictionary.

**Additional context**
Adding a second mixed case capitalisation of the same word deletes any existing mixed case capitalisations of that word that are already in the user dictionary, preventing you from putting two possible mixed case variations in the user dictionary.

This is probably related to #1688 and #2151.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue in the VS Code extension, using Quick Fixes to add lowercase and mixed-case variants to the user dictionary. Trace the OrthographicConsistency handling and user-dictionary behavior described in the report. Done means every capitalization explicitly added to the user dictionary is accepted without a replacement suggestion, while existing variants are preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, vscode
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.