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

Fixed emmet validation when open angle bracket is followed by space #55762

Merged

Conversation

@mathdeziel
Copy link
Contributor

commented Aug 3, 2018

Fix for issue #55411.

Much like the check for PHP's <?, it checks for an open angle bracket followed by a space, which is not valid as an HTML Tag, based on the W3C recommendation.

This will fix issues where, for example, emmet won't trigger in JSX when the if statement contains a <, eg: if (age < 10) ....

This will not work if the there is no space after the angle bracket, as in if (age <10), as numbers are valid within tag names. But this problem should be taken care of by linting.

@mathdeziel

This comment has been minimized.

Copy link
Contributor Author

commented Aug 3, 2018

I am not used to your standards yet and the coding guidelines didn't mention anyting in regard to that, but I decided to add another condition instead of adding an OR to the existing PHP check just to have more explicit checks.

Of course this could easily be refactored as if ((char === question || char === space) && textToBackTrack[i] === startAngle) if it is an issue.

@JacksonKearl

This comment has been minimized.

Copy link
Contributor

commented Aug 3, 2018

Thanks! If you could just add a test here it should be good to go.

@ramya-rao-a
Copy link
Member

left a comment

The same applies if there is a \t instead of a space. I'd suggest to use /\s/.test(char) instead.

@mathdeziel

This comment has been minimized.

Copy link
Contributor Author

commented Aug 3, 2018

Great suggestion @ramya-rao-a! I just pushed this modification.

Now I'm trying to figure out how those automated tests work and I'll push one @JacksonKearl.

@JacksonKearl

This comment has been minimized.

Copy link
Contributor

commented Aug 3, 2018

@mathdeziel You can run the tests with the "VS Code Emmet Tests" debug configuration, and you can use standard mocha constructs like suite.only to restrict the total number of tests run/noise generated.

@msftclas

This comment has been minimized.

Copy link

commented Aug 3, 2018

CLA assistant check
All CLA requirements met.

@mathdeziel

This comment has been minimized.

Copy link
Contributor Author

commented Aug 3, 2018

Thanks for the tip @JacksonKearl!

I just pushed a test, I hope it's properly done. It was my first time using Mocha. Truth be told, it was my first time for a lot of things on this journey...

Thanks for your help/support @JacksonKearl, @ramya-rao-a 😄

@ramya-rao-a ramya-rao-a added this to the August 2018 milestone Aug 3, 2018

@ramya-rao-a
Copy link
Member

left a comment

Thanks @mathdeziel. We are currently at the end of the testing phase for the current iteration. So, I'll merge this sometime next week for the next iteration.

Note to anyone else: Please dont merge this PR until the release branch for 1.26 has been cut

@VictorMazilu

This comment has been minimized.

Copy link

commented Aug 3, 2018

@ramya-rao-a ramya-rao-a merged commit f8420b4 into microsoft:master Aug 5, 2018

2 checks passed

VSTS: VS Code 20180803.32 succeeded
Details
license/cla All CLA requirements met.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.