@@ -120,7 +120,7 @@ namespace ts.server {
120120 if ( ! resolution ) {
121121 const existingResolution = currentResolutionsInFile && ts . lookUp ( currentResolutionsInFile , moduleName ) ;
122122 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
124124 resolution = existingResolution ;
125125 }
126126 else {
@@ -145,8 +145,8 @@ namespace ts.server {
145145 }
146146
147147 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
150150 return true ;
151151 }
152152
@@ -483,7 +483,7 @@ namespace ts.server {
483483 openFileRootsConfigured : ScriptInfo [ ] = [ ] ;
484484 // a path to directory watcher map that detects added tsconfig files
485485 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
487487 // number becomes 0 for a watcher, then we should close it.
488488 directoryWatchersRefCount : ts . Map < number > = { } ;
489489 hostConfiguration : HostConfiguration ;
@@ -564,11 +564,11 @@ namespace ts.server {
564564 // We check if the project file list has changed. If so, we update the project.
565565 if ( ! arrayIsEqualTo ( currentRootFiles && currentRootFiles . sort ( ) , newRootFiles && newRootFiles . sort ( ) ) ) {
566566 // 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
568568 // just update the current project.
569569 this . updateConfiguredProject ( project ) ;
570570
571- // Call updateProjectStructure to clean up inferred projects we may have
571+ // Call updateProjectStructure to clean up inferred projects we may have
572572 // created for the new files
573573 this . updateProjectStructure ( ) ;
574574 }
@@ -792,8 +792,8 @@ namespace ts.server {
792792 * @param info The file that has been closed or newly configured
793793 */
794794 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
797797 // to the disk, and the server's version of the file can be out of sync.
798798 info . svc . reloadFromFile ( info . fileName ) ;
799799
@@ -891,8 +891,8 @@ namespace ts.server {
891891 }
892892
893893 /**
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
896896 * up to date.
897897 */
898898 updateProjectStructure ( ) {
@@ -946,7 +946,7 @@ namespace ts.server {
946946
947947 if ( rootFile . defaultProject && rootFile . defaultProject . isConfiguredProject ( ) ) {
948948 // 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.
950950 if ( ! rootedProject . isConfiguredProject ( ) ) {
951951 this . removeProject ( rootedProject ) ;
952952 }
@@ -1059,9 +1059,9 @@ namespace ts.server {
10591059 }
10601060
10611061 /**
1062- * 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,
10631063 * we first detect if there is already a configured project created for it: if so, we re-read
1064- * 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.
10651065 */
10661066 openOrUpdateConfiguredProjectForFile ( fileName : string ) {
10671067 const searchPath = ts . normalizePath ( getDirectoryPath ( fileName ) ) ;
@@ -1178,13 +1178,15 @@ namespace ts.server {
11781178
11791179 configFileToProjectOptions ( configFilename : string ) : { succeeded : boolean , projectOptions ?: ProjectOptions , error ?: ProjectOpenResult } {
11801180 configFilename = ts . normalizePath ( configFilename ) ;
1181+ // file references will be relative to dirPath (or absolute)
1182+ const dirPath = ts . getDirectoryPath ( configFilename ) ;
11811183 const contents = this . host . readFile ( configFilename ) ;
11821184 const rawConfig : { config ?: ProjectOptions ; error ?: Diagnostic ; } = ts . parseConfigFileTextToJson ( configFilename , contents ) ;
11831185 if ( rawConfig . error ) {
11841186 return { succeeded : false , error : rawConfig . error } ;
11851187 }
11861188 else {
1187- const parsedCommandLine = ts . parseJsonConfigFileContent ( rawConfig . config , this . host , configFilename ) ;
1189+ const parsedCommandLine = ts . parseJsonConfigFileContent ( rawConfig . config , this . host , dirPath , /*existingOptions*/ { } , configFilename ) ;
11881190 Debug . assert ( ! ! parsedCommandLine . fileNames ) ;
11891191
11901192 if ( parsedCommandLine . errors && ( parsedCommandLine . errors . length > 0 ) ) {
@@ -1263,7 +1265,7 @@ namespace ts.server {
12631265 info = this . openFile ( fileName , /*openedByClient*/ false ) ;
12641266 }
12651267 else {
1266- // 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
12671269 // openFileRoots or openFileReferenced.
12681270 if ( info . isOpen ) {
12691271 if ( this . openFileRoots . indexOf ( info ) >= 0 ) {
0 commit comments