fix(language-server): judge unknown ingredients with the analyzer's resolution #278

Merged
abiwab merged 1 commit from fix/lsp-unknown-ingredient-verdict into main 2026-11-26 17:24:57 +01:00
Owner

The editor's "unknown ingredient" verdict now comes from the analyzer (getIngredientData), the same resolution as the nutrition estimate and analyzed.missingIngredients. Until now the language server kept its own lookup (raw keys, lowercased names, a French plural guess), and the two disagreed both ways:

  • Editor accepted, nutrition missed: @carottes, @œufs, @eggs, @tomates cerises, @sels fins, and even @pâtes (pasta) matched as pâte (pastry).
  • Editor flagged, nutrition found: @olive-oil, @Huile d’olive (curly apostrophe), @huile-d-olive, a hyphenated alias (@sel-de-table, @Bok-Choy), a database key not written as a slug (Butter).

Changes:

  • UNKNOWN_INGREDIENT, the nutrition hover and "Convert to grams" all go through getIngredientData. isKnownIngredient, lookupIngredient and buildIngredientLookupSet are removed, along with the lookupSet plumbing (provideDiagnostics, ResolvedDb, DbReloadDeps, server.ts).
  • Plurals are no longer guessed: @carottes is flagged with "Did you mean '@Carotte'?". Write the singular or add the plural to the entry's aliases.
  • findClosestIngredient compares the slugs of key, name and aliases, so it also suggests through a key not written as a slug.
  • Docs (en + fr): the VS Code extension page no longer promises silent plural handling.

This is the routing step of PR 5a of the DX plan: the bug is in released behavior and does not depend on the planned move, so it ships as a patch on main. PR 5a (moving isKnownIngredient / findClosestIngredient into the analyzer) follows on dev/1.6 once main is merged back.

Checks: tests/unknown-ingredient-verdict.test.ts (24 FR/EN cases comparing editor, hover and analyze().missingIngredients), typecheck, biome, bun test (3919 pass, 1 skip), conformance unchanged (142/142, 24/24), deprecations:check, audit unchanged (126).

The editor's "unknown ingredient" verdict now comes from the analyzer (`getIngredientData`), the same resolution as the nutrition estimate and `analyzed.missingIngredients`. Until now the language server kept its own lookup (raw keys, lowercased names, a French plural guess), and the two disagreed both ways: - **Editor accepted, nutrition missed**: `@carottes`, `@œufs`, `@eggs`, `@tomates cerises`, `@sels fins`, and even `@pâtes` (pasta) matched as `pâte` (pastry). - **Editor flagged, nutrition found**: `@olive-oil`, `@Huile d’olive` (curly apostrophe), `@huile-d-olive`, a hyphenated alias (`@sel-de-table`, `@Bok-Choy`), a database key not written as a slug (`Butter`). Changes: - `UNKNOWN_INGREDIENT`, the nutrition hover and "Convert to grams" all go through `getIngredientData`. `isKnownIngredient`, `lookupIngredient` and `buildIngredientLookupSet` are removed, along with the `lookupSet` plumbing (`provideDiagnostics`, `ResolvedDb`, `DbReloadDeps`, `server.ts`). - Plurals are no longer guessed: `@carottes` is flagged with "Did you mean '@Carotte'?". Write the singular or add the plural to the entry's `aliases`. - `findClosestIngredient` compares the slugs of key, name and aliases, so it also suggests through a key not written as a slug. - Docs (en + fr): the VS Code extension page no longer promises silent plural handling. This is the routing step of PR 5a of the DX plan: the bug is in released behavior and does not depend on the planned move, so it ships as a patch on `main`. PR 5a (moving `isKnownIngredient` / `findClosestIngredient` into the analyzer) follows on `dev/1.6` once `main` is merged back. Checks: `tests/unknown-ingredient-verdict.test.ts` (24 FR/EN cases comparing editor, hover and `analyze().missingIngredients`), typecheck, biome, `bun test` (3919 pass, 1 skip), conformance unchanged (142/142, 24/24), `deprecations:check`, audit unchanged (126).
fix(language-server): judge unknown ingredients with the analyzer's resolution
All checks were successful
CI / Build & Test (pull_request) Successful in 5m45s
a5a025ed56
abiwab scheduled this pull request to auto merge when all checks succeed 2026-11-26 17:21:48 +01:00
abiwab merged commit 9a6848002b into main 2026-11-26 17:24:57 +01:00
abiwab deleted branch fix/lsp-unknown-ingredient-verdict 2026-11-26 17:24:58 +01:00
Sign in to join this conversation.
No description provided.