[flow-for-vscode] Ship the Try Flow grammar so VS Code highlights component and hook syntax
Author: matclaytonCreated Sep 23, 2026Updated Sep 23, 2026
Proposal
Ship the Try Flow TextMate grammar in the public VS Code extension (packages/flow-for-vscode), so that VS Code highlights component syntax, hook syntax and match.
The grammar already exists. website/src/try-flow/flow-grammar.json says it is "copied from fbsource/vscode/vscode-extensions/flow/syntaxes", and the team keeps it current. For example, async component and async hook support landed in February 2026 (de7094cd, 5363e534). The only gap is that flow-for-vscode does not ship it.
The change:
- Copy
flow-grammar.jsonandflow-regex-grammar.jsonintopackages/flow-for-vscode/syntaxes/. The internal sync that copies them to the website could copy them there too. - Contribute
flow-grammar.jsonas thesource.jsgrammar forjavascriptandjavascriptreact. Babel JavaScript does the same. - Map
meta.tag.jsxto the built-injsx-tagslanguage, andmeta.embedded.expression.jsback to the host language. Comment toggling then uses{/* */}in JSX tags and//in code. - Add
syntaxes/*.jsonto.vscodeignore, which excludes everything by default. - Replace the README note that points to Babel JavaScript.
We have this as a patch against main and can open a PR if you want it.
Trade-offs for you to decide:
- The extension would change the JavaScript grammar for every workspace, including ones that do not use Flow. A TextMate grammar cannot be switched on or off with a setting.
- The grammar includes grammars for styled-components CSS and Mustache templates that the extension would not ship. VS Code ignores a missing include, so that embedded code has no highlighting, the same as today.
Source: facebook/flow