- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13.1k
 
Tagged Template Signature Help Support in Language Service #1204
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
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            23 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      1532f72
              
                Initial signature help work for tagged templates.
              
              
                DanielRosenwasser d951388
              
                Merge branch 'master' into taggedSigHelp
              
              
                DanielRosenwasser 0a6dbe3
              
                Merge branch 'master' into taggedSigHelp
              
              
                DanielRosenwasser 15560a8
              
                Stylistic changes/comment fixups.
              
              
                DanielRosenwasser 4bf0239
              
                Merge branch 'master' into taggedSigHelp
              
              
                DanielRosenwasser 64960cf
              
                Got sig help working in the template head.
              
              
                DanielRosenwasser 6f8f79e
              
                Got sig help working in tagged no-sub templates.
              
              
                DanielRosenwasser c79c124
              
                Merge branch 'master' into taggedSigHelp
              
              
                DanielRosenwasser 34087bd
              
                Refactored code, adjusted for residing out of bounds of the template.
              
              
                DanielRosenwasser 0416c6f
              
                Fixed isUnclosedTemplateLiteral to account for new possible inputs.
              
              
                DanielRosenwasser fb91a51
              
                Merge branch 'master' into taggedSigHelp
              
              
                DanielRosenwasser 69f7d39
              
                Fixed template head offsetting.
              
              
                DanielRosenwasser 4e18efd
              
                Tests for signature help on tagged templates with no overloads.
              
              
                DanielRosenwasser dfe7962
              
                Added tests for overloads.
              
              
                DanielRosenwasser 7808238
              
                Merge branch 'master' into taggedSigHelp
              
              
                DanielRosenwasser 513a8c3
              
                Fixed broken test.
              
              
                DanielRosenwasser b98f6b4
              
                Paramter -> Parameter
              
              
                DanielRosenwasser db69ec1
              
                getCallLikeInvoker -> getInvokedExpression
              
              
                DanielRosenwasser 0404e84
              
                Addressed some CR feedback.
              
              
                DanielRosenwasser 7211dfa
              
                Added test.
              
              
                DanielRosenwasser a71c527
              
                Amended comment.
              
              
                DanielRosenwasser 1bbb034
              
                Addressed CR feedback.
              
              
                DanielRosenwasser ad39bdf
              
                Merge branch 'master' into taggedSigHelp
              
              
                DanielRosenwasser File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              Large diffs are not rendered by default.
      
      Oops, something went wrong.
      
    
  
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,17 +1,17 @@ | ||
| /// <reference path='fourslash.ts' /> | ||
| 
     | 
||
| ////var objectLiteral = { n: 5, s: "", f: (a: number, b: string) => "" }; | ||
| ////objectLiteral.f(/*objectLiteral1*/4, /*objectLiteral2*/""); | ||
| 
     | 
||
| goTo.marker('objectLiteral1'); | ||
| verify.signatureHelpCountIs(1); | ||
| verify.currentSignatureParamterCountIs(2); | ||
| verify.currentSignatureHelpIs('f(a: number, b: string): string'); | ||
| 
     | 
||
| verify.currentParameterHelpArgumentNameIs("a"); | ||
| verify.currentParameterSpanIs("a: number"); | ||
| 
     | 
||
| goTo.marker('objectLiteral2'); | ||
| verify.currentSignatureHelpIs('f(a: number, b: string): string'); | ||
| ////objectLiteral.f(/*objectLiteral1*/4, /*objectLiteral2*/""); | ||
| goTo.marker('objectLiteral1'); | ||
| verify.signatureHelpCountIs(1); | ||
| verify.currentSignatureParameterCountIs(2); | ||
| verify.currentSignatureHelpIs('f(a: number, b: string): string'); | ||
| verify.currentParameterHelpArgumentNameIs("a"); | ||
| verify.currentParameterSpanIs("a: number"); | ||
| goTo.marker('objectLiteral2'); | ||
| verify.currentSignatureHelpIs('f(a: number, b: string): string'); | ||
| verify.currentParameterHelpArgumentNameIs("b"); | ||
| verify.currentParameterSpanIs("b: string"); | 
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| /// <reference path='fourslash.ts' /> | ||
| 
     | 
||
| //// function f(templateStrings, x, y, z) { return 10; } | ||
| //// function g(templateStrings, x, y, z) { return ""; } | ||
| //// | ||
| //// f `/*1*/ qwe/*2*/rty /*3*/$/*4*/{ 123 }/*5*/ as/*6*/df /*7*/$/*8*/{ 41234 }/*9*/ zxc/*10*/vb /*11*/$/*12*/{ g ` ` }/*13*/ /*14*/ /*15*/` | ||
| 
     | 
||
| test.markers().forEach(m => { | ||
| goTo.position(m.position); | ||
| 
     | 
||
| verify.signatureHelpCountIs(1); | ||
| verify.signatureHelpArgumentCountIs(4); | ||
| 
     | 
||
| verify.currentSignatureParameterCountIs(4); | ||
| verify.currentSignatureHelpIs('f(templateStrings: any, x: any, y: any, z: any): number'); | ||
| verify.currentParameterHelpArgumentNameIs("templateStrings"); | ||
| verify.currentParameterSpanIs("templateStrings: any"); | ||
| }); | 
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| /// <reference path='fourslash.ts' /> | ||
| 
     | 
