@@ -398,7 +398,7 @@ module ts.server {
398398
399399 export class ProjectService {
400400 filenameToScriptInfo : ts . Map < ScriptInfo > = { } ;
401- // open, non-configured root files
401+ // open, non-configured root files
402402 openFileRoots : ScriptInfo [ ] = [ ] ;
403403 // projects built from openFileRoots
404404 inferredProjects : Project [ ] = [ ] ;
@@ -421,7 +421,7 @@ module ts.server {
421421 hostInfo : "Unknown host"
422422 }
423423 }
424-
424+
425425 getFormatCodeOptions ( file ?: string ) {
426426 if ( file ) {
427427 var info = this . filenameToScriptInfo [ file ] ;
@@ -448,7 +448,7 @@ module ts.server {
448448 }
449449 }
450450 }
451-
451+
452452 log ( msg : string , type = "Err" ) {
453453 this . psLogger . msg ( msg , type ) ;
454454 }
@@ -457,17 +457,17 @@ module ts.server {
457457 if ( args . file ) {
458458 var info = this . filenameToScriptInfo [ args . file ] ;
459459 if ( info ) {
460- info . setFormatOptions ( args . formatOptions ) ;
460+ info . setFormatOptions ( args . formatOptions ) ;
461461 this . log ( "Host configuration update for file " + args . file , "Info" ) ;
462462 }
463463 }
464464 else {
465465 if ( args . hostInfo !== undefined ) {
466466 this . hostConfiguration . hostInfo = args . hostInfo ;
467- this . log ( "Host information " + args . hostInfo , "Info" ) ;
467+ this . log ( "Host information " + args . hostInfo , "Info" ) ;
468468 }
469469 if ( args . formatOptions ) {
470- mergeFormatOptions ( this . hostConfiguration . formatCodeOptions , args . formatOptions ) ;
470+ mergeFormatOptions ( this . hostConfiguration . formatCodeOptions , args . formatOptions ) ;
471471 this . log ( "Format host information updated" , "Info" ) ;
472472 }
473473 }
@@ -487,7 +487,7 @@ module ts.server {
487487
488488 fileDeletedInFilesystem ( info : ScriptInfo ) {
489489 this . psLogger . info ( info . fileName + " deleted" ) ;
490-
490+
491491 if ( info . fileWatcher ) {
492492 info . fileWatcher . close ( ) ;
493493 info . fileWatcher = undefined ;
@@ -537,7 +537,7 @@ module ts.server {
537537 }
538538 return false ;
539539 }
540-
540+
541541 addOpenFile ( info : ScriptInfo ) {
542542 if ( this . setConfiguredProjectRoot ( info ) ) {
543543 this . openFileRootsConfigured . push ( info ) ;
@@ -561,7 +561,7 @@ module ts.server {
561561 copyListRemovingItem ( r . defaultProject , this . inferredProjects ) ;
562562 // put r in referenced open file list
563563 this . openFilesReferenced . push ( r ) ;
564- // set default project of r to the new project
564+ // set default project of r to the new project
565565 r . defaultProject = info . defaultProject ;
566566 }
567567 else {
@@ -694,7 +694,7 @@ module ts.server {
694694 this . openFilesReferenced = openFilesReferenced ;
695695
696696 // Then, loop through all of the open files that are project roots.
697- // For each root file, note the project that it roots. Then see if
697+ // For each root file, note the project that it roots. Then see if
698698 // any other projects newly reference the file. If zero projects
699699 // newly reference the file, keep it as a root. If one or more
700700 // projects newly references the file, remove its project from the
@@ -719,7 +719,7 @@ module ts.server {
719719
720720 // Finally, if we found any open, referenced files that are no longer
721721 // referenced by their default project, treat them as newly opened
722- // by the editor.
722+ // by the editor.
723723 for ( var i = 0 , len = unattachedOpenFiles . length ; i < len ; i ++ ) {
724724 this . addOpenFile ( unattachedOpenFiles [ i ] ) ;
725725 }
@@ -809,7 +809,7 @@ module ts.server {
809809 }
810810 else {
811811 this . log ( "Opened configuration file " + configFileName , "Info" ) ;
812- this . configuredProjects . push ( configResult . project ) ;
812+ this . configuredProjects . push ( configResult . project ) ;
813813 }
814814 }
815815 var info = this . openFile ( fileName , true ) ;
@@ -901,22 +901,22 @@ module ts.server {
901901 }
902902 return false ;
903903 }
904-
904+
905905 openConfigFile ( configFilename : string , clientFileName ?: string ) : ProjectOpenResult {
906906 configFilename = ts . normalizePath ( configFilename ) ;
907907 // file references will be relative to dirPath (or absolute)
908908 var dirPath = ts . getDirectoryPath ( configFilename ) ;
909- var rawConfig = < ProjectOptions > ts . readConfigFile ( configFilename ) ;
910- if ( ! rawConfig ) {
911- return { errorMsg : "tsconfig syntax error" } ;
909+ var rawConfig : { config ?: ProjectOptions ; error ?: Diagnostic ; } = ts . readConfigFile ( configFilename ) ;
910+ if ( rawConfig . error ) {
911+ return rawConfig . error ;
912912 }
913913 else {
914- var parsedCommandLine = ts . parseConfigFile ( rawConfig , ts . sys , dirPath ) ;
914+ var parsedCommandLine = ts . parseConfigFile ( rawConfig . config , ts . sys , dirPath ) ;
915915 if ( parsedCommandLine . errors && ( parsedCommandLine . errors . length > 0 ) ) {
916916 return { errorMsg : "tsconfig option errors" } ;
917917 }
918918 else if ( parsedCommandLine . fileNames ) {
919- var projectOptions : ProjectOptions = {
919+ var projectOptions : ProjectOptions = {
920920 files : parsedCommandLine . fileNames ,
921921 compilerOptions : parsedCommandLine . options
922922 } ;
@@ -1040,7 +1040,7 @@ module ts.server {
10401040 startPath : LineCollection [ ] ;
10411041 endBranch : LineCollection [ ] = [ ] ;
10421042 branchNode : LineNode ;
1043- // path to current node
1043+ // path to current node
10441044 stack : LineNode [ ] ;
10451045 state = CharRangeSection . Entire ;
10461046 lineCollectionAtBranch : LineCollection ;
@@ -1242,7 +1242,7 @@ module ts.server {
12421242 }
12431243 }
12441244
1245- // text change information
1245+ // text change information
12461246 class TextChange {
12471247 constructor ( public pos : number , public deleteLen : number , public insertedText ?: string ) {
12481248 }
@@ -1290,7 +1290,7 @@ module ts.server {
12901290 if ( cb )
12911291 cb ( ) ;
12921292 }
1293-
1293+
12941294 // reload whole script, leaving no change history behind reload
12951295 reload ( script : string ) {
12961296 this . currentVersion ++ ;
@@ -1300,7 +1300,7 @@ module ts.server {
13001300 snap . index = new LineIndex ( ) ;
13011301 var lm = LineIndex . linesFromText ( script ) ;
13021302 snap . index . load ( lm . lines ) ;
1303- // REVIEW: could use linked list
1303+ // REVIEW: could use linked list
13041304 for ( var i = this . minVersion ; i < this . currentVersion ; i ++ ) {
13051305 this . versions [ i ] = undefined ;
13061306 }
@@ -1381,7 +1381,7 @@ module ts.server {
13811381 return this . index . root . charCount ( ) ;
13821382 }
13831383
1384- // this requires linear space so don't hold on to these
1384+ // this requires linear space so don't hold on to these
13851385 getLineStartPositions ( ) : number [ ] {
13861386 var starts : number [ ] = [ - 1 ] ;
13871387 var count = 1 ;
@@ -1643,7 +1643,7 @@ module ts.server {
16431643 }
16441644
16451645 walk ( rangeStart : number , rangeLength : number , walkFns : ILineIndexWalker ) {
1646- // assume (rangeStart < this.totalChars) && (rangeLength <= this.totalChars)
1646+ // assume (rangeStart < this.totalChars) && (rangeLength <= this.totalChars)
16471647 var childIndex = 0 ;
16481648 var child = this . children [ 0 ] ;
16491649 var childCharCount = child . charCount ( ) ;
@@ -1729,7 +1729,7 @@ module ts.server {
17291729 line : lineNumber ,
17301730 offset : charOffset
17311731 }
1732- }
1732+ }
17331733 else if ( childInfo . child . isLeaf ( ) ) {
17341734 return {
17351735 line : lineNumber ,
@@ -1917,4 +1917,4 @@ module ts.server {
19171917 return 1 ;
19181918 }
19191919 }
1920- }
1920+ }
0 commit comments