Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Autocomplete via propTypes, auto close tags, quotes and braces #4

Merged
merged 3 commits into from
Nov 13, 2018

Conversation

markdalgleish
Copy link
Member

@markdalgleish markdalgleish commented Nov 7, 2018

This adds initial autocomplete via CodeMirror's show-hint and xml-hint addons. This works because the jsx mode internally switches to xml 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 with PropTypes.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) and className (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.

screen shot 2018-11-08 at 7 23 25 am

@markdalgleish markdalgleish changed the title Add autocomplete via propTypes, auto close tags, quotes and braces feat: Autocomplete via propTypes, auto close tags, quotes and braces Nov 8, 2018
@markdalgleish
Copy link
Member Author

Just merged from master and fixed conflicts. Ready for review 👍🏻

@markdalgleish markdalgleish merged commit bd88b91 into master Nov 13, 2018
@markdalgleish markdalgleish deleted the autocomplete branch November 13, 2018 02:59
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.

2 participants