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

Emmet reduce JSX array noise #146757

Merged
merged 3 commits into from Apr 5, 2022
Merged

Conversation

rzhao271
Copy link
Contributor

@rzhao271 rzhao271 commented Apr 4, 2022

This PR fixes #138461

I thought that we'd have to do a large refactor first, but I realized there's a much simpler mitigation that I can push in instead.

The mitigation disallows completions to show up in JS and JSX files for cases where the abbreviation contains [] characters without a = inside. The advantage in this case is we don't try to expand array indexes like arr[i], or left-side array de-structuring cases like const [a, b].

The disadvantage is that we now don't show suggestions for abbreviations like div[a b]. Either the user must type an abbreviation of the form div[a=someValue b=someOtherValue], turn on emmet.triggerExpansionOnTab, or run the expand command. But, considering how often one means to type an array index or a left-side de-structuring, and how there already are workarounds, I think it is worth pushing in this mitigation to improve the QoL for JSX users.

I also improved some typing information so we use fewer anys.

@rzhao271 rzhao271 added this to the April 2022 milestone Apr 4, 2022
@rzhao271 rzhao271 requested review from aeschli and mjbvz April 4, 2022 18:26
@rzhao271 rzhao271 self-assigned this Apr 4, 2022
@rzhao271 rzhao271 merged commit 8ba7e14 into main Apr 5, 2022
@rzhao271 rzhao271 deleted the rzhao271/emmet-reduce-jsx-array-noise branch April 5, 2022 19:20
@github-actions github-actions bot locked and limited conversation to collaborators May 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Emmet autocomplete inside a pair of [ ] in a React file is wrong
3 participants