From 6afb15c19e51d2bf9cf9c6b644234af532d2af42 Mon Sep 17 00:00:00 2001 From: Jason Ramsay Date: Wed, 17 Jun 2015 21:22:16 -0700 Subject: [PATCH 1/3] CoreServicesShimHost and CoreServicesShimHostAdapter changes to support TSConfig exclude from the language service --- src/services/shims.ts | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/services/shims.ts b/src/services/shims.ts index 2e8b3eb774d59..611d1dc8d29ae 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -61,8 +61,12 @@ namespace ts { /** Public interface of the the of a config service shim instance.*/ export interface CoreServicesShimHost extends Logger { - /** Returns a JSON-encoded value of the type: string[] */ - readDirectory(rootDir: string, extension: string): string; + /** Returns a JSON-encoded value of the type: string[] + * + * @param exclude A JSON encoded string[] containing the paths to exclude + * when enumerating the directory. + */ + readDirectory(rootDir: string, extension: string, exclude?: string): string; } /// @@ -351,8 +355,18 @@ namespace ts { constructor(private shimHost: CoreServicesShimHost) { } - public readDirectory(rootDir: string, extension: string): string[] { - var encoded = this.shimHost.readDirectory(rootDir, extension); + public readDirectory(rootDir: string, extension: string, exclude: string[]): string[] { + // Wrap the API changes for 1.5 release. This try/catch + // should be removed once TypeScript 1.5 has shipped. + // Also consider removing the optional designation for + // the exclude param at this time. + var encoded: string; + try { + encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude)); + } + catch (e) { + encoded = this.shimHost.readDirectory(rootDir, extension); + } return JSON.parse(encoded); } } From 52423f0e6e98079e7d5629a30a44e5b63dccfcdb Mon Sep 17 00:00:00 2001 From: Jason Ramsay Date: Wed, 17 Jun 2015 21:22:16 -0700 Subject: [PATCH 2/3] CoreServicesShimHost and CoreServicesShimHostAdapter changes to support TSConfig exclude from the language service --- src/services/shims.ts | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/services/shims.ts b/src/services/shims.ts index 84580470b2782..362293c0c79b8 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -64,8 +64,12 @@ namespace ts { /** Public interface of the the of a config service shim instance.*/ export interface CoreServicesShimHost extends Logger { - /** Returns a JSON-encoded value of the type: string[] */ - readDirectory(rootDir: string, extension: string): string; + /** Returns a JSON-encoded value of the type: string[] + * + * @param exclude A JSON encoded string[] containing the paths to exclude + * when enumerating the directory. + */ + readDirectory(rootDir: string, extension: string, exclude?: string): string; } /// @@ -386,8 +390,18 @@ namespace ts { constructor(private shimHost: CoreServicesShimHost) { } - public readDirectory(rootDir: string, extension: string): string[] { - var encoded = this.shimHost.readDirectory(rootDir, extension); + public readDirectory(rootDir: string, extension: string, exclude: string[]): string[] { + // Wrap the API changes for 1.5 release. This try/catch + // should be removed once TypeScript 1.5 has shipped. + // Also consider removing the optional designation for + // the exclude param at this time. + var encoded: string; + try { + encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude)); + } + catch (e) { + encoded = this.shimHost.readDirectory(rootDir, extension); + } return JSON.parse(encoded); } } From dea66a66dc93118abdde6eec558d12d33c267829 Mon Sep 17 00:00:00 2001 From: Jason Ramsay Date: Wed, 15 Jul 2015 14:19:54 -0700 Subject: [PATCH 3/3] Fix comment spacing for readDirectory in shims.ts --- src/services/shims.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/services/shims.ts b/src/services/shims.ts index 362293c0c79b8..e2055b3de7794 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -64,7 +64,8 @@ namespace ts { /** Public interface of the the of a config service shim instance.*/ export interface CoreServicesShimHost extends Logger { - /** Returns a JSON-encoded value of the type: string[] + /** + * Returns a JSON-encoded value of the type: string[] * * @param exclude A JSON encoded string[] containing the paths to exclude * when enumerating the directory.