feat: Autocomplete via propTypes, auto close tags, quotes and braces #4
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.
This adds initial autocomplete via CodeMirror's
show-hint
andxml-hint
addons. This works because thejsx
mode internally switches toxml
mode when writing JSX tags.We generate the set of tags, prop names and supported values from the
propTypes
object thanks to parse-prop-types. Right now, when suggesting values, this only supports string values that were defined withPropTypes.oneOf([...])
, but it's much better than nothing.In the prop suggestions, we're deliberately omitting
children
(since they shouldn't be provided as attributes) andclassName
(since Playroom is designed to work with components, not style sheets).Also, to help streamline the editing experience, we're now automatically closing JSX tags, quotes and braces, and converting
Tab
key presses into spaces.