Skip to content

feat(language-service): view template typecheck block #39974

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

Closed
wants to merge 6 commits into from

Conversation

ayazhafiz
Copy link
Contributor

This patch adds an API to retrieve the template typecheck block for a
template (if any) at a file location, and a selection of the TS node
in the TCB corresponding to the template node at which the request for
a TCB was made (if any).

Probably not something we want to land soon, but a useful debugging tool
for folks working with TCBs.

@ayazhafiz ayazhafiz requested review from atscott and zarend December 4, 2020 16:42
@google-cla google-cla bot added the cla: yes label Dec 4, 2020
ayazhafiz added a commit to ayazhafiz/vscode-ng-language-service that referenced this pull request Dec 4, 2020
This patch adds a command to retrieve and display the typecheck block
for a template under the user's active selection (if any), and
highlights the span of the node(s) in the typecheck block that
correspond to the template node under the user's active selection (if
any). The typecheck block is made available via a dedicated text
document provider that queries fresh typecheck block content whenever
the `getTemplateTcb` command is invoked.

Probably not something we want to land soon, but a useful debugging tool
for folks working with TCBs.

See also angular/angular#39974, which provides
the language service implementations needed for this feature.
@mhevery mhevery added the area: compiler Issues related to `ngc`, Angular's template compiler label Dec 9, 2020
@ngbot ngbot bot added this to the Backlog milestone Dec 9, 2020
@atscott atscott requested a review from kyliau January 19, 2021 18:22
@atscott atscott added action: review The PR is still awaiting reviews from at least one requested reviewer target: minor This PR is targeted for the next minor release area: language-service Issues related to Angular's VS Code language service labels Jan 19, 2021
@ayazhafiz
Copy link
Contributor Author

@atscott @kyliau apologies for my delayed response. Is this something that we would like to land?

@kyliau
Copy link
Contributor

kyliau commented Jan 20, 2021

@ayazhafiz Yeah, we are releasing Ivy LS today. After that we would like to move on to next set of features, like view TCB. Are you available in the coming weeks to work on this? If not @atscott could help land the PR.

@ayazhafiz
Copy link
Contributor Author

@ayazhafiz Yeah, we are releasing Ivy LS today. After that we would like to move on to next set of features, like view TCB. Are you available in the coming weeks to work on this? If not @atscott could help land the PR.

Yeah, I can land this one. Just wasn't sure if this was a feature the team wanted to release. Going through the comments right now.

This patch adds an API to retrieve the template typecheck block for a
template (if any) at a file location, and a selection of the TS node
in the TCB corresponding to the template node at which the request for
a TCB was made (if any).

Probably not something we want to land soon, but a useful debugging tool
for folks working with TCBs.
@ayazhafiz ayazhafiz requested review from kyliau and atscott January 20, 2021 19:07
@ayazhafiz ayazhafiz marked this pull request as ready for review January 20, 2021 19:07
@kyliau kyliau added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Jan 21, 2021
@ayazhafiz ayazhafiz requested a review from kyliau January 21, 2021 18:29
@ayazhafiz ayazhafiz requested a review from atscott January 21, 2021 18:56

return {
fileName: sf.fileName,
content: sf.text,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Do you remember the difference between .text and .getText()? I think one is normalized (line endings etc) and the other is not, but I don't remember which is which. If we are calling getEnd() and getStart(), we should probably also call getText() here to be consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Neither is normalizing; text gets the raw text and getText (like getEnd and getStart) performs some assertions that the positions of the source file are not synthetic. Changed accordingly.

@ayazhafiz ayazhafiz requested a review from kyliau January 21, 2021 19:11

return {
fileName: sf.fileName,
content: sf.getFullText(),
Copy link
Contributor

Choose a reason for hiding this comment

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

for context, I was referring to offset bugs due to differences between .getText() and .text:

// node.text returns the TS internal representation of the normalized text,
// and all CR characters are stripped. node.getText() returns the raw text.
this.source = templateNode.getText().slice(1, -1); // strip leading and trailing quotes

Copy link
Contributor Author

@ayazhafiz ayazhafiz Jan 21, 2021

Choose a reason for hiding this comment

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

🤦 you're right.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ayazhafiz ayazhafiz added action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Jan 21, 2021
ayazhafiz added a commit to ayazhafiz/vscode-ng-language-service that referenced this pull request Jan 28, 2021
This patch adds a command to retrieve and display the typecheck block
for a template under the user's active selection (if any), and
highlights the span of the node(s) in the typecheck block that
correspond to the template node under the user's active selection (if
any). The typecheck block is made available via a dedicated text
document provider that queries fresh typecheck block content whenever
the `getTemplateTcb` command is invoked.

Probably not something we want to land soon, but a useful debugging tool
for folks working with TCBs.

See also angular/angular#39974, which provides
the language service implementations needed for this feature.
ayazhafiz added a commit to ayazhafiz/vscode-ng-language-service that referenced this pull request Jan 28, 2021
This patch adds a command to retrieve and display the typecheck block
for a template under the user's active selections (if any), and
highlights the span of the node(s) in the typecheck block that
correspond to the template node under the user's active selection (if
any). The typecheck block is made available via a dedicated text
document provider that queries fresh typecheck block content whenever
the `getTemplateTcb` command is invoked.

