File tree Expand file tree Collapse file tree 4 files changed +51
-7
lines changed
tests/cases/fourslash/server Expand file tree Collapse file tree 4 files changed +51
-7
lines changed Original file line number Diff line number Diff line change @@ -428,7 +428,35 @@ module ts.server {
428428 }
429429
430430 getSignatureHelpItems ( fileName : string , position : number ) : SignatureHelpItems {
431- throw new Error ( "Not Implemented Yet." ) ;
431+ var lineOffset = this . positionToOneBasedLineOffset ( fileName , position ) ;
432+ var args : protocol . SignatureHelpRequestArgs = {
433+ file : fileName ,
434+ line : lineOffset . line ,
435+ offset : lineOffset . offset
436+ } ;
437+
438+ var request = this . processRequest < protocol . SignatureHelpRequest > ( CommandNames . SignatureHelp , args ) ;
439+ var response = this . processResponse < protocol . SignatureHelpResponse > ( request ) ;
440+
441+ if ( ! response . body ) {
442+ return undefined ;
443+ }
444+ var helpItems : protocol . SignatureHelpItems = response . body ;
445+ var span = helpItems . applicableSpan ;
446+ var start = this . lineOffsetToPosition ( fileName , span . start ) ;
447+ var end = this . lineOffsetToPosition ( fileName , span . end ) ;
448+
449+ var result : SignatureHelpItems = {
450+ items : helpItems . items ,
451+ applicableSpan : {
452+ start : start ,
453+ length : end - start
454+ } ,
455+ selectedItemIndex : helpItems . selectedItemIndex ,
456+ argumentIndex : helpItems . argumentIndex ,
457+ argumentCount : helpItems . argumentCount ,
458+ }
459+ return result ;
432460 }
433461
434462 getOccurrencesAtPosition ( fileName : string , position : number ) : ReferenceEntry [ ] {
Original file line number Diff line number Diff line change @@ -644,7 +644,7 @@ declare module ts.server.protocol {
644644 separatorDisplayParts : SymbolDisplayPart [ ] ;
645645
646646 /**
647- * The signatiure helps items for the parameters.
647+ * The signature helps items for the parameters.
648648 */
649649 parameters : SignatureHelpParameter [ ] ;
650650
@@ -655,17 +655,17 @@ declare module ts.server.protocol {
655655 }
656656
657657 /**
658- * Signation help items found in the response of a signature help request.
658+ * Signature help items found in the response of a signature help request.
659659 */
660660 export interface SignatureHelpItems {
661661
662662 /**
663- * The signaure help items.
663+ * The signature help items.
664664 */
665665 items : SignatureHelpItem [ ] ;
666666
667667 /**
668- * @steveluc
668+ * The span for which signature help should appear on a signature
669669 */
670670 applicableSpan : TextSpan ;
671671
@@ -680,7 +680,7 @@ declare module ts.server.protocol {
680680 argumentIndex : number ;
681681
682682 /**
683- * The argument counts
683+ * The argument count
684684 */
685685 argumentCount : number ;
686686 }
Original file line number Diff line number Diff line change @@ -593,7 +593,7 @@ module ts.server {
593593 }
594594
595595 var span = helpItems . applicableSpan ;
596- var result :protocol . SignatureHelpItems = {
596+ var result : protocol . SignatureHelpItems = {
597597 items : helpItems . items ,
598598 applicableSpan : {
599599 start : compilerService . host . positionToLineOffset ( file , span . start ) ,
Original file line number Diff line number Diff line change 1+ /// <reference path="fourslash.ts"/>
2+
3+ ////function foo(data: number) {
4+ //// }
5+ ////
6+ ////function bar {
7+ //// foo(/*1*/)
8+ //// }
9+
10+ goTo . marker ( '1' ) ;
11+ verify . signatureHelpPresent ( ) ;
12+ verify . signatureHelpCountIs ( 1 ) ;
13+ verify . signatureHelpArgumentCountIs ( 0 ) ;
14+
15+ verify . currentSignatureParameterCountIs ( 1 ) ;
16+ verify . currentSignatureHelpDocCommentIs ( '' ) ;
You can’t perform that action at this time.
0 commit comments