Update comments
This commit is contained in:
parent
7741ec0999
commit
17f0cce772
|
@ -398,8 +398,8 @@ namespace ts {
|
||||||
// and https://github.com/Microsoft/TypeScript/issues/4643), therefore
|
// and https://github.com/Microsoft/TypeScript/issues/4643), therefore
|
||||||
// if the current node.js version is newer than 4, use `fs.watch` instead.
|
// if the current node.js version is newer than 4, use `fs.watch` instead.
|
||||||
if (isNode4OrLater()) {
|
if (isNode4OrLater()) {
|
||||||
// Note: in node the callback of fs.watch is given only the base file name as a parameter
|
// Note: in node the callback of fs.watch is given only the relative file name as a parameter
|
||||||
return _fs.watch(fileName, (eventName: string, baseFileName: string) => callback(fileName));
|
return _fs.watch(fileName, (eventName: string, relativeFileName: string) => callback(fileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
var watchedFile = watchedFileSet.addFile(fileName, callback);
|
var watchedFile = watchedFileSet.addFile(fileName, callback);
|
||||||
|
|
|
@ -543,7 +543,7 @@ namespace ts.server {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the callback function when a watched directory has added or removed files.
|
* This is the callback function when a watched directory has added or removed source code files.
|
||||||
* @param project the project that associates with this directory watcher
|
* @param project the project that associates with this directory watcher
|
||||||
* @param fileName the absolute file name that changed in watched directory
|
* @param fileName the absolute file name that changed in watched directory
|
||||||
*/
|
*/
|
||||||
|
@ -567,12 +567,15 @@ namespace ts.server {
|
||||||
// just update the current project.
|
// just update the current project.
|
||||||
this.updateConfiguredProject(project);
|
this.updateConfiguredProject(project);
|
||||||
|
|
||||||
// Call updateProjectStructure to clean up inferred projects we may have created for the
|
// Call updateProjectStructure to clean up inferred projects we may have
|
||||||
// new files
|
// created for the new files
|
||||||
this.updateProjectStructure();
|
this.updateProjectStructure();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the callback function when a watched directory has an added tsconfig file.
|
||||||
|
*/
|
||||||
directoryWatchedForTsconfigChanged(fileName: string) {
|
directoryWatchedForTsconfigChanged(fileName: string) {
|
||||||
if (ts.getBaseFileName(fileName) != "tsconfig.json") {
|
if (ts.getBaseFileName(fileName) != "tsconfig.json") {
|
||||||
this.log(fileName + " is not tsconfig.json");
|
this.log(fileName + " is not tsconfig.json");
|
||||||
|
@ -585,6 +588,8 @@ namespace ts.server {
|
||||||
let rootFilesInTsconfig = projectOptions.files.map(f => this.getCanonicalFileName(f));
|
let rootFilesInTsconfig = projectOptions.files.map(f => this.getCanonicalFileName(f));
|
||||||
let openFileRoots = this.openFileRoots.map(s => this.getCanonicalFileName(s.fileName));
|
let openFileRoots = this.openFileRoots.map(s => this.getCanonicalFileName(s.fileName));
|
||||||
|
|
||||||
|
// We should only care about the new tsconfig file if it contains any
|
||||||
|
// opened root files of existing inferred projects
|
||||||
for (let openFileRoot of openFileRoots) {
|
for (let openFileRoot of openFileRoots) {
|
||||||
if (rootFilesInTsconfig.indexOf(openFileRoot) >= 0) {
|
if (rootFilesInTsconfig.indexOf(openFileRoot) >= 0) {
|
||||||
this.reloadProjects();
|
this.reloadProjects();
|
||||||
|
@ -708,6 +713,7 @@ namespace ts.server {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (let directory of project.directoriesWatchedForTsconfig) {
|
for (let directory of project.directoriesWatchedForTsconfig) {
|
||||||
|
// if the ref count for this directory watcher drops to 0, it's time to close it
|
||||||
if (!(--project.projectService.directoryWatchersRefCount[directory])) {
|
if (!(--project.projectService.directoryWatchersRefCount[directory])) {
|
||||||
this.log("Close directory watcher for: " + directory);
|
this.log("Close directory watcher for: " + directory);
|
||||||
project.projectService.directoryWatchersForTsconfig[directory].close();
|
project.projectService.directoryWatchersForTsconfig[directory].close();
|
||||||
|
@ -956,9 +962,6 @@ namespace ts.server {
|
||||||
this.addOpenFile(unattachedOpenFiles[i]);
|
this.addOpenFile(unattachedOpenFiles[i]);
|
||||||
}
|
}
|
||||||
this.printProjects();
|
this.printProjects();
|
||||||
|
|
||||||
this.log("Current openFileRoots: " + this.openFileRoots.map(s => s.fileName).toString());
|
|
||||||
this.log("Current openFileRootsConfigured: " + this.openFileRootsConfigured.map(s => s.fileName).toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getScriptInfo(filename: string) {
|
getScriptInfo(filename: string) {
|
||||||
|
|
Loading…
Reference in a new issue