Repository navigation
compiler: record class scope on inventory commands for completion gating - #867
Merged
Merged
Conversation
The inventory knew beamer/letter commands are class-conditional only in
prose ("needs \\documentclass{beamer}"); ranking ignored it, so adding
beamer commands let \\frametitle outrank \\frac on \\fra and \\alert
outrank \\alpha on \\a in every document. Command gains requires_class
(None = universal), populated for the 14 letter.cls-gated commands and
emitted as "requires_class" in --supported json (schema stays
flashtex-supported-latex/1, which the Swift decoder asserts and the sync
script greps for). offered_in_class is the gate rule completion mirrors:
hide a scoped command only when the document class is known and different.
No entry moved, so table order and the docs/coverage artefacts are
byte-identical; only supported-latex.json changed.
Implementation-Agent: muse-spark-1.3-contributor
Commit-Executor: muse-spark-1.3-contributor
Commit-Executor: daniel-parent
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Rust half of the
\fra→\frametitleregression found by CI on #855. This PR alone does not fix the user-visible symptom — see below.The problem
Adding beamer commands to the inventory changed completion for every document. Typing
\fra⇥ expands\frametitle{}instead of\frac{}{}; typing\aoffers\alertahead of\alpha,\alephand\allowdisplaybreaks. The inventory descriptions already said "needs\documentclass{beamer}" — the data knew these commands were conditional and nothing consumed that.This PR
Commandincrates/compiler/src/supported.rsgainsrequires_class: Option<&'static str>(None= universal).offered_in_class: hide a scoped command only when the document class is known and different. An unknown class offers everything, so this cannot make completion worse for any document we can't classify — deliberately the conservative direction.supported-latex.jsonregenerated with the built binary. Only the 14 letter entries gained the field; no entry moved, andcoverage.mdplus thedocs/user/compiler.mdsection verified byte-identical. The Mac app's bundled copy is synced (CI enforces byte-identity).crates/compiler: 86 suites ok, 0 failed (lib 460 passed).apps/**is outside the sandbox scope. The lane reported this itself rather than declaring victory on the Rust side:So
\fra⇥ still gives\frametitleuntil the Swift consumer respectsrequires_class. A separate lane is on that and will reference this PR. The two Mac tests (CompletionTests.testBackslashTriggersCommandsAndPrefixFilters,SnippetTests.testTabMovesBetweenPlaceholdersAndEscLeaves) stay red until then — and their assertions are correct and must not be changed; they are what caught the regression.Why this matters beyond beamer
The same problem recurs with every future class-scoped package. A flat global vocabulary has no way to express "this command exists only in this class", so the first class-specific package to land displaces universal commands for everyone. This gives the model a place to record that.
crates/compiler— does not reach users untilvendor/compileris re-pinned (currently 23 commits behind).Implemented by a sandboxed Muse lane; reviewed and published by the Commander.
🤖 Generated with Claude Code