Skip to content

Commit 01244d6

Browse files
committed
Merge pull request #3546 from Microsoft/tsConfigExcludeLSSupport
tsconfig.json exclude LS support CoreServicesShimHost and CoreServicesShimHostAdapter changes to support tsconfig.json exclude from the language service.
2 parents 842a5b7 + dea66a6 commit 01244d6

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

src/services/shims.ts

+19-4
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,13 @@ namespace ts {
6464

6565
/** Public interface of the the of a config service shim instance.*/
6666
export interface CoreServicesShimHost extends Logger {
67-
/** Returns a JSON-encoded value of the type: string[] */
68-
readDirectory(rootDir: string, extension: string): string;
67+
/**
68+
* Returns a JSON-encoded value of the type: string[]
69+
*
70+
* @param exclude A JSON encoded string[] containing the paths to exclude
71+
* when enumerating the directory.
72+
*/
73+
readDirectory(rootDir: string, extension: string, exclude?: string): string;
6974
}
7075

7176
///
@@ -386,8 +391,18 @@ namespace ts {
386391
constructor(private shimHost: CoreServicesShimHost) {
387392
}
388393

389-
public readDirectory(rootDir: string, extension: string): string[] {
390-
var encoded = this.shimHost.readDirectory(rootDir, extension);
394+
public readDirectory(rootDir: string, extension: string, exclude: string[]): string[] {
395+
// Wrap the API changes for 1.5 release. This try/catch
396+
// should be removed once TypeScript 1.5 has shipped.
397+
// Also consider removing the optional designation for
398+
// the exclude param at this time.
399+
var encoded: string;
400+
try {
401+
encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude));
402+
}
403+
catch (e) {
404+
encoded = this.shimHost.readDirectory(rootDir, extension);
405+
}
391406
return JSON.parse(encoded);
392407
}
393408
}

0 commit comments

Comments
 (0)