Skip to content

Commit 52423f0

Browse files
committed
CoreServicesShimHost and CoreServicesShimHostAdapter changes to support TSConfig exclude from the language service
1 parent 22d3894 commit 52423f0

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
@@ -64,8 +64,12 @@ 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+
/** Returns a JSON-encoded value of the type: string[]
68+
*
69+
* @param exclude A JSON encoded string[] containing the paths to exclude
70+
* when enumerating the directory.
71+
*/
72+
readDirectory(rootDir: string, extension: string, exclude?: string): string;
6973
}
7074

7175
///
@@ -386,8 +390,18 @@ namespace ts {
386390
constructor(private shimHost: CoreServicesShimHost) {
387391
}
388392

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

0 commit comments

Comments
 (0)