Skip to content

Expose English isolation in harper.js and browser extension - #3669

Merged
elijah-potter merged 1 commit into
Automattic:masterfrom
mirsella:issue-3364-isolate-english-extension
Jun 29, 2026
Merged

Expose English isolation in harper.js and browser extension#3669
elijah-potter merged 1 commit into
Automattic:masterfrom
mirsella:issue-3364-isolate-english-extension

Conversation

@mirsella

@mirsella mirsella commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Issues

Closes #3364

Description

This exposes Harper's existing English-isolation/language-detection behavior to harper.js and the browser extension.

It adds an isolateEnglish lint option, wires it through the wasm lint paths, and adds a browser extension setting so users can skip text Harper detects as non-English. The extension also includes the option in lint caching so toggling the setting produces fresh results.

Demo

No demo attached. The UI change is a small checkbox in the extension options page.

How Has This Been Tested?

  • Ran the wasm tests.
  • Rebuilt the wasm package and ran the harper.js linter tests: 200 tests passed.
  • Built harper.js, components, lint-framework, and the Chrome extension.
  • just format still fails on pre-existing Chrome fixture a11y issues unrelated to this change.

AI Disclosure

  • I am a human and didn't use any AI.
  • I used LLM features of my editor, but not an agent.
  • I used an AI agent interactively.
  • I am an agent or I got an agent to do the work autonomously.

If Your PR Implements or Enhances a Linter

N/A; this exposes an existing language-isolation behavior rather than adding or changing a linter.

  • I made up the sentences in the unit tests.
  • The sentences in the unit tests were generated by an AI.
  • I'm using examples from the bug report / feature request.
  • I collected real-world sentences for the unit tests.

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.

@elijah-potter

Copy link
Copy Markdown
Collaborator

Would you please use our PR description template? Thank you!

@mirsella

Copy link
Copy Markdown
Contributor Author

sorry ! its updated now.

@mirsella

Copy link
Copy Markdown
Contributor Author
image

tested the extension locally, works well !

@elijah-potter elijah-potter left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I apologize for the time it took for me to get to reviewing this.

This looks great! I, surprisingly, have no notes. Thank you!

For those reading this, please note that our isolation of English is somewhat untested and likely to have issues. Please let us know if you encounter any.

Comment thread harper-wasm/src/lib.rs
pub fn organized_lints(
&mut self,
text: String,
fn create_lint_parser(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea!

Comment thread harper-wasm/src/lib.rs
Comment on lines +568 to +573
fn create_lint(lint: harper_core::linting::Lint, source: &[char], language: Language) -> Lint {
let problem_text = lint.get_str(source);
let span = Into::<Span>::into(lint.span).to_js_indices(source);

Lint::new(lint, span, problem_text, language)
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly good!

@elijah-potter
elijah-potter added this pull request to the merge queue Jun 29, 2026
Merged via the queue into Automattic:master with commit 3f3daf3 Jun 29, 2026
12 checks passed
@Norbiros

Norbiros commented Jul 2, 2026

Copy link
Copy Markdown

@elijah-potter this PR resolves both #3271 and #2915. Could you please close them to avoid confusion?

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.

Expose Language Detection in Browser Extension

3 participants