feat: offer quickfix to add spaces separating letters in unknown math var (#2062)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run

Examples:

| Input | Suggested fix |
| -- | -- |
| `$xyz$` | `$x y z$` |
| `$a_ij$` | `$a_(i j)$` |
| `$a_(ij)$` | `$a_(i j)$` |
| `$xy/z$` | `$(x y)/z$` |

If the unknown identifier appears as a subscript or as the
numerator/denominator of a fraction, we parenthesize the suggested fix.
For example, `a_ij` turns into `a_(i j)`, not `a_i j`, because the
latter is unlikely to be what the user intended.
This commit is contained in:
Joseph Liu 2025-08-29 13:47:51 -04:00 committed by GitHub
parent 25d5bfa222
commit 4324f8fd70
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 405 additions and 7 deletions

View file

@ -46,8 +46,16 @@ impl<'w> DiagWorker<'w> {
}
}
/// Runs code check on the document.
pub fn check(mut self) -> Self {
/// Runs code check on the given document.
pub fn check(mut self, source: &Source) -> Self {
for diag in self.ctx.lint(&source) {
self.handle(&diag);
}
self
}
/// Runs code check on the main document and all its dependencies.
pub fn full_check(mut self) -> Self {
for dep in self.ctx.world.depended_files() {
if WorkspaceResolver::is_package_file(dep) {
continue;