||
| //// function f(templateStrings, x, y, z) { return 10; } | ||
| //// function g(templateStrings, x, y, z) { return ""; } | ||
| //// | ||
| //// f `/*1*/ qwe/*2*/rty /*3*/$/*4*/{ 123 }/*5*/ as/*6*/df /*7*/$/*8*/{ 41234 }/*9*/ zxc/*10*/vb /*11*/$/*12*/{ g ` ` }/*13*/ /*14*/ /*15*/ | ||
| 
     | 
||
| test.markers().forEach(m => { | ||
| goTo.position(m.position); | ||
| 
     | 
||
| verify.signatureHelpCountIs(1); | ||
| verify.signatureHelpArgumentCountIs(4); | ||
| 
     | 
||
| verify.currentSignatureParameterCountIs(4); | ||
| verify.currentSignatureHelpIs('f(templateStrings: any, x: any, y: any, z: any): number'); | ||
| verify.currentParameterHelpArgumentNameIs("templateStrings"); | ||
| verify.currentParameterSpanIs("templateStrings: any"); | ||
| }); | 
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| /// <reference path='fourslash.ts' /> | ||
| 
     | 
||
| //// function f(templateStrings, x, y, z) { return 10; } | ||
| //// function g(templateStrings, x, y, z) { return ""; } | ||
| //// | ||
| //// f ` qwerty ${/*1*/ /*2*/123/*3*/ /*4*/} asdf ${ 41234 } zxcvb ${ g ` ` } ` | ||
| 
     | 
||
| test.markers().forEach(m => { | ||
| goTo.position(m.position); | ||
| 
     | 
||
| verify.signatureHelpCountIs(1); | ||
| verify.signatureHelpArgumentCountIs(4); | ||
| 
     | 
||
| verify.currentSignatureParameterCountIs(4); | ||
| verify.currentSignatureHelpIs('f(templateStrings: any, x: any, y: any, z: any): number'); | ||
| verify.currentParameterHelpArgumentNameIs("x"); | ||
| verify.currentParameterSpanIs("x: any"); | ||
| }); | 
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| /// <reference path='fourslash.ts' /> | ||
| 
     | 
||
| //// function f(templateStrings, x, y, z) { return 10; } | ||
| //// function g(templateStrings, x, y, z) { return ""; } | ||
| //// | ||
| //// f ` qwerty ${ 123 } asdf ${/*1*/ /*2*/ /*3*/41/*4*/234/*5*/ /*6*/} zxcvb ${ g ` ` } ` | ||
| 
     | 
||
| test.markers().forEach(m => { | ||
| goTo.position(m.position); | ||
| 
     | 
||
| verify.signatureHelpCountIs(1); | ||
| verify.signatureHelpArgumentCountIs(4); | ||
| 
     | 
||
| verify.currentSignatureParameterCountIs(4); | ||
| verify.currentSignatureHelpIs('f(templateStrings: any, x: any, y: any, z: any): number'); | ||
| verify.currentParameterHelpArgumentNameIs("y"); | ||
| verify.currentParameterSpanIs("y: any"); | ||
| }); | 
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| /// <reference path='fourslash.ts' /> | ||
| 
     | 
||
| //// function f(templateStrings, x, y, z) { return 10; } | ||
| //// function g(templateStrings, x, y, z) { return ""; } | ||
| //// | ||
| //// f ` qwerty ${ 123 } asdf ${ 41234 } zxcvb ${/*1*/ /*2*/g/*3*/ /*4*/` `/*5*/ /*6*/} ` | ||
| 
     | 
||
| test.markers().forEach(m => { | ||
| goTo.position(m.position); | ||
| 
     | 
||
| verify.signatureHelpCountIs(1); | ||
| verify.signatureHelpArgumentCountIs(4); | ||
| 
     | 
||
| verify.currentSignatureParameterCountIs(4); | ||
| verify.currentSignatureHelpIs('f(templateStrings: any, x: any, y: any, z: any): number'); | ||
| verify.currentParameterHelpArgumentNameIs("z"); | ||
| verify.currentParameterSpanIs("z: any"); | ||
| }); | 
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| /// <reference path='fourslash.ts' /> | ||
| 
     | 
||
| //// function f(templateStrings, x, y, z) { return 10; } | ||
| //// function g(templateStrings, x, y, z) { return ""; } | ||
| //// | ||
| //// f ` qwerty ${ 123 } asdf ${ 41234 } zxcvb ${ g `/*1*/ /*2*/ /*3*/` } ` | ||
| 
     | 
||
| test.markers().forEach(m => { | ||
| goTo.position(m.position); | ||
| 
     | 
||
| verify.signatureHelpCountIs(1); | ||
| verify.signatureHelpArgumentCountIs(1); | ||
| 
     | 
||
| verify.currentSignatureParameterCountIs(4); | ||
| verify.currentSignatureHelpIs('g(templateStrings: any, x: any, y: any, z: any): string'); | ||
| verify.currentParameterHelpArgumentNameIs("templateStrings"); | ||
| verify.currentParameterSpanIs("templateStrings: any"); | ||
| }); | 
      
      Oops, something went wrong.
        
    
  
  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.
  
    
  
    
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.
What you mean unclosed in this context?
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.
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!