fix(language-server): read the ingredient database named by database: in .gram/config.yaml #296

Merged
abiwab merged 1 commit from fix/lsp-config-database into main 2026-11-26 23:17:27 +01:00
Owner

The language server ignored database: in the project's .gram/config.yaml, which gram reads (resolveDbPath): in a project that keeps its ingredient database elsewhere, the editor had no database at all (no unknown-ingredient diagnostic, no nutrition hover, no gram conversion).

  • readProjectConfigSync reads database:.
  • resolveIngredientDb follows the CLI's order: gram.ingredientDatabase.path, else the first workspace folder's database: (relative to the folder), else its .gram/ingredients.yaml. A database: naming a missing file does not fall back to .gram/ingredients.yaml, as the CLI does not. It also returns the path it loaded.
  • The file watcher covers **/*.{yaml,yml}; isIngredientDbChange keeps only .gram/ingredients.yaml files and the database in use. A .gram/config.yaml change reloads the database too.
  • Docs (en + fr) and the VS Code setting description updated; patch changeset.

Tests: 8 new (db-reload, project-config), red before the fix. bun test 3957 pass / 1 skip, typecheck 24/24, biome clean.

After merge: merge main into dev/1.6 (small conflict expected in server.ts).

The language server ignored `database:` in the project's `.gram/config.yaml`, which `gram` reads (`resolveDbPath`): in a project that keeps its ingredient database elsewhere, the editor had no database at all (no unknown-ingredient diagnostic, no nutrition hover, no gram conversion). - `readProjectConfigSync` reads `database:`. - `resolveIngredientDb` follows the CLI's order: `gram.ingredientDatabase.path`, else the first workspace folder's `database:` (relative to the folder), else its `.gram/ingredients.yaml`. A `database:` naming a missing file does not fall back to `.gram/ingredients.yaml`, as the CLI does not. It also returns the path it loaded. - The file watcher covers `**/*.{yaml,yml}`; `isIngredientDbChange` keeps only `.gram/ingredients.yaml` files and the database in use. A `.gram/config.yaml` change reloads the database too. - Docs (en + fr) and the VS Code setting description updated; `patch` changeset. Tests: 8 new (`db-reload`, `project-config`), red before the fix. `bun test` 3957 pass / 1 skip, typecheck 24/24, biome clean. After merge: merge `main` into `dev/1.6` (small conflict expected in `server.ts`).
fix(language-server): read the ingredient database named by database: in .gram/config.yaml
All checks were successful
CI / Build & Test (pull_request) Successful in 5m44s
09d4c117ea
abiwab scheduled this pull request to auto merge when all checks succeed 2026-11-26 23:12:08 +01:00
abiwab merged commit a700e87632 into main 2026-11-26 23:17:27 +01:00
abiwab deleted branch fix/lsp-config-database 2026-11-26 23:17:27 +01:00
Sign in to join this conversation.
No description provided.