See also angular/angular#39974, which provides
the language service implementations needed for this feature.
kyliau pushed a commit to kyliau/vscode-ng-language-service that referenced this pull request Feb 11, 2021
This patch adds a command to retrieve and display the typecheck block
for a template under the user's active selections (if any), and
highlights the span of the node(s) in the typecheck block that
correspond to the template node under the user's active selection (if
any). The typecheck block is made available via a dedicated text
document provider that queries fresh typecheck block content whenever
the `getTemplateTcb` command is invoked.

See also angular/angular#39974, which provides
the language service implementations needed for this feature.
kyliau pushed a commit to kyliau/vscode-ng-language-service that referenced this pull request Feb 11, 2021
This patch adds a command to retrieve and display the typecheck block
for a template under the user's active selections (if any), and
highlights the span of the node(s) in the typecheck block that
correspond to the template node under the user's active selection (if
any). The typecheck block is made available via a dedicated text
document provider that queries fresh typecheck block content whenever
the `getTemplateTcb` command is invoked.

See also angular/angular#39974, which provides
the language service implementations needed for this feature.
kyliau pushed a commit to ayazhafiz/vscode-ng-language-service that referenced this pull request Feb 11, 2021
This patch adds a command to retrieve and display the typecheck block
for a template under the user's active selections (if any), and
highlights the span of the node(s) in the typecheck block that
correspond to the template node under the user's active selection (if
any). The typecheck block is made available via a dedicated text
document provider that queries fresh typecheck block content whenever
the `getTemplateTcb` command is invoked.

See also angular/angular#39974, which provides
the language service implementations needed for this feature.
kyliau pushed a commit to ayazhafiz/vscode-ng-language-service that referenced this pull request Feb 11, 2021
This patch adds a command to retrieve and display the typecheck block
for a template under the user's active selections (if any), and
highlights the span of the node(s) in the typecheck block that
correspond to the template node under the user's active selection (if
any). The typecheck block is made available via a dedicated text
document provider that queries fresh typecheck block content whenever
the `getTemplateTcb` command is invoked.

See also angular/angular#39974, which provides
the language service implementations needed for this feature.
kyliau pushed a commit to ayazhafiz/vscode-ng-language-service that referenced this pull request Feb 11, 2021
This patch adds a command to retrieve and display the typecheck block
for a template under the user's active selections (if any), and
highlights the span of the node(s) in the typecheck block that
correspond to the template node under the user's active selection (if
any). The typecheck block is made available via a dedicated text
document provider that queries fresh typecheck block content whenever
the `getTemplateTcb` command is invoked.

See also angular/angular#39974, which provides
the language service implementations needed for this feature.
kyliau pushed a commit to angular/vscode-ng-language-service that referenced this pull request Feb 11, 2021
This patch adds a command to retrieve and display the typecheck block
for a template under the user's active selections (if any), and
highlights the span of the node(s) in the typecheck block that
correspond to the template node under the user's active selection (if
any). The typecheck block is made available via a dedicated text
document provider that queries fresh typecheck block content whenever
the `getTemplateTcb` command is invoked.

See also angular/angular#39974, which provides
the language service implementations needed for this feature.
atscott pushed a commit to atscott/vscode-ng-language-service that referenced this pull request Feb 16, 2021
This patch adds a command to retrieve and display the typecheck block
for a template under the user's active selections (if any), and
highlights the span of the node(s) in the typecheck block that
correspond to the template node under the user's active selection (if
any). The typecheck block is made available via a dedicated text
document provider that queries fresh typecheck block content whenever
the `getTemplateTcb` command is invoked.

See also angular/angular#39974, which provides
the language service implementations needed for this feature.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: compiler Issues related to `ngc`, Angular's template compiler area: language-service Issues related to Angular's VS Code language service cla: yes target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants