Repository navigation
Tagged Template Signature Help Support in Language Service - #1204
Merged
Merged
Conversation
Conflicts: src/services/signatureHelp.ts
Member
Author
There was a problem hiding this comment.
"Paramter"
Contributor
There was a problem hiding this comment.
What you mean unclosed in this context?
Member
Author
There was a problem hiding this comment.
I should probably be more explicit - it kind of sounds like I'm referring to a template expression without a template tail. I really mean unterminated, in the sense that your literal isn't explicitly sealed off with a backtick. I'll clarify it. Thanks!
Contributor
There was a problem hiding this comment.
Say that this can be call or new
Contributor
There was a problem hiding this comment.
Also remove else
Contributor
There was a problem hiding this comment.
Maybe just ===
Contributor
|
👍 |
Conflicts: src/services/signatureHelp.ts
Contributor
|
LGTM |
Daniel Rosenwasser (DanielRosenwasser)
added a commit
that referenced
this pull request
Nov 25, 2014
Tagged Template Signature Help Support in Language Service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Signature Help for Tagged Templates
This PR enables signature help support in the language service for tagged template strings.
The idea is that a tagged template is a bit of an implicit function invocation. Whenever a user requests signature help (or it is triggered by the consuming environment), we should figure out what function a tag refers to, which overload should be chosen, and which parameter is currently being fed.
Substitution-Argument Correspondence
When a template expression is tagged, each substitution expression corresponds to an argument in invoking that tag. Specifically, the Nth substitution expression in a tagged template expression is the (N+1)th argument in an invocation.
TemplateStringsArray Argument
Whenever the cursor lies within a template literal (whether a no-substitution literal, or a fragment of a template expression), the parameter in question is the first parameter of the tag in question. This is because each template literal in a tagged template corresponds to an array element in the cooked/raw array object specified in ES6. This means that as the cursor moves through a template expression, parameters will not be highlighted from left-to-right consistently.