-
Notifications
You must be signed in to change notification settings - Fork 24
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
Add HTML Element close tag auto-insertion support #501
Conversation
732d9a4
to
79b4815
Compare
} | ||
return null; | ||
const results = this.providers.map((provider) => provider.onTypeFormatting(document, params)); | ||
return results.find((result) => result !== null) ?? null; |
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 I'm doing here is turning this provider into a meta provider like the other ones. I did everything inline for this feature before and I'm rearchitecting to make this like everything else.
...nguage-server-common/src/formatting/providers/BracketsAutoclosingOnTypeFormattingProvider.ts
Show resolved
Hide resolved
...e-server-common/src/formatting/providers/BracketsAutoclosingOnTypeFormattingProvider.spec.ts
Show resolved
Hide resolved
...age-server-common/src/formatting/providers/HtmlElementAutoclosingOnTypeFormattingProvider.ts
Outdated
Show resolved
Hide resolved
a9bc589
to
f05c362
Compare
f05c362
to
c9068e6
Compare
e9e3c9d
to
0257da5
Compare
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.
🎩 went well! Just a couple of nits that can be ignored if you want
The feature's TL;DR:
html-end-auto-insert.mp4
>
to close an HTML element, get the</$tagName>
for free.enter
in the middle of a closed tag and get the correct level of indentationenter-ux.mp4
Fun exceptions we support
What are you adding in this PR?
OnTypeFormattingProvider
for extensibilityunclosed
node information on LiquidHTMLASTParsingErrorsHow it works
Language Client makes server->client
textDocument/onTypeFormatting
requests when the user types the>
characterdocument.ast
is aLiquidHTMLASTParsingError
that says one of:</$tag>
at the cursor positionwindow/showDocument
server->client request to place the cursor in the right location.When the stars are not aligned, we do nothing.
What did you learn?
window/showDocument
server->client request accepts aselection
parameter which makes it possible to move the cursor back to after the>
after inserting the</$tagname>
.Before you deploy
changeset