@@ -120,7 +120,7 @@ namespace ts.server {
120
120
if ( ! resolution ) {
121
121
const existingResolution = currentResolutionsInFile && ts . lookUp ( currentResolutionsInFile , moduleName ) ;
122
122
if ( moduleResolutionIsValid ( existingResolution ) ) {
123
- // ok, it is safe to use existing module resolution results
123
+ // ok, it is safe to use existing module resolution results
124
124
resolution = existingResolution ;
125
125
}
126
126
else {
@@ -145,8 +145,8 @@ namespace ts.server {
145
145
}
146
146
147
147
if ( resolution . resolvedModule ) {
148
- // TODO: consider checking failedLookupLocations
149
- // TODO: use lastCheckTime to track expiration for module name resolution
148
+ // TODO: consider checking failedLookupLocations
149
+ // TODO: use lastCheckTime to track expiration for module name resolution
150
150
return true ;
151
151
}
152
152
@@ -483,7 +483,7 @@ namespace ts.server {
483
483
openFileRootsConfigured : ScriptInfo [ ] = [ ] ;
484
484
// a path to directory watcher map that detects added tsconfig files
485
485
directoryWatchersForTsconfig : ts . Map < FileWatcher > = { } ;
486
- // count of how many projects are using the directory watcher. If the
486
+ // count of how many projects are using the directory watcher. If the
487
487
// number becomes 0 for a watcher, then we should close it.
488
488
directoryWatchersRefCount : ts . Map < number > = { } ;
489
489
hostConfiguration : HostConfiguration ;
@@ -564,11 +564,11 @@ namespace ts.server {
564
564
// We check if the project file list has changed. If so, we update the project.
565
565
if ( ! arrayIsEqualTo ( currentRootFiles && currentRootFiles . sort ( ) , newRootFiles && newRootFiles . sort ( ) ) ) {
566
566
// For configured projects, the change is made outside the tsconfig file, and
567
- // it is not likely to affect the project for other files opened by the client. We can
567
+ // it is not likely to affect the project for other files opened by the client. We can
568
568
// just update the current project.
569
569
this . updateConfiguredProject ( project ) ;
570
570
571
- // Call updateProjectStructure to clean up inferred projects we may have
571
+ // Call updateProjectStructure to clean up inferred projects we may have
572
572
// created for the new files
573
573
this . updateProjectStructure ( ) ;
574
574
}
@@ -792,8 +792,8 @@ namespace ts.server {
792
792
* @param info The file that has been closed or newly configured
793
793
*/
794
794
closeOpenFile ( info : ScriptInfo ) {
795
- // Closing file should trigger re-reading the file content from disk. This is
796
- // because the user may chose to discard the buffer content before saving
795
+ // Closing file should trigger re-reading the file content from disk. This is
796
+ // because the user may chose to discard the buffer content before saving
797
797
// to the disk, and the server's version of the file can be out of sync.
798
798
info . svc . reloadFromFile ( info . fileName ) ;
799
799
@@ -891,8 +891,8 @@ namespace ts.server {
891
891
}
892
892
893
893
/**
894
- * This function is to update the project structure for every projects.
895
- * It is called on the premise that all the configured projects are
894
+ * This function is to update the project structure for every projects.
895
+ * It is called on the premise that all the configured projects are
896
896
* up to date.
897
897
*/
898
898
updateProjectStructure ( ) {
@@ -946,7 +946,7 @@ namespace ts.server {
946
946
947
947
if ( rootFile . defaultProject && rootFile . defaultProject . isConfiguredProject ( ) ) {
948
948
// If the root file has already been added into a configured project,
949
- // meaning the original inferred project is gone already.
949
+ // meaning the original inferred project is gone already.
950
950
if ( ! rootedProject . isConfiguredProject ( ) ) {
951
951
this . removeProject ( rootedProject ) ;
952
952
}
@@ -1026,10 +1026,16 @@ namespace ts.server {
1026
1026
// the newly opened file.
1027
1027
findConfigFile ( searchPath : string ) : string {
1028
1028
while ( true ) {
1029
- const fileName = ts . combinePaths ( searchPath , "tsconfig.json" ) ;
1030
- if ( this . host . fileExists ( fileName ) ) {
1031
- return fileName ;
1029
+ const tsconfigFileName = ts . combinePaths ( searchPath , "tsconfig.json" ) ;
1030
+ if ( this . host . fileExists ( tsconfigFileName ) ) {
1031
+ return tsconfigFileName ;
1032
+ }
1033
+
1034
+ const jsconfigFileName = ts . combinePaths ( searchPath , "jsconfig.json" ) ;
1035
+ if ( this . host . fileExists ( jsconfigFileName ) ) {
1036
+ return jsconfigFileName ;
1032
1037
}
1038
+
1033
1039
const parentPath = ts . getDirectoryPath ( searchPath ) ;
1034
1040
if ( parentPath === searchPath ) {
1035
1041
break ;
@@ -1053,9 +1059,9 @@ namespace ts.server {
1053
1059
}
1054
1060
1055
1061
/**
1056
- * This function tries to search for a tsconfig.json for the given file. If we found it,
1062
+ * This function tries to search for a tsconfig.json for the given file. If we found it,
1057
1063
* we first detect if there is already a configured project created for it: if so, we re-read
1058
- * the tsconfig file content and update the project; otherwise we create a new one.
1064
+ * the tsconfig file content and update the project; otherwise we create a new one.
1059
1065
*/
1060
1066
openOrUpdateConfiguredProjectForFile ( fileName : string ) {
1061
1067
const searchPath = ts . normalizePath ( getDirectoryPath ( fileName ) ) ;
@@ -1180,7 +1186,7 @@ namespace ts.server {
1180
1186
return { succeeded : false , error : rawConfig . error } ;
1181
1187
}
1182
1188
else {
1183
- const parsedCommandLine = ts . parseJsonConfigFileContent ( rawConfig . config , this . host , dirPath ) ;
1189
+ const parsedCommandLine = ts . parseJsonConfigFileContent ( rawConfig . config , this . host , dirPath , /*existingOptions*/ { } , configFilename ) ;
1184
1190
Debug . assert ( ! ! parsedCommandLine . fileNames ) ;
1185
1191
1186
1192
if ( parsedCommandLine . errors && ( parsedCommandLine . errors . length > 0 ) ) {
@@ -1259,7 +1265,7 @@ namespace ts.server {
1259
1265
info = this . openFile ( fileName , /*openedByClient*/ false ) ;
1260
1266
}
1261
1267
else {
1262
- // if the root file was opened by client, it would belong to either
1268
+ // if the root file was opened by client, it would belong to either
1263
1269
// openFileRoots or openFileReferenced.
1264
1270
if ( info . isOpen ) {
1265
1271
if ( this . openFileRoots . indexOf ( info ) >= 0 ) {
0 commit comments