Skip to content

Commit 6afb15c

Browse files
committed
CoreServicesShimHost and CoreServicesShimHostAdapter changes to support TSConfig exclude from the language service
1 parent 247d582 commit 6afb15c

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

src/services/shims.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,12 @@ namespace ts {
6161

6262
/** Public interface of the the of a config service shim instance.*/
6363
export interface CoreServicesShimHost extends Logger {
64-
/** Returns a JSON-encoded value of the type: string[] */
65-
readDirectory(rootDir: string, extension: string): string;
64+
/** Returns a JSON-encoded value of the type: string[]
65+
*
66+
* @param exclude A JSON encoded string[] containing the paths to exclude
67+
* when enumerating the directory.
68+
*/
69+
readDirectory(rootDir: string, extension: string, exclude?: string): string;
6670
}
6771

6872
///
@@ -351,8 +355,18 @@ namespace ts {
351355
constructor(private shimHost: CoreServicesShimHost) {
352356
}
353357

354-
public readDirectory(rootDir: string, extension: string): string[] {
355-
var encoded = this.shimHost.readDirectory(rootDir, extension);
358+
public readDirectory(rootDir: string, extension: string, exclude: string[]): string[] {
359+
// Wrap the API changes for 1.5 release. This try/catch
360+
// should be removed once TypeScript 1.5 has shipped.
361+
// Also consider removing the optional designation for
362+
// the exclude param at this time.
363+
var encoded: string;
364+
try {
365+
encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude));
366+
}
367+
catch (e) {
368+
encoded = this.shimHost.readDirectory(rootDir, extension);
369+
}
356370
return JSON.parse(encoded);
357371
}
358372
}

0 commit comments

Comments
 (0)