-
Notifications
You must be signed in to change notification settings - Fork 26.5k
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
Conversation
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 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.
f69b858
to
d3a0b27
Compare
|
||
return { | ||
fileName: sf.fileName, | ||
content: sf.text, |
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.
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.
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.
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.
|
||
return { | ||
fileName: sf.fileName, | ||
content: sf.getFullText(), |
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.
for context, I was referring to offset bugs due to differences between .getText()
and .text
:
angular/packages/language-service/src/template.ts
Lines 103 to 105 in 69385f7
// 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 |
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.
🤦 you're right.
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.
But possibly that comment is wrong: https://github.com/microsoft/TypeScript/blob/2f47527b99028d969ea90352a13dffc005a50a7d/src/services/services.ts#L47-L88
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.
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.
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.
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.
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.
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.
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.
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.
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.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
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.