feat(language-server): complete frontmatter keys and recipe names, fix deprecated keys #272
No reviewers
Labels
No labels
bug
discussion
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
research
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gram-lang/gram!272
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/lsp-frontmatter-names-completion"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
PR 2b of the DX plan (phase 1A), on top of the frontmatter key registry (#268). In
packages/language-server, for every LSP client:frontmatter.keys/frontmatter.valuesof@gram-lang/i18n, no new string). A key written in its deprecated form counts as present; a deprecated key is never offered. Read from the live text before the!state.astguard, so it works before the closing---. Nothing else is completed in the frontmatter (no ingredient on@, no name on#).#the cookware,^the temperatures,~every named timer,~_the passive timers (tracks) the recipe already names. ExplicittextEditfrom right after the sigil (_kept, multi-word names), braces for~and^. Nothing on a##heading, inside braces, after//or mid-word. Trigger characters#,^,~.DEPRECATED_FRONTMATTER_KEY: anchored on the key's name (found fromdata.keyin the text, the AST keeps no position), struck through (DiagnosticTag.Deprecated), with anisPreferredQuick Fix that renames the key, or removes the line when the key read is already another one (the replacement, or an earlier alias:yieldbeforeyields), so the value shown never changes. Nothing of this whendata.specifieris set (a key of an imported module stays on its@useline).utils/frontmatter-text.ts) shared by all four: it tolerates# …, indented lines, an unclosed block, a BOM and CRLF.Kitchen / modules:
warningInfo: Record<WarningCode, { severity, deprecated? }>, withwarningSeverityderived from it (no API change), andwarningInfoOf(code)in@gram-lang/modules. The strikethrough comes from this flag, never from a code written in the LSP.deprecated-warning-codes.test.tschecks both ways that the flag matches the active entries ofdeprecations.yaml. No compiled output changes.Docs (en + fr): Completion, Hover and Code Actions rows of
reference/tooling/language-server.mdx,warningInfoinreference/api/warnings.mdx(plusDEPRECATED_FRONTMATTER_KEYamong the codes withdata, missed by #268), language server README. Changesetminoronlanguage-server,kitchen,modules.Checks: build, typecheck, lint,
bun test(4065 pass, incl.generic-client.test.tsafter the server build andcapabilities.test.ts), conformance,deprecations:check, playground chunk 1059.1 KB (unchanged by this PR).Fuzz (
bun run fuzz --iterations 50000): 8 runs, 6 clean. One failure's seed was lost; the other (seed 2725035355, index 964) isformat-preserves-meaningon a mutated frontmatter, and reproduces identically onorigin/main(d8f1a67f) andorigin/dev/1.6(2af231a4): not from this PR. Cause: a:followed only by blanks after a cookware or an ingredient (#pan:at the end of a line) is read as an empty alias, so stripping the trailing blank (rule 10) changes the parse. To be fixed separately onmain.