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: add new parser events and rename 'onTagName' to 'onOpenTagName'. #114

Merged
merged 1 commit into from
Jun 21, 2022

Conversation

DylanPiercey
Copy link
Contributor

Description

Instead of </div> being processed in the single onCloseTag event it is broken into the following segments

onCloseTagStart

</

onCloseTagName

div

onCloseTagStart

>

For consistency, the onTagName event was renamed to onOpenTagName and a new onOpenTagStart even was added which matches the open < bracket.

Note:

onOpenTagStart, onCloseTagStart & onCloseTagName are exclusively called for html mode tags.
All of the other events are called for concise tags as well. Eg a concise tag will get onCloseTagEnd, which shows where the tags body content stops, but will not get an onCloseTagStart or onCloseTagName.

Motivation and Context

While working on the language server is was discovered that providing completions for the closing tag could be improved if we were to split up it's events so it could be processed earlier.

Screenshots (if appropriate):

Checklist:

  • I have updated/added documentation affected by my changes.
  • I have added tests to cover my changes.

@changeset-bot
Copy link

changeset-bot bot commented Jun 21, 2022

🦋 Changeset detected

Latest commit: bc94daa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
htmljs-parser Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link

codecov bot commented Jun 21, 2022

Codecov Report

Merging #114 (bc94daa) into main (b79698c) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #114      +/-   ##
==========================================
+ Coverage   93.26%   93.29%   +0.02%     
==========================================
  Files          26       26              
  Lines         713      716       +3     
  Branches      244      247       +3     
==========================================
+ Hits          665      668       +3     
  Misses         32       32              
  Partials       16       16              
Impacted Files Coverage Δ
src/states/CLOSE_TAG.ts 87.50% <ø> (ø)
src/util/constants.ts 100.00% <ø> (ø)
src/core/Parser.ts 91.30% <100.00%> (+0.09%) ⬆️
src/states/CONCISE_HTML_CONTENT.ts 91.48% <100.00%> (ø)
src/states/HTML_CONTENT.ts 96.29% <100.00%> (+0.29%) ⬆️
src/states/TAG_NAME.ts 100.00% <100.00%> (ø)
src/util/util.ts 85.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b79698c...bc94daa. Read the comment docs.

@DylanPiercey DylanPiercey merged commit 14f3499 into main Jun 21, 2022
@DylanPiercey DylanPiercey deleted the new-parser-events branch June 21, 2022 22:33
@github-actions github-actions bot mentioned this pull request Jun 21, 2022
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.

1 participant