MCPcopy Index your code
hub / github.com/microsoft/pyright / setTrackedFiles

Method setTrackedFiles

server/src/analyzer/program.ts:50–72  ·  view source on GitHub ↗
(filePaths: string[])

Source from the content-addressed store, hash-verified

48
49 // Sets the list of tracked files that make up the program.
50 setTrackedFiles(filePaths: string[]): FileDiagnostics[] {
51 if (this._sourceFileList.length > 0) {
52 // We need to determine which files to remove from the existing file list.
53 let newFileMap: { [path: string]: string } = {};
54 filePaths.forEach(path => {
55 newFileMap[path] = path;
56 });
57
58 // Files that are not in the tracked file list are
59 // marked as no longer tracked.
60 this._sourceFileList.forEach(oldFile => {
61 let filePath = oldFile.sourceFile.getFilePath();
62 if (newFileMap[filePath] === undefined) {
63 oldFile.isTracked = false;
64 }
65 });
66 }
67
68 // Add the new files. Only the new items will be added.
69 this.addTrackedFiles(filePaths);
70
71 return this._removeUnneededFiles();
72 }
73
74 getFileCount() {
75 return this._sourceFileList.length;

Callers 1

Calls 4

addTrackedFilesMethod · 0.95
_removeUnneededFilesMethod · 0.95
forEachMethod · 0.80
getFilePathMethod · 0.80

Tested by

no test coverage detected