@@ -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, offset , file : fileName } : protocol . FileLocationRequestArgs ) : protocol . FileSpan [ ] {
266+ getDefinition ( line : number , offset : number , fileName : string ) : 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, offset , file : fileName } : protocol . FileLocationRequestArgs ) : protocol . OccurrencesResponseItem [ ] {
288+ getOccurrences ( line : number , offset : number , fileName : string ) : 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, offset, file : fileName , findInComments, findInStrings } : protocol . RenameRequestArgs ) : protocol . RenameResponseBody {
318+ getRenameLocations ( line : number , offset : number , fileName : string , findInComments : boolean , findInStrings : boolean ) : 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, offset , file : fileName } : protocol . FileLocationRequestArgs ) : protocol . ReferencesResponseBody {
386+ getReferences ( line : number , offset : number , fileName : string ) : 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 ( { file : fileName } : protocol . OpenRequestArgs ) {
433+ openClientFile ( fileName : string ) {
434434 var file = ts . normalizePath ( fileName ) ;
435435 this . projectService . openClientFile ( file ) ;
436436 }
437437
438- getQuickInfo ( { line, offset , file : fileName } : protocol . FileLocationRequestArgs ) : protocol . QuickInfoResponseBody {
438+ getQuickInfo ( line : number , offset : number , fileName : string ) : 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, offset, endLine, endOffset , file : fileName } : protocol . FormatRequestArgs ) : protocol . CodeEdit [ ] {
464+ getFormattingEditsForRange ( line : number , offset : number , endLine : number , endOffset : number , fileName : string ) : 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, offset, key , file : fileName } : protocol . FormatOnKeyRequestArgs ) : protocol . CodeEdit [ ] {
491+ getFormattingEditsAfterKeystroke ( line : number , offset : number , key : string , fileName : string ) : 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, offset, prefix , file : fileName } : protocol . CompletionsRequestArgs ) : protocol . CompletionEntry [ ] {
564+ getCompletions ( line : number , offset : number , prefix : string , fileName : string ) : protocol . CompletionEntry [ ] {
565565 if ( ! prefix ) {
566566 prefix = "" ;
567567 }
@@ -587,7 +587,8 @@ module ts.server {
587587 } , [ ] ) . sort ( ( a , b ) => a . name . localeCompare ( b . name ) ) ;
588588 }
589589
590- getCompletionEntryDetails ( { line, offset, entryNames, file : fileName } : protocol . CompletionDetailsRequestArgs ) : protocol . CompletionEntryDetails [ ] {
590+ getCompletionEntryDetails ( line : number , offset : number ,
591+ entryNames : string [ ] , fileName : string ) : protocol . CompletionEntryDetails [ ] {
591592 var file = ts . normalizePath ( fileName ) ;
592593 var project = this . projectService . getProjectForFile ( file ) ;
593594 if ( ! project ) {
@@ -606,20 +607,20 @@ module ts.server {
606607 } , [ ] ) ;
607608 }
608609
609- getSignatureHelpItems ( { line, offset , file : fileName } : protocol . SignatureHelpRequestArgs ) : protocol . SignatureHelpItems {
610+ getSignatureHelpItems ( line : number , offset : number , fileName : string ) : protocol . SignatureHelpItems {
610611 var file = ts . normalizePath ( fileName ) ;
611612 var project = this . projectService . getProjectForFile ( file ) ;
612613 if ( ! project ) {
613614 throw Errors . NoProject ;
614615 }
615-
616+
616617 var compilerService = project . compilerService ;
617618 var position = compilerService . host . lineOffsetToPosition ( file , line , offset ) ;
618619 var helpItems = compilerService . languageService . getSignatureHelpItems ( file , position ) ;
619620 if ( ! helpItems ) {
620621 return undefined ;
621622 }
622-
623+
623624 var span = helpItems . applicableSpan ;
624625 var result : protocol . SignatureHelpItems = {
625626 items : helpItems . items ,
@@ -631,11 +632,11 @@ module ts.server {
631632 argumentIndex : helpItems . argumentIndex ,
632633 argumentCount : helpItems . argumentCount ,
633634 }
634-
635+
635636 return result ;
636637 }
637-
638- getDiagnostics ( { delay, files : fileNames } : protocol . GeterrRequestArgs ) : void {
638+
639+ getDiagnostics ( delay : number , fileNames : string [ ] ) {
639640 var checkList = fileNames . reduce ( ( accum : PendingErrorCheck [ ] , fileName : string ) => {
640641 fileName = ts . normalizePath ( fileName ) ;
641642 var project = this . projectService . getProjectForFile ( fileName ) ;
@@ -646,11 +647,11 @@ module ts.server {
646647 } , [ ] ) ;
647648
648649 if ( checkList . length > 0 ) {
649- this . updateErrorCheck ( checkList , this . changeSeq , ( n ) => n == this . changeSeq , delay )
650+ this . updateErrorCheck ( checkList , this . changeSeq , ( n ) => n == this . changeSeq , delay )
650651 }
651652 }
652653
653- change ( { line, offset, endLine, endOffset, insertString , file : fileName } : protocol . ChangeRequestArgs ) : void {
654+ change ( line : number , offset : number , endLine : number , endOffset : number , insertString : string , fileName : string ) {
654655 var file = ts . normalizePath ( fileName ) ;
655656 var project = this . projectService . getProjectForFile ( file ) ;
656657 if ( project ) {
@@ -665,7 +666,7 @@ module ts.server {
665666 }
666667 }
667668
668- reload ( { file : fileName , tmpfile : tempFileName } : protocol . ReloadRequestArgs , reqSeq = 0 ) : void {
669+ reload ( fileName : string , tempFileName : string , reqSeq = 0 ) {
669670 var file = ts . normalizePath ( fileName ) ;
670671 var tmpfile = ts . normalizePath ( tempFileName ) ;
671672 var project = this . projectService . getProjectForFile ( file ) ;
@@ -678,7 +679,7 @@ module ts.server {
678679 }
679680 }
680681
681- saveToTmp ( { file : fileName , tmpfile : tempFileName } : protocol . SavetoRequestArgs ) : void {
682+ saveToTmp ( fileName : string , tempFileName : string ) {
682683 var file = ts . normalizePath ( fileName ) ;
683684 var tmpfile = ts . normalizePath ( tempFileName ) ;
684685
@@ -688,7 +689,7 @@ module ts.server {
688689 }
689690 }
690691
691- closeClientFile ( { file : fileName } : protocol . FileRequestArgs ) {
692+ closeClientFile ( fileName : string ) {
692693 var file = ts . normalizePath ( fileName ) ;
693694 this . projectService . closeClientFile ( file ) ;
694695 }
@@ -712,7 +713,7 @@ module ts.server {
712713 } ) ) ;
713714 }
714715
715- getNavigationBarItems ( { file : fileName } : protocol . FileRequestArgs ) : protocol . NavigationBarItem [ ] {
716+ getNavigationBarItems ( fileName : string ) : protocol . NavigationBarItem [ ] {
716717 var file = ts . normalizePath ( fileName ) ;
717718 var project = this . projectService . getProjectForFile ( file ) ;
718719 if ( ! project ) {
@@ -728,7 +729,7 @@ module ts.server {
728729 return this . decorateNavigationBarItem ( project , fileName , items ) ;
729730 }
730731
731- getNavigateToItems ( { searchValue, file : fileName , maxResultCount } : protocol . NavtoRequestArgs ) : protocol . NavtoItem [ ] {
732+ getNavigateToItems ( searchValue : string , fileName : string , maxResultCount ?: number ) : protocol . NavtoItem [ ] {
732733 var file = ts . normalizePath ( fileName ) ;
733734 var project = this . projectService . getProjectForFile ( file ) ;
734735 if ( ! project ) {
@@ -767,7 +768,7 @@ module ts.server {
767768 } ) ;
768769 }
769770
770- getBraceMatching ( { line, offset , file : fileName } : protocol . FileLocationRequestArgs ) : protocol . TextSpan [ ] {
771+ getBraceMatching ( line : number , offset : number , fileName : string ) : protocol . TextSpan [ ] {
771772 var file = ts . normalizePath ( fileName ) ;
772773
773774 var project = this . projectService . getProjectForFile ( file ) ;
@@ -809,91 +810,114 @@ module ts.server {
809810 break ;
810811 }
811812 case CommandNames . Definition : {
812- response = this . getDefinition ( < protocol . FileLocationRequestArgs > request . arguments ) ;
813+ var defArgs = < protocol . FileLocationRequestArgs > request . arguments ;
814+ response = this . getDefinition ( defArgs . line , defArgs . offset , defArgs . file ) ;
813815 break ;
814816 }
815817 case CommandNames . References : {
816- response = this . getReferences ( < protocol . FileLocationRequestArgs > request . arguments ) ;
818+ var refArgs = < protocol . FileLocationRequestArgs > request . arguments ;
819+ response = this . getReferences ( refArgs . line , refArgs . offset , refArgs . file ) ;
817820 break ;
818821 }
819822 case CommandNames . Rename : {
820- response = this . getRenameLocations ( < protocol . RenameRequestArgs > request . arguments ) ;
823+ var renameArgs = < protocol . RenameRequestArgs > request . arguments ;
824+ response = this . getRenameLocations ( renameArgs . line , renameArgs . offset , renameArgs . file , renameArgs . findInComments , renameArgs . findInStrings ) ;
821825 break ;
822826 }
823827 case CommandNames . Open : {
824- this . openClientFile ( < protocol . OpenRequestArgs > request . arguments ) ;
828+ var openArgs = < protocol . OpenRequestArgs > request . arguments ;
829+ this . openClientFile ( openArgs . file ) ;
825830 responseRequired = false ;
826831 break ;
827832 }
828833 case CommandNames . Quickinfo : {
829- response = this . getQuickInfo ( < protocol . FileLocationRequestArgs > request . arguments ) ;
834+ var quickinfoArgs = < protocol . FileLocationRequestArgs > request . arguments ;
835+ response = this . getQuickInfo ( quickinfoArgs . line , quickinfoArgs . offset , quickinfoArgs . file ) ;
830836 break ;
831837 }
832838 case CommandNames . Format : {
833- response = this . getFormattingEditsForRange ( < protocol . FormatRequestArgs > request . arguments ) ;
839+ var formatArgs = < protocol . FormatRequestArgs > request . arguments ;
840+ response = this . getFormattingEditsForRange ( formatArgs . line , formatArgs . offset , formatArgs . endLine , formatArgs . endOffset , formatArgs . file ) ;
834841 break ;
835842 }
836843 case CommandNames . Formatonkey : {
837- response = this . getFormattingEditsAfterKeystroke ( < protocol . FormatOnKeyRequestArgs > request . arguments ) ;
844+ var formatOnKeyArgs = < protocol . FormatOnKeyRequestArgs > request . arguments ;
845+ response = this . getFormattingEditsAfterKeystroke ( formatOnKeyArgs . line , formatOnKeyArgs . offset , formatOnKeyArgs . key , formatOnKeyArgs . file ) ;
838846 break ;
839847 }
840848 case CommandNames . Completions : {
841- response = this . getCompletions ( < protocol . CompletionsRequestArgs > request . arguments ) ;
849+ var completionsArgs = < protocol . CompletionsRequestArgs > request . arguments ;
850+ response = this . getCompletions ( completionsArgs . line , completionsArgs . offset , completionsArgs . prefix , completionsArgs . file ) ;
842851 break ;
843852 }
844853 case CommandNames . CompletionDetails : {
845- response = this . getCompletionEntryDetails ( < protocol . CompletionDetailsRequestArgs > request . arguments ) ;
854+ var completionDetailsArgs = < protocol . CompletionDetailsRequestArgs > request . arguments ;
855+ response =
856+ this . getCompletionEntryDetails ( completionDetailsArgs . line , completionDetailsArgs . offset ,
857+ completionDetailsArgs . entryNames , completionDetailsArgs . file ) ;
846858 break ;
847859 }
848860 case CommandNames . SignatureHelp : {
849- response = this . getSignatureHelpItems ( < protocol . SignatureHelpRequestArgs > request . arguments ) ;
861+ var signatureHelpArgs = < protocol . SignatureHelpRequestArgs > request . arguments ;
862+ response = this . getSignatureHelpItems ( signatureHelpArgs . line , signatureHelpArgs . offset , signatureHelpArgs . file ) ;
850863 break ;
851864 }
852865 case CommandNames . Geterr : {
853- this . getDiagnostics ( < protocol . GeterrRequestArgs > request . arguments ) ;
866+ var geterrArgs = < protocol . GeterrRequestArgs > request . arguments ;
867+ response = this . getDiagnostics ( geterrArgs . delay , geterrArgs . files ) ;
854868 responseRequired = false ;
855869 break ;
856870 }
857871 case CommandNames . Change : {
858- this . change ( < protocol . ChangeRequestArgs > request . arguments ) ;
872+ var changeArgs = < protocol . ChangeRequestArgs > request . arguments ;
873+ this . change ( changeArgs . line , changeArgs . offset , changeArgs . endLine , changeArgs . endOffset ,
874+ changeArgs . insertString , changeArgs . file ) ;
859875 responseRequired = false ;
860876 break ;
861877 }
862878 case CommandNames . Configure : {
863- this . projectService . setHostConfiguration ( < protocol . ConfigureRequestArguments > request . arguments ) ;
879+ var configureArgs = < protocol . ConfigureRequestArguments > request . arguments ;
880+ this . projectService . setHostConfiguration ( configureArgs ) ;
864881 this . output ( undefined , CommandNames . Configure , request . seq ) ;
865882 responseRequired = false ;
866883 break ;
867884 }
868885 case CommandNames . Reload : {
869- this . reload ( < protocol . ReloadRequestArgs > request . arguments ) ;
886+ var reloadArgs = < protocol . ReloadRequestArgs > request . arguments ;
887+ this . reload ( reloadArgs . file , reloadArgs . tmpfile , request . seq ) ;
870888 responseRequired = false ;
871889 break ;
872890 }
873891 case CommandNames . Saveto : {
874- this . saveToTmp ( < protocol . SavetoRequestArgs > request . arguments ) ;
892+ var savetoArgs = < protocol . SavetoRequestArgs > request . arguments ;
893+ this . saveToTmp ( savetoArgs . file , savetoArgs . tmpfile ) ;
875894 responseRequired = false ;
876895 break ;
877896 }
878897 case CommandNames . Close : {
879- this . closeClientFile ( < protocol . FileRequestArgs > request . arguments ) ;
898+ var closeArgs = < protocol . FileRequestArgs > request . arguments ;
899+ this . closeClientFile ( closeArgs . file ) ;
880900 responseRequired = false ;
881901 break ;
882902 }
883903 case CommandNames . Navto : {
884- response = this . getNavigateToItems ( < protocol . NavtoRequestArgs > request . arguments ) ;
904+ var navtoArgs = < protocol . NavtoRequestArgs > request . arguments ;
905+ response = this . getNavigateToItems ( navtoArgs . searchValue , navtoArgs . file , navtoArgs . maxResultCount ) ;
885906 break ;
886907 }
887908 case CommandNames . Brace : {
888- response = this . getBraceMatching ( < protocol . FileLocationRequestArgs > request . arguments ) ;
909+ var braceArguments = < protocol . FileLocationRequestArgs > request . arguments ;
910+ response = this . getBraceMatching ( braceArguments . line , braceArguments . offset , braceArguments . file ) ;
889911 break ;
890912 }
891913 case CommandNames . NavBar : {
892- response = this . getNavigationBarItems ( < protocol . FileRequestArgs > request . arguments ) ;
914+ var navBarArgs = < protocol . FileRequestArgs > request . arguments ;
915+ response = this . getNavigationBarItems ( navBarArgs . file ) ;
893916 break ;
894917 }
895918 case CommandNames . Occurrences : {
896- response = this . getOccurrences ( < protocol . FileLocationRequestArgs > request . arguments ) ;
919+ var { line, offset, file : fileName } = < protocol . FileLocationRequestArgs > request . arguments ;
920+ response = this . getOccurrences ( line , offset , fileName ) ;
897921 break ;
898922 }
899923 default : {
0 commit comments