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(language-service): view template typecheck block #39974

Closed
wants to merge 6 commits into from

Conversation

@ayazhafiz
Copy link
Contributor

@ayazhafiz ayazhafiz commented Dec 4, 2020

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 Dec 4, 2020
@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.
@ngbot ngbot bot added this to the Backlog milestone Dec 9, 2020
packages/language-service/ivy/language_service.ts Outdated Show resolved Hide resolved
packages/language-service/ivy/language_service.ts Outdated Show resolved Hide resolved
packages/language-service/ivy/language_service.ts Outdated Show resolved Hide resolved
packages/language-service/ivy/language_service.ts Outdated Show resolved Hide resolved
packages/language-service/ivy/test/gettcb_spec.ts Outdated Show resolved Hide resolved
packages/language-service/ivy/test/gettcb_spec.ts Outdated Show resolved Hide resolved
packages/language-service/ivy/test/gettcb_spec.ts Outdated Show resolved Hide resolved
packages/language-service/ivy/ts_plugin.ts Outdated Show resolved Hide resolved
@ayazhafiz
Copy link
Contributor Author

@ayazhafiz ayazhafiz commented Jan 20, 2021

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

@kyliau
Copy link
Member

@kyliau 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 ayazhafiz 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.

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 Jan 20, 2021
@ayazhafiz ayazhafiz marked this pull request as ready for review Jan 20, 2021
@ayazhafiz ayazhafiz force-pushed the ayazhafiz:e/ls-getTcb2 branch from f69b858 to d3a0b27 Jan 20, 2021
@ayazhafiz ayazhafiz requested a review from kyliau Jan 21, 2021
@ayazhafiz ayazhafiz requested a review from atscott Jan 21, 2021
@kyliau
kyliau approved these changes Jan 21, 2021
packages/language-service/ivy/language_service.ts Outdated Show resolved Hide resolved

return {
fileName: sf.fileName,
content: sf.text,

This comment has been minimized.

@kyliau

kyliau Jan 21, 2021
Member

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.

This comment has been minimized.

@ayazhafiz

ayazhafiz Jan 21, 2021
Author Contributor

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 Jan 21, 2021

return {
fileName: sf.fileName,
content: sf.getFullText(),

This comment has been minimized.

@kyliau

kyliau Jan 21, 2021
Member

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

This comment has been minimized.

@ayazhafiz

ayazhafiz Jan 21, 2021
Author Contributor

🤦 you're right.

@kyliau
kyliau approved these changes Jan 21, 2021
@ayazhafiz ayazhafiz removed request for atscott and zarend 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 added 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 added 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 added 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 added 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 added 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 added 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 added 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

@angular-automatic-lock-bot angular-automatic-lock-bot bot commented Feb 21, 2021

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.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants