Skip to content

feat: configurable compilationMode (#67)#78

Open
blazejkustra wants to merge 1 commit into
feat/use-no-memo-skipped-bucketfrom
feat/configurable-compilation-mode
Open

feat: configurable compilationMode (#67)#78
blazejkustra wants to merge 1 commit into
feat/use-no-memo-skipped-bucketfrom
feat/configurable-compilation-mode

Conversation

@blazejkustra

Copy link
Copy Markdown
Owner

Closes #67.

Summary

  • Expose React Compiler's compilationMode as a per-workspace setting (infer | annotation | syntax | all, default infer) instead of hardcoding "infer" in checkReactCompiler.ts.
  • Plumb the setting through all four clients (VS Code, IntelliJ, Neovim, Zed) plus the CLI (--compilation-mode).
  • Invalid values fall back to "infer" with a throttled error, so a typo can't break the inlay-hint pass.
  • Compilation cache is invalidated when the mode changes (cache is keyed only by source+filename, so a flip would otherwise serve stale results).
  • Other compiler internals (panicThreshold, enableTreatRefLikeIdentifiersAsRefs) stay hardcoded — they're set the way they are because this is a marker tool.

Why this matters

Teams using compilationMode: "annotation" for incremental adoption (only "use memo" opted-in functions get compiled) currently see the extension light up every component, which doesn't match what React Compiler actually does in their app. With this setting, the markers track the real build.

Note: base is feat/use-no-memo-skipped-bucket because that branch contains the "use no memo" skipped-bucket work (#73) this PR builds on top of.

Test plan

  • npm test in packages/vscode-client — 14/14 pass, including a new annotation-mode.tsx fixture asserting that under "annotation" only the "use memo" component compiles, while "infer" still compiles both.
  • tsc -b clean across server and vscode-client; ESLint clean.
  • CLI --compilation-mode flag rejects invalid values before invoking the report.
  • Manual smoke test in VS Code with reactCompilerMarker.compilationMode flipped between values; confirm cache invalidates and markers update.
  • Manual sanity check that IntelliJ/Neovim/Zed clients still load (Kotlin/Lua not built in CI here).

Expose React Compiler's `compilationMode` as a per-workspace setting
(`infer` | `annotation` | `syntax` | `all`, default `infer`) across
all clients (VS Code, IntelliJ, Neovim, Zed, CLI), so teams using
`annotation` mode for incremental adoption see markers that match
their actual build output. Invalid values fall back to `infer` and
the compilation cache is invalidated when the mode changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant