@@ -118,7 +118,7 @@ module ts.server {
118118
119119 constructor ( private host : ServerHost , private logger : Logger ) {
120120 this . projectService =
121- new ProjectService ( host , logger , ( eventName , project , fileName ) => {
121+ new ProjectService ( host , logger , ( eventName , project , fileName ) => {
122122 this . handleEvent ( eventName , project , fileName ) ;
123123 } ) ;
124124 }
@@ -263,7 +263,7 @@ module ts.server {
263263 }
264264 }
265265
266- getDefinition ( line : number , offset : number , fileName : string ) : protocol . FileSpan [ ] {
266+ getDefinition ( { line , offset, file : fileName } : protocol . FileLocationRequestArgs ) : protocol . FileSpan [ ] {
267267 var file = ts . normalizePath ( fileName ) ;
268268 var project = this . projectService . getProjectForFile ( file ) ;
269269 if ( ! project ) {
@@ -285,7 +285,7 @@ module ts.server {
285285 } ) ) ;
286286 }
287287
288- getOccurrences ( line : number , offset : number , fileName : string ) : protocol . OccurrencesResponseItem [ ] {
288+ getOccurrences ( { line , offset, file : fileName } : protocol . FileLocationRequestArgs ) : protocol . OccurrencesResponseItem [ ] {
289289 fileName = ts . normalizePath ( fileName ) ;
290290 let project = this . projectService . getProjectForFile ( fileName ) ;
291291
@@ -315,7 +315,7 @@ module ts.server {
315315 } ) ;
316316 }
317317
318- getRenameLocations ( line : number , offset : number , fileName : string , findInComments : boolean , findInStrings : boolean ) : protocol . RenameResponseBody {
318+ getRenameLocations ( { line, offset, file : fileName , findInComments , findInStrings } : protocol . RenameRequestArgs ) : protocol . RenameResponseBody {
319319 var file = ts . normalizePath ( fileName ) ;
320320 var project = this . projectService . getProjectForFile ( file ) ;
321321 if ( ! project ) {
@@ -383,7 +383,7 @@ module ts.server {
383383 return { info : renameInfo , locs : bakedRenameLocs } ;
384384 }
385385
386- getReferences ( line : number , offset : number , fileName : string ) : protocol . ReferencesResponseBody {
386+ getReferences ( { line , offset, file : fileName } : protocol . FileLocationRequestArgs ) : protocol . ReferencesResponseBody {
387387 // TODO: get all projects for this file; report refs for all projects deleting duplicates
388388 // can avoid duplicates by eliminating same ref file from subsequent projects
389389 var file = ts . normalizePath ( fileName ) ;
@@ -430,12 +430,12 @@ module ts.server {
430430 } ;
431431 }
432432
433- openClientFile ( fileName : string ) {
433+ openClientFile ( { file : fileName } : protocol . OpenRequestArgs ) {
434434 var file = ts . normalizePath ( fileName ) ;
435435 this . projectService . openClientFile ( file ) ;
436436 }
437437
438- getQuickInfo ( line : number , offset : number , fileName : string ) : protocol . QuickInfoResponseBody {
438+ getQuickInfo ( { line , offset, file : fileName } : protocol . FileLocationRequestArgs ) : protocol . QuickInfoResponseBody {
439439 var file = ts . normalizePath ( fileName ) ;
440440 var project = this . projectService . getProjectForFile ( file ) ;
441441 if ( ! project ) {
@@ -461,7 +461,7 @@ module ts.server {
461461 } ;
462462 }
463463
464- getFormattingEditsForRange ( line : number , offset : number , endLine : number , endOffset : number , fileName : string ) : protocol . CodeEdit [ ] {
464+ getFormattingEditsForRange ( { line, offset, endLine, endOffset, file : fileName } : protocol . FormatRequestArgs ) : protocol . CodeEdit [ ] {
465465 var file = ts . normalizePath ( fileName ) ;
466466 var project = this . projectService . getProjectForFile ( file ) ;
467467 if ( ! project ) {
@@ -488,7 +488,7 @@ module ts.server {
488488 } ) ;
489489 }
490490
491- getFormattingEditsAfterKeystroke ( line : number , offset : number , key : string , fileName : string ) : protocol . CodeEdit [ ] {
491+ getFormattingEditsAfterKeystroke ( { line, offset, key, file : fileName } : protocol . FormatOnKeyRequestArgs ) : protocol . CodeEdit [ ] {
492492 var file = ts . normalizePath ( fileName ) ;
493493
494494 var project = this . projectService . getProjectForFile ( file ) ;
@@ -561,7 +561,7 @@ module ts.server {
561561 } ) ;
562562 }
563563
564- getCompletions ( line : number , offset : number , prefix : string , fileName : string ) : protocol . CompletionEntry [ ] {
564+ getCompletions ( { line , offset, prefix, file : fileName } : protocol . CompletionsRequestArgs ) : protocol . CompletionEntry [ ] {
565565 if ( ! prefix ) {
566566 prefix = "" ;
567567 }
@@ -587,8 +587,7 @@ module ts.server {
587587 } , [ ] ) . sort ( ( a , b ) => a . name . localeCompare ( b . name ) ) ;
588588 }
589589
590- getCompletionEntryDetails ( line : number , offset : number ,
591- entryNames : string [ ] , fileName : string ) : protocol . CompletionEntryDetails [ ] {
590+ getCompletionEntryDetails ( { line, offset, entryNames, file : fileName } : protocol . CompletionDetailsRequestArgs ) : protocol . CompletionEntryDetails [ ] {
592591 var file = ts . normalizePath ( fileName ) ;
593592 var project = this . projectService . getProjectForFile ( file ) ;
594593 if ( ! project ) {
@@ -607,20 +606,20 @@ module ts.server {
607606 } , [ ] ) ;
608607 }
609608
610- getSignatureHelpItems ( line : number , offset : number , fileName : string ) : protocol . SignatureHelpItems {
609+ getSignatureHelpItems ( { line , offset, file : fileName } : protocol . SignatureHelpRequestArgs ) : protocol . SignatureHelpItems {
611610 var file = ts . normalizePath ( fileName ) ;
612611 var project = this . projectService . getProjectForFile ( file ) ;
613612 if ( ! project ) {
614613 throw Errors . NoProject ;
615614 }
616-
615+
617616 var compilerService = project . compilerService ;
618617 var position = compilerService . host . lineOffsetToPosition ( file , line , offset ) ;
619618 var helpItems = compilerService . languageService . getSignatureHelpItems ( file , position ) ;
620619 if ( ! helpItems ) {
621620 return undefined ;
622621 }
623-
622+
624623 var span = helpItems . applicableSpan ;
625624 var result : protocol . SignatureHelpItems = {
626625 items : helpItems . items ,
@@ -632,11 +631,11 @@ module ts.server {
632631 argumentIndex : helpItems . argumentIndex ,
633632 argumentCount : helpItems . argumentCount ,
634633 }
635-
634+
636635 return result ;
637636 }
638-
639- getDiagnostics ( delay : number , fileNames : string [ ] ) {
637+
638+ getDiagnostics ( { delay , files : fileNames } : protocol . GeterrRequestArgs ) : void {
640639 var checkList = fileNames . reduce ( ( accum : PendingErrorCheck [ ] , fileName : string ) => {
641640 fileName = ts . normalizePath ( fileName ) ;
642641 var project = this . projectService . getProjectForFile ( fileName ) ;
@@ -647,11 +646,11 @@ module ts.server {
647646 } , [ ] ) ;
648647
649648 if ( checkList . length > 0 ) {
650- this . updateErrorCheck ( checkList , this . changeSeq , ( n ) => n == this . changeSeq , delay )
649+ this . updateErrorCheck ( checkList , this . changeSeq , ( n ) => n == this . changeSeq , delay )
651650 }
652651 }
653652
654- change ( line : number , offset : number , endLine : number , endOffset : number , insertString : string , fileName : string ) {
653+ change ( { line , offset, endLine, endOffset, insertString, file : fileName } : protocol . ChangeRequestArgs ) : void {
655654 var file = ts . normalizePath ( fileName ) ;
656655 var project = this . projectService . getProjectForFile ( file ) ;
657656 if ( project ) {
@@ -666,7 +665,7 @@ module ts.server {
666665 }
667666 }
668667
669- reload ( fileName : string , tempFileName : string , reqSeq = 0 ) {
668+ reload ( { file : fileName , tmpfile : tempFileName } : protocol . ReloadRequestArgs , reqSeq = 0 ) : void {
670669 var file = ts . normalizePath ( fileName ) ;
671670 var tmpfile = ts . normalizePath ( tempFileName ) ;
672671 var project = this . projectService . getProjectForFile ( file ) ;
@@ -679,7 +678,7 @@ module ts.server {
679678 }
680679 }
681680
682- saveToTmp ( fileName : string , tempFileName : string ) {
681+ saveToTmp ( { file : fileName , tmpfile : tempFileName } : protocol . SavetoRequestArgs ) : void {
683682 var file = ts . normalizePath ( fileName ) ;
684683 var tmpfile = ts . normalizePath ( tempFileName ) ;
685684
@@ -689,7 +688,7 @@ module ts.server {
689688 }
690689 }
691690
692- closeClientFile ( fileName : string ) {
691+ closeClientFile ( { file : fileName } : protocol . FileRequestArgs ) {
693692 var file = ts . normalizePath ( fileName ) ;
694693 this . projectService . closeClientFile ( file ) ;
695694 }
@@ -713,7 +712,7 @@ module ts.server {
713712 } ) ) ;
714713 }
715714
716- getNavigationBarItems ( fileName : string ) : protocol . NavigationBarItem [ ] {
715+ getNavigationBarItems ( { file : fileName } : protocol . FileRequestArgs ) : protocol . NavigationBarItem [ ] {
717716 var file = ts . normalizePath ( fileName ) ;
718717 var project = this . projectService . getProjectForFile ( file ) ;
719718 if ( ! project ) {
@@ -729,7 +728,7 @@ module ts.server {
729728 return this . decorateNavigationBarItem ( project , fileName , items ) ;
730729 }
731730
732- getNavigateToItems ( searchValue : string , fileName : string , maxResultCount ?: number ) : protocol . NavtoItem [ ] {
731+ getNavigateToItems ( { searchValue , file : fileName , maxResultCount } : protocol . NavtoRequestArgs ) : protocol . NavtoItem [ ] {
733732 var file = ts . normalizePath ( fileName ) ;
734733 var project = this . projectService . getProjectForFile ( file ) ;
735734 if ( ! project ) {
@@ -768,7 +767,7 @@ module ts.server {
768767 } ) ;
769768 }
770769
771- getBraceMatching ( line : number , offset : number , fileName : string ) : protocol . TextSpan [ ] {
770+ getBraceMatching ( { line , offset, file : fileName } : protocol . FileLocationRequestArgs ) : protocol . TextSpan [ ] {
772771 var file = ts . normalizePath ( fileName ) ;
773772
774773 var project = this . projectService . getProjectForFile ( file ) ;
@@ -810,114 +809,91 @@ module ts.server {
810809 break ;
811810 }
812811 case CommandNames . Definition : {
813- var defArgs = < protocol . FileLocationRequestArgs > request . arguments ;
814- response = this . getDefinition ( defArgs . line , defArgs . offset , defArgs . file ) ;
812+ response = this . getDefinition ( < protocol . FileLocationRequestArgs > request . arguments ) ;
815813 break ;
816814 }
817815 case CommandNames . References : {
818- var refArgs = < protocol . FileLocationRequestArgs > request . arguments ;
819- response = this . getReferences ( refArgs . line , refArgs . offset , refArgs . file ) ;
816+ response = this . getReferences ( < protocol . FileLocationRequestArgs > request . arguments ) ;
820817 break ;
821818 }
822819 case CommandNames . Rename : {
823- var renameArgs = < protocol . RenameRequestArgs > request . arguments ;
824- response = this . getRenameLocations ( renameArgs . line , renameArgs . offset , renameArgs . file , renameArgs . findInComments , renameArgs . findInStrings ) ;
820+ response = this . getRenameLocations ( < protocol . RenameRequestArgs > request . arguments ) ;
825821 break ;
826822 }
827823 case CommandNames . Open : {
828- var openArgs = < protocol . OpenRequestArgs > request . arguments ;
829- this . openClientFile ( openArgs . file ) ;
824+ this . openClientFile ( < protocol . OpenRequestArgs > request . arguments ) ;
830825 responseRequired = false ;
831826 break ;
832827 }
833828 case CommandNames . Quickinfo : {
834- var quickinfoArgs = < protocol . FileLocationRequestArgs > request . arguments ;
835- response = this . getQuickInfo ( quickinfoArgs . line , quickinfoArgs . offset , quickinfoArgs . file ) ;
829+ response = this . getQuickInfo ( < protocol . FileLocationRequestArgs > request . arguments ) ;
836830 break ;
837831 }
838832 case CommandNames . Format : {
839- var formatArgs = < protocol . FormatRequestArgs > request . arguments ;
840- response = this . getFormattingEditsForRange ( formatArgs . line , formatArgs . offset , formatArgs . endLine , formatArgs . endOffset , formatArgs . file ) ;
833+ response = this . getFormattingEditsForRange ( < protocol . FormatRequestArgs > request . arguments ) ;
841834 break ;
842835 }
843836 case CommandNames . Formatonkey : {
844- var formatOnKeyArgs = < protocol . FormatOnKeyRequestArgs > request . arguments ;
845- response = this . getFormattingEditsAfterKeystroke ( formatOnKeyArgs . line , formatOnKeyArgs . offset , formatOnKeyArgs . key , formatOnKeyArgs . file ) ;
837+ response = this . getFormattingEditsAfterKeystroke ( < protocol . FormatOnKeyRequestArgs > request . arguments ) ;
846838 break ;
847839 }
848840 case CommandNames . Completions : {
849- var completionsArgs = < protocol . CompletionsRequestArgs > request . arguments ;
850- response = this . getCompletions ( completionsArgs . line , completionsArgs . offset , completionsArgs . prefix , completionsArgs . file ) ;
841+ response = this . getCompletions ( < protocol . CompletionsRequestArgs > request . arguments ) ;
851842 break ;
852843 }
853844 case CommandNames . CompletionDetails : {
854- var completionDetailsArgs = < protocol . CompletionDetailsRequestArgs > request . arguments ;
855- response =
856- this . getCompletionEntryDetails ( completionDetailsArgs . line , completionDetailsArgs . offset ,
857- completionDetailsArgs . entryNames , completionDetailsArgs . file ) ;
845+ response = this . getCompletionEntryDetails ( < protocol . CompletionDetailsRequestArgs > request . arguments ) ;
858846 break ;
859847 }
860848 case CommandNames . SignatureHelp : {
861- var signatureHelpArgs = < protocol . SignatureHelpRequestArgs > request . arguments ;
862- response = this . getSignatureHelpItems ( signatureHelpArgs . line , signatureHelpArgs . offset , signatureHelpArgs . file ) ;
849+ response = this . getSignatureHelpItems ( < protocol . SignatureHelpRequestArgs > request . arguments ) ;
863850 break ;
864851 }
865852 case CommandNames . Geterr : {
866- var geterrArgs = < protocol . GeterrRequestArgs > request . arguments ;
867- response = this . getDiagnostics ( geterrArgs . delay , geterrArgs . files ) ;
853+ this . getDiagnostics ( < protocol . GeterrRequestArgs > request . arguments ) ;
868854 responseRequired = false ;
869855 break ;
870856 }
871857 case CommandNames . Change : {
872- var changeArgs = < protocol . ChangeRequestArgs > request . arguments ;
873- this . change ( changeArgs . line , changeArgs . offset , changeArgs . endLine , changeArgs . endOffset ,
874- changeArgs . insertString , changeArgs . file ) ;
858+ this . change ( < protocol . ChangeRequestArgs > request . arguments ) ;
875859 responseRequired = false ;
876860 break ;
877861 }
878862 case CommandNames . Configure : {
879- var configureArgs = < protocol . ConfigureRequestArguments > request . arguments ;
880- this . projectService . setHostConfiguration ( configureArgs ) ;
863+ this . projectService . setHostConfiguration ( < protocol . ConfigureRequestArguments > request . arguments ) ;
881864 this . output ( undefined , CommandNames . Configure , request . seq ) ;
882865 responseRequired = false ;
883866 break ;
884867 }
885868 case CommandNames . Reload : {
886- var reloadArgs = < protocol . ReloadRequestArgs > request . arguments ;
887- this . reload ( reloadArgs . file , reloadArgs . tmpfile , request . seq ) ;
869+ this . reload ( < protocol . ReloadRequestArgs > request . arguments ) ;
888870 responseRequired = false ;
889871 break ;
890872 }
891873 case CommandNames . Saveto : {
892- var savetoArgs = < protocol . SavetoRequestArgs > request . arguments ;
893- this . saveToTmp ( savetoArgs . file , savetoArgs . tmpfile ) ;
874+ this . saveToTmp ( < protocol . SavetoRequestArgs > request . arguments ) ;
894875 responseRequired = false ;
895876 break ;
896877 }
897878 case CommandNames . Close : {
898- var closeArgs = < protocol . FileRequestArgs > request . arguments ;
899- this . closeClientFile ( closeArgs . file ) ;
879+ this . closeClientFile ( < protocol . FileRequestArgs > request . arguments ) ;
900880 responseRequired = false ;
901881 break ;
902882 }
903883 case CommandNames . Navto : {
904- var navtoArgs = < protocol . NavtoRequestArgs > request . arguments ;
905- response = this . getNavigateToItems ( navtoArgs . searchValue , navtoArgs . file , navtoArgs . maxResultCount ) ;
884+ response = this . getNavigateToItems ( < protocol . NavtoRequestArgs > request . arguments ) ;
906885 break ;
907886 }
908887 case CommandNames . Brace : {
909- var braceArguments = < protocol . FileLocationRequestArgs > request . arguments ;
910- response = this . getBraceMatching ( braceArguments . line , braceArguments . offset , braceArguments . file ) ;
888+ response = this . getBraceMatching ( < protocol . FileLocationRequestArgs > request . arguments ) ;
911889 break ;
912890 }
913891 case CommandNames . NavBar : {
914- var navBarArgs = < protocol . FileRequestArgs > request . arguments ;
915- response = this . getNavigationBarItems ( navBarArgs . file ) ;
892+ response = this . getNavigationBarItems ( < protocol . FileRequestArgs > request . arguments ) ;
916893 break ;
917894 }
918895 case CommandNames . Occurrences : {
919- var { line, offset, file : fileName } = < protocol . FileLocationRequestArgs > request . arguments ;
920- response = this . getOccurrences ( line , offset , fileName ) ;
896+ response = this . getOccurrences ( < protocol . FileLocationRequestArgs > request . arguments ) ;
921897 break ;
922898 }
923899 default : {
0 commit comments