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

Add autoCloseTag language service #24543

Merged
2 commits merged into from
Jun 4, 2018
Merged

Add autoCloseTag language service #24543

2 commits merged into from
Jun 4, 2018

Conversation

ghost
Copy link

@ghost ghost commented May 31, 2018

Fixes #20811

The editor can call this service to get closing text for the current tag, or undefined if not currently in a position to close a tag (or tag already closed).

@ghost ghost force-pushed the autoCloseTag branch from 1bb95bf to f76f10b Compare June 1, 2018 15:17
@@ -2051,6 +2051,18 @@ namespace ts {
return true;
}

function getAutoCloseTagAtPosition(fileName: string, position: number): string | undefined {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would make the return type an object with a newText: string property to allow us to add more info as we need in the future.

@@ -323,6 +323,7 @@ namespace ts {
getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion | undefined;

isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean;
getAutoCloseTagAtPosition(fileName: string, position: number): string | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would rather this had JSX in the name.. like getJSXClosingTagAtPosition also we need to add a comment on it when it should be called.

@ghost ghost force-pushed the autoCloseTag branch from 4d18f93 to f7247f7 Compare June 1, 2018 17:35
@ghost ghost merged commit 886377f into master Jun 4, 2018
@ghost ghost deleted the autoCloseTag branch June 4, 2018 17:08
@ghost ghost mentioned this pull request Jun 7, 2018
@microsoft microsoft locked and limited conversation to collaborators Aug 3, 2018
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JSX tag autoclosing TSServer API
1 participant