@@ -398,7 +398,7 @@ module ts.server {
398
398
399
399
export class ProjectService {
400
400
filenameToScriptInfo : ts . Map < ScriptInfo > = { } ;
401
- // open, non-configured root files
401
+ // open, non-configured root files
402
402
openFileRoots : ScriptInfo [ ] = [ ] ;
403
403
// projects built from openFileRoots
404
404
inferredProjects : Project [ ] = [ ] ;
@@ -421,7 +421,7 @@ module ts.server {
421
421
hostInfo : "Unknown host"
422
422
}
423
423
}
424
-
424
+
425
425
getFormatCodeOptions ( file ?: string ) {
426
426
if ( file ) {
427
427
var info = this . filenameToScriptInfo [ file ] ;
@@ -448,7 +448,7 @@ module ts.server {
448
448
}
449
449
}
450
450
}
451
-
451
+
452
452
log ( msg : string , type = "Err" ) {
453
453
this . psLogger . msg ( msg , type ) ;
454
454
}
@@ -457,17 +457,17 @@ module ts.server {
457
457
if ( args . file ) {
458
458
var info = this . filenameToScriptInfo [ args . file ] ;
459
459
if ( info ) {
460
- info . setFormatOptions ( args . formatOptions ) ;
460
+ info . setFormatOptions ( args . formatOptions ) ;
461
461
this . log ( "Host configuration update for file " + args . file , "Info" ) ;
462
462
}
463
463
}
464
464
else {
465
465
if ( args . hostInfo !== undefined ) {
466
466
this . hostConfiguration . hostInfo = args . hostInfo ;
467
- this . log ( "Host information " + args . hostInfo , "Info" ) ;
467
+ this . log ( "Host information " + args . hostInfo , "Info" ) ;
468
468
}
469
469
if ( args . formatOptions ) {
470
- mergeFormatOptions ( this . hostConfiguration . formatCodeOptions , args . formatOptions ) ;
470
+ mergeFormatOptions ( this . hostConfiguration . formatCodeOptions , args . formatOptions ) ;
471
471
this . log ( "Format host information updated" , "Info" ) ;
472
472
}
473
473
}
@@ -487,7 +487,7 @@ module ts.server {
487
487
488
488
fileDeletedInFilesystem ( info : ScriptInfo ) {
489
489
this . psLogger . info ( info . fileName + " deleted" ) ;
490
-
490
+
491
491
if ( info . fileWatcher ) {
492
492
info . fileWatcher . close ( ) ;
493
493
info . fileWatcher = undefined ;
@@ -537,7 +537,7 @@ module ts.server {
537
537
}
538
538
return false ;
539
539
}
540
-
540
+
541
541
addOpenFile ( info : ScriptInfo ) {
542
542
if ( this . setConfiguredProjectRoot ( info ) ) {
543
543
this . openFileRootsConfigured . push ( info ) ;
@@ -561,7 +561,7 @@ module ts.server {
561
561
copyListRemovingItem ( r . defaultProject , this . inferredProjects ) ;
562
562
// put r in referenced open file list
563
563
this . openFilesReferenced . push ( r ) ;
564
- // set default project of r to the new project
564
+ // set default project of r to the new project
565
565
r . defaultProject = info . defaultProject ;
566
566
}
567
567
else {
@@ -694,7 +694,7 @@ module ts.server {
694
694
this . openFilesReferenced = openFilesReferenced ;
695
695
696
696
// 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
698
698
// any other projects newly reference the file. If zero projects
699
699
// newly reference the file, keep it as a root. If one or more
700
700
// projects newly references the file, remove its project from the
@@ -719,7 +719,7 @@ module ts.server {
719
719
720
720
// Finally, if we found any open, referenced files that are no longer
721
721
// referenced by their default project, treat them as newly opened
722
- // by the editor.
722
+ // by the editor.
723
723
for ( var i = 0 , len = unattachedOpenFiles . length ; i < len ; i ++ ) {
724
724
this . addOpenFile ( unattachedOpenFiles [ i ] ) ;
725
725
}
@@ -809,7 +809,7 @@ module ts.server {
809
809
}
810
810
else {
811
811
this . log ( "Opened configuration file " + configFileName , "Info" ) ;
812
- this . configuredProjects . push ( configResult . project ) ;
812
+ this . configuredProjects . push ( configResult . project ) ;
813
813
}
814
814
}
815
815
var info = this . openFile ( fileName , true ) ;
@@ -901,22 +901,22 @@ module ts.server {
901
901
}
902
902
return false ;
903
903
}
904
-
904
+
905
905
openConfigFile ( configFilename : string , clientFileName ?: string ) : ProjectOpenResult {
906
906
configFilename = ts . normalizePath ( configFilename ) ;
907
907
// file references will be relative to dirPath (or absolute)
908
908
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 ;
912
912
}
913
913
else {
914
- var parsedCommandLine = ts . parseConfigFile ( rawConfig , ts . sys , dirPath ) ;
914
+ var parsedCommandLine = ts . parseConfigFile ( rawConfig . config , ts . sys , dirPath ) ;
915
915
if ( parsedCommandLine . errors && ( parsedCommandLine . errors . length > 0 ) ) {
916
916
return { errorMsg : "tsconfig option errors" } ;
917
917
}
918
918
else if ( parsedCommandLine . fileNames ) {
919
- var projectOptions : ProjectOptions = {
919
+ var projectOptions : ProjectOptions = {
920
920
files : parsedCommandLine . fileNames ,
921
921
compilerOptions : parsedCommandLine . options
922
922
} ;
@@ -1040,7 +1040,7 @@ module ts.server {
1040
1040
startPath : LineCollection [ ] ;
1041
1041
endBranch : LineCollection [ ] = [ ] ;
1042
1042
branchNode : LineNode ;
1043
- // path to current node
1043
+ // path to current node
1044
1044
stack : LineNode [ ] ;
1045
1045
state = CharRangeSection . Entire ;
1046
1046
lineCollectionAtBranch : LineCollection ;
@@ -1242,7 +1242,7 @@ module ts.server {
1242
1242
}
1243
1243
}
1244
1244
1245
- // text change information
1245
+ // text change information
1246
1246
class TextChange {
1247
1247
constructor ( public pos : number , public deleteLen : number , public insertedText ?: string ) {
1248
1248
}
@@ -1290,7 +1290,7 @@ module ts.server {
1290
1290
if ( cb )
1291
1291
cb ( ) ;
1292
1292
}
1293
-
1293
+
1294
1294
// reload whole script, leaving no change history behind reload
1295
1295
reload ( script : string ) {
1296
1296
this . currentVersion ++ ;
@@ -1300,7 +1300,7 @@ module ts.server {
1300
1300
snap . index = new LineIndex ( ) ;
1301
1301
var lm = LineIndex . linesFromText ( script ) ;
1302
1302
snap . index . load ( lm . lines ) ;
1303
- // REVIEW: could use linked list
1303
+ // REVIEW: could use linked list
1304
1304
for ( var i = this . minVersion ; i < this . currentVersion ; i ++ ) {
1305
1305
this . versions [ i ] = undefined ;
1306
1306
}
@@ -1381,7 +1381,7 @@ module ts.server {
1381
1381
return this . index . root . charCount ( ) ;
1382
1382
}
1383
1383
1384
- // this requires linear space so don't hold on to these
1384
+ // this requires linear space so don't hold on to these
1385
1385
getLineStartPositions ( ) : number [ ] {
1386
1386
var starts : number [ ] = [ - 1 ] ;
1387
1387
var count = 1 ;
@@ -1643,7 +1643,7 @@ module ts.server {
1643
1643
}
1644
1644
1645
1645
walk ( rangeStart : number , rangeLength : number , walkFns : ILineIndexWalker ) {
1646
- // assume (rangeStart < this.totalChars) && (rangeLength <= this.totalChars)
1646
+ // assume (rangeStart < this.totalChars) && (rangeLength <= this.totalChars)
1647
1647
var childIndex = 0 ;
1648
1648
var child = this . children [ 0 ] ;
1649
1649
var childCharCount = child . charCount ( ) ;
@@ -1729,7 +1729,7 @@ module ts.server {
1729
1729
line : lineNumber ,
1730
1730
offset : charOffset
1731
1731
}
1732
- }
1732
+ }
1733
1733
else if ( childInfo . child . isLeaf ( ) ) {
1734
1734
return {
1735
1735
line : lineNumber ,
@@ -1917,4 +1917,4 @@ module ts.server {
1917
1917
return 1 ;
1918
1918
}
1919
1919
}
1920
- }
1920
+ }
0 commit comments