-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Fix crash inside JSX Closing tag #6006
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
Conversation
if (tryGetGlobalSymbols()) { | ||
// If the currect cursor is inside JSX opening tag, the only meaningful completions are those of JSX.IntrinsicElements or users defined React.Component | ||
// If the services can't find those symbols, then show nothing instead of including all the global symbols in the completion list. | ||
if (tryGetGlobalSymbols(/*includeAllGlobalSymbols*/false)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space after comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does "all" mean? Something is getting filtered out and this parameter name doesn't convey it well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree on naming. not sure what is the best name. What I try to convey is that the boolen control whether you will add all global symbols from all the files into the completions list or not. This doesn't make sense for JSX opening tag
After some though, I've realized that this sort of thing is potentially obstructive to the way that users might write code. For instance, let's say I have var x =
<div>
<span>
</ Let's say I'm actually simply intent on closing my I think you should consider giving completions for all containing open tags who don't have an appropriate corresponding closing tag. That means that for: <div>
<span>
<a>
</ span
</ div> It might be the case that the We should discuss this a bit tomorrow. |
This seems like an odd state to be in. @bowdenk7 - Maybe we can get some people writing JSX in our next usability study so we can see what order people actually go in. That could be very informative. |
@DanielRosenwasser yes. I don't think I got what you trying to say in the last part of the comment Also to clarify, this behavior is only when you don't have react.d.ts. |
We only show the closing tag element when you don't have a valid JSX namespace? That seems fine then. I'm mainly trying to avoid a scenario where you have someone with extremely weird typing habits (like myself) where they end up fighting the editor. |
@DanielRosenwasser yep, this behavior is only trigger when we don't have valid JSX name. |
Conflicts: src/services/services.ts
@DanielRosenwasser @RyanCavanaugh @sandersn Any more comments? |
We're exposing this in our API, so we should discuss this with @mhegazy in a meeting, but other than that 👍 |
👍 |
Fix issue #5953 by giving its associated opening tag. Initially, the PR tried to address preventing adding the global symbols that is not in jSX into the opening tag. However, doing so cause some inconsistent so the change is rolled back.