JSX tag autoclosing TSServer API #20811
Labels
Domain: Completion Lists
The issue relates to showing completion lists in an editor
Domain: JSX/TSX
Relates to the JSX parser and emitter
Fixed
A PR has been merged for this issue
Suggestion
An idea for TypeScript
VS Code Tracked
There is a VS Code equivalent to this issue
Milestone
Problem
Jsx tag auto-closing is one of VS Code's more requested JS/TS features: microsoft/vscode#34307
As a basic example, typing out:
would auto close to:
We can look into fixing this entirely on the VS Code side, but I think it may be worth adding this feature to the TSServer API so that other editors such as VS can also benefit
Proposed API
Add a new
autoCloseTag
request to the ts server:This request would take a file and a location within the tag to try to auto close. If applicable, it would return a text insertion that auto-closes that tag:
Case 1
<div>
tag.Server returns insertion to create:
Case 2
or
Not result returned. Tag already closed
Case 3
No result returned
Case 4
<p>
tagReturns auto close for
</p>
Case 5
<div>
tag.Returns insertion to add closing tag at end of the text content:
The text was updated successfully, but these errors were encountered: