[Pkg-javascript-commits] [node-typescript] 01/03: New upstream version 2.0.8

Julien Puydt julien.puydt at laposte.net
Tue Nov 8 14:57:08 UTC 2016


This is an automated email from the git hooks/post-receive script.

jpuydt-guest pushed a commit to branch master
in repository node-typescript.

commit 03e895b9ef1ba6e62883def08a235f37576d9c91
Author: Julien Puydt <julien.puydt at laposte.net>
Date:   Tue Nov 8 15:47:21 2016 +0100

    New upstream version 2.0.8
---
 Jakefile.js                                        |   2 +
 lib/protocol.d.ts                                  |  20 ++++
 lib/tsc.js                                         |  12 ++-
 lib/tsserver.js                                    | 116 ++++++++++++++++-----
 lib/tsserverlibrary.d.ts                           |  39 ++++++-
 lib/tsserverlibrary.js                             |  59 +++++++++--
 lib/typescript.d.ts                                |   6 +-
 lib/typescript.js                                  |  14 ++-
 lib/typescriptServices.d.ts                        |   6 +-
 lib/typescriptServices.js                          |  14 ++-
 lib/typingsInstaller.js                            |  64 ++++++++----
 package.json                                       |   2 +-
 src/compiler/program.ts                            |   9 +-
 src/compiler/sys.ts                                |  10 +-
 src/compiler/types.ts                              |   1 +
 src/harness/unittests/tsserverProjectSystem.ts     |   3 +-
 src/harness/unittests/typingsInstaller.ts          |  68 ++++++++++--
 src/server/editorServices.ts                       |   4 +-
 src/server/project.ts                              |  12 ++-
 src/server/protocol.ts                             |  26 +++++
 src/server/server.ts                               |  78 +++++++++-----
 src/server/session.ts                              |   6 +-
 src/server/shared.ts                               |  24 +++++
 src/server/tsconfig.json                           |   1 +
 src/server/tsconfig.library.json                   |   1 +
 src/server/types.d.ts                              |  24 +++--
 .../typingsInstaller/nodeTypingsInstaller.ts       |  16 ++-
 src/server/typingsInstaller/tsconfig.json          |   1 +
 src/server/typingsInstaller/typingsInstaller.ts    |  18 +++-
 src/server/utilities.ts                            |   4 +-
 src/services/jsTyping.ts                           |   2 +-
 31 files changed, 517 insertions(+), 145 deletions(-)

diff --git a/Jakefile.js b/Jakefile.js
index 5e42276..bdb58bb 100644
--- a/Jakefile.js
+++ b/Jakefile.js
@@ -127,6 +127,7 @@ var servicesSources = [
 
 var serverCoreSources = [
     "types.d.ts",
+    "shared.ts",
     "utilities.ts",
     "scriptVersionCache.ts",
     "typingsCache.ts",
@@ -149,6 +150,7 @@ var cancellationTokenSources = [
 
 var typingsInstallerSources = [
     "../types.d.ts",
+    "../shared.ts",
     "typingsInstaller.ts",
     "nodeTypingsInstaller.ts"
 ].map(function (f) {
diff --git a/lib/protocol.d.ts b/lib/protocol.d.ts
index 603ee14..72b0608 100644
--- a/lib/protocol.d.ts
+++ b/lib/protocol.d.ts
@@ -1524,6 +1524,26 @@ declare namespace ts.server.protocol {
         spans: TextSpan[];
         childItems?: NavigationTree[];
     }
+    type TelemetryEventName = "telemetry";
+    interface TelemetryEvent extends Event {
+        event: TelemetryEventName;
+        body: TelemetryEventBody;
+    }
+    interface TelemetryEventBody {
+        telemetryEventName: string;
+        payload: any;
+    }
+    type TypingsInstalledTelemetryEventName = "typingsInstalled";
+    interface TypingsInstalledTelemetryEventBody extends TelemetryEventBody {
+        telemetryEventName: TypingsInstalledTelemetryEventName;
+        payload: TypingsInstalledTelemetryEventPayload;
+    }
+    interface TypingsInstalledTelemetryEventPayload {
+        /**
+         * Comma separated list of installed typing packages
+         */
+        installedPackages: string;
+    }
     interface NavBarResponse extends Response {
         body?: NavigationBarItem[];
     }
diff --git a/lib/tsc.js b/lib/tsc.js
index fff7700..1bc244c 100644
--- a/lib/tsc.js
+++ b/lib/tsc.js
@@ -1689,7 +1689,7 @@ var ts;
                 },
                 readFile: readFile,
                 writeFile: writeFile,
-                watchFile: function (fileName, callback) {
+                watchFile: function (fileName, callback, pollingInterval) {
                     if (useNonPollingWatchers) {
                         var watchedFile_1 = watchedFileSet.addFile(fileName, callback);
                         return {
@@ -1697,7 +1697,7 @@ var ts;
                         };
                     }
                     else {
-                        _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged);
+                        _fs.watchFile(fileName, { persistent: true, interval: pollingInterval || 250 }, fileChanged);
                         return {
                             close: function () { return _fs.unwatchFile(fileName, fileChanged); }
                         };
@@ -37138,7 +37138,7 @@ var ts;
 })(ts || (ts = {}));
 var ts;
 (function (ts) {
-    ts.version = "2.0.7";
+    ts.version = "2.0.8";
     var emptyArray = [];
     function findConfigFile(searchPath, fileExists, configName) {
         if (configName === void 0) { configName = "tsconfig.json"; }
@@ -37592,6 +37592,7 @@ var ts;
             getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); },
             getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; },
             getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; },
+            isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
             dropDiagnosticsProducingTypeChecker: dropDiagnosticsProducingTypeChecker
         };
         verifyCompilerOptions();
@@ -37731,11 +37732,14 @@ var ts;
                 getSourceFile: program.getSourceFile,
                 getSourceFileByPath: program.getSourceFileByPath,
                 getSourceFiles: program.getSourceFiles,
-                isSourceFileFromExternalLibrary: function (file) { return !!sourceFilesFoundSearchingNodeModules[file.path]; },
+                isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
                 writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }),
                 isEmitBlocked: isEmitBlocked
             };
         }
+        function isSourceFileFromExternalLibrary(file) {
+            return sourceFilesFoundSearchingNodeModules[file.path];
+        }
         function getDiagnosticsProducingTypeChecker() {
             return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, true));
         }
diff --git a/lib/tsserver.js b/lib/tsserver.js
index 9ce9c5c..fc1307a 100644
--- a/lib/tsserver.js
+++ b/lib/tsserver.js
@@ -1694,7 +1694,7 @@ var ts;
                 },
                 readFile: readFile,
                 writeFile: writeFile,
-                watchFile: function (fileName, callback) {
+                watchFile: function (fileName, callback, pollingInterval) {
                     if (useNonPollingWatchers) {
                         var watchedFile_1 = watchedFileSet.addFile(fileName, callback);
                         return {
@@ -1702,7 +1702,7 @@ var ts;
                         };
                     }
                     else {
-                        _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged);
+                        _fs.watchFile(fileName, { persistent: true, interval: pollingInterval || 250 }, fileChanged);
                         return {
                             close: function () { return _fs.unwatchFile(fileName, fileChanged); }
                         };
@@ -5145,7 +5145,7 @@ var ts;
             mergeTypings(typingOptions.include);
             exclude = typingOptions.exclude || [];
             var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath);
-            if (projectRootPath !== undefined) {
+            if (projectRootPath) {
                 possibleSearchDirs.push(projectRootPath);
             }
             searchDirs = ts.deduplicate(possibleSearchDirs);
@@ -5265,6 +5265,32 @@ var ts;
 (function (ts) {
     var server;
     (function (server) {
+        server.ActionSet = "action::set";
+        server.ActionInvalidate = "action::invalidate";
+        server.EventInstall = "event::install";
+        var Arguments;
+        (function (Arguments) {
+            Arguments.GlobalCacheLocation = "--globalTypingsCacheLocation";
+            Arguments.LogFile = "--logFile";
+            Arguments.EnableTelemetry = "--enableTelemetry";
+        })(Arguments = server.Arguments || (server.Arguments = {}));
+        function hasArgument(argumentName) {
+            return ts.sys.args.indexOf(argumentName) >= 0;
+        }
+        server.hasArgument = hasArgument;
+        function findArgument(argumentName) {
+            var index = ts.sys.args.indexOf(argumentName);
+            return index >= 0 && index < ts.sys.args.length - 1
+                ? ts.sys.args[index + 1]
+                : undefined;
+        }
+        server.findArgument = findArgument;
+    })(server = ts.server || (ts.server = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+    var server;
+    (function (server) {
         (function (LogLevel) {
             LogLevel[LogLevel["terse"] = 0] = "terse";
             LogLevel[LogLevel["normal"] = 1] = "normal";
@@ -5293,7 +5319,7 @@ var ts;
         function createInstallTypingsRequest(project, typingOptions, cachePath) {
             return {
                 projectName: project.getProjectName(),
-                fileNames: project.getFileNames(),
+                fileNames: project.getFileNames(true),
                 compilerOptions: project.getCompilerOptions(),
                 typingOptions: typingOptions,
                 projectRootPath: getProjectRootPath(project),
@@ -38527,7 +38553,7 @@ var ts;
 })(ts || (ts = {}));
 var ts;
 (function (ts) {
-    ts.version = "2.0.7";
+    ts.version = "2.0.8";
     var emptyArray = [];
     function findConfigFile(searchPath, fileExists, configName) {
         if (configName === void 0) { configName = "tsconfig.json"; }
@@ -38981,6 +39007,7 @@ var ts;
             getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); },
             getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; },
             getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; },
+            isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
             dropDiagnosticsProducingTypeChecker: dropDiagnosticsProducingTypeChecker
         };
         verifyCompilerOptions();
@@ -39120,11 +39147,14 @@ var ts;
                 getSourceFile: program.getSourceFile,
                 getSourceFileByPath: program.getSourceFileByPath,
                 getSourceFiles: program.getSourceFiles,
-                isSourceFileFromExternalLibrary: function (file) { return !!sourceFilesFoundSearchingNodeModules[file.path]; },
+                isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
                 writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }),
                 isEmitBlocked: isEmitBlocked
             };
         }
+        function isSourceFileFromExternalLibrary(file) {
+            return sourceFilesFoundSearchingNodeModules[file.path];
+        }
         function getDiagnosticsProducingTypeChecker() {
             return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, true));
         }
@@ -52462,7 +52492,7 @@ var ts;
                 }
                 return this.getLanguageService().getEmitOutput(info.fileName, emitOnlyDtsFiles);
             };
-            Project.prototype.getFileNames = function () {
+            Project.prototype.getFileNames = function (excludeFilesFromExternalLibraries) {
                 if (!this.program) {
                     return [];
                 }
@@ -52476,8 +52506,15 @@ var ts;
                     }
                     return rootFiles;
                 }
-                var sourceFiles = this.program.getSourceFiles();
-                return sourceFiles.map(function (sourceFile) { return server.asNormalizedPath(sourceFile.fileName); });
+                var result = [];
+                for (var _i = 0, _a = this.program.getSourceFiles(); _i < _a.length; _i++) {
+                    var f = _a[_i];
+                    if (excludeFilesFromExternalLibraries && this.program.isSourceFileFromExternalLibrary(f)) {
+                        continue;
+                    }
+                    result.push(server.asNormalizedPath(f.fileName));
+                }
+                return result;
             };
             Project.prototype.getAllEmittableFiles = function () {
                 if (!this.languageServiceEnabled) {
@@ -53067,11 +53104,11 @@ var ts;
                     return;
                 }
                 switch (response.kind) {
-                    case "set":
+                    case server.ActionSet:
                         this.typingsCache.updateTypingsForProject(response.projectName, response.compilerOptions, response.typingOptions, response.typings);
                         project.updateGraph();
                         break;
-                    case "invalidate":
+                    case server.ActionInvalidate:
                         this.typingsCache.invalidateCachedTypingsForProject(project);
                         break;
                 }
@@ -56241,8 +56278,9 @@ var ts;
             return Logger;
         }());
         var NodeTypingsInstaller = (function () {
-            function NodeTypingsInstaller(logger, eventPort, globalTypingsCacheLocation, newLine) {
+            function NodeTypingsInstaller(telemetryEnabled, logger, eventPort, globalTypingsCacheLocation, newLine) {
                 var _this = this;
+                this.telemetryEnabled = telemetryEnabled;
                 this.logger = logger;
                 this.eventPort = eventPort;
                 this.globalTypingsCacheLocation = globalTypingsCacheLocation;
@@ -56253,15 +56291,21 @@ var ts;
                     });
                 }
             }
+            NodeTypingsInstaller.prototype.setTelemetrySender = function (telemetrySender) {
+                this.telemetrySender = telemetrySender;
+            };
             NodeTypingsInstaller.prototype.attach = function (projectService) {
                 var _this = this;
                 this.projectService = projectService;
                 if (this.logger.hasLevel(server.LogLevel.requestTime)) {
                     this.logger.info("Binding...");
                 }
-                var args = ["--globalTypingsCacheLocation", this.globalTypingsCacheLocation];
+                var args = [server.Arguments.GlobalCacheLocation, this.globalTypingsCacheLocation];
+                if (this.telemetryEnabled) {
+                    args.push(server.Arguments.EnableTelemetry);
+                }
                 if (this.logger.loggingEnabled() && this.logger.getLogFileName()) {
-                    args.push("--logFile", ts.combinePaths(ts.getDirectoryPath(ts.normalizeSlashes(this.logger.getLogFileName())), "ti-" + process.pid + ".log"));
+                    args.push(server.Arguments.LogFile, ts.combinePaths(ts.getDirectoryPath(ts.normalizeSlashes(this.logger.getLogFileName())), "ti-" + process.pid + ".log"));
                 }
                 var execArgv = [];
                 {
@@ -56297,8 +56341,21 @@ var ts;
                 if (this.logger.hasLevel(server.LogLevel.verbose)) {
                     this.logger.info("Received response: " + JSON.stringify(response));
                 }
+                if (response.kind === server.EventInstall) {
+                    if (this.telemetrySender) {
+                        var body = {
+                            telemetryEventName: "typingsInstalled",
+                            payload: {
+                                installedPackages: response.packagesToInstall.join(",")
+                            }
+                        };
+                        var eventName = "telemetry";
+                        this.telemetrySender.event(body, eventName);
+                    }
+                    return;
+                }
                 this.projectService.updateTypingsForProject(response);
-                if (response.kind == "set" && this.socket) {
+                if (response.kind == server.ActionSet && this.socket) {
                     this.socket.write(server.formatMessage({ seq: 0, type: "event", message: response }, this.logger, Buffer.byteLength, this.newLine), "utf8");
                 }
             };
@@ -56306,10 +56363,14 @@ var ts;
         }());
         var IOSession = (function (_super) {
             __extends(IOSession, _super);
-            function IOSession(host, cancellationToken, installerEventPort, canUseEvents, useSingleInferredProject, disableAutomaticTypingAcquisition, globalTypingsCacheLocation, logger) {
-                _super.call(this, host, cancellationToken, useSingleInferredProject, disableAutomaticTypingAcquisition
-                    ? server.nullTypingsInstaller
-                    : new NodeTypingsInstaller(logger, installerEventPort, globalTypingsCacheLocation, host.newLine), Buffer.byteLength, process.hrtime, logger, canUseEvents);
+            function IOSession(host, cancellationToken, installerEventPort, canUseEvents, useSingleInferredProject, disableAutomaticTypingAcquisition, globalTypingsCacheLocation, telemetryEnabled, logger) {
+                var typingsInstaller = disableAutomaticTypingAcquisition
+                    ? undefined
+                    : new NodeTypingsInstaller(telemetryEnabled, logger, installerEventPort, globalTypingsCacheLocation, host.newLine);
+                _super.call(this, host, cancellationToken, useSingleInferredProject, typingsInstaller || server.nullTypingsInstaller, Buffer.byteLength, process.hrtime, logger, canUseEvents);
+                if (telemetryEnabled && typingsInstaller) {
+                    typingsInstaller.setTelemetrySender(this);
+                }
             }
             IOSession.prototype.exit = function () {
                 this.logger.info("Exiting...");
@@ -56489,17 +56550,16 @@ var ts;
         ;
         var eventPort;
         {
-            var index = sys.args.indexOf("--eventPort");
-            if (index >= 0 && index < sys.args.length - 1) {
-                var v = parseInt(sys.args[index + 1]);
-                if (!isNaN(v)) {
-                    eventPort = v;
-                }
+            var str = server.findArgument("--eventPort");
+            var v = str && parseInt(str);
+            if (!isNaN(v)) {
+                eventPort = v;
             }
         }
-        var useSingleInferredProject = sys.args.indexOf("--useSingleInferredProject") >= 0;
-        var disableAutomaticTypingAcquisition = sys.args.indexOf("--disableAutomaticTypingAcquisition") >= 0;
-        var ioSession = new IOSession(sys, cancellationToken, eventPort, eventPort === undefined, useSingleInferredProject, disableAutomaticTypingAcquisition, getGlobalTypingsCacheLocation(), logger);
+        var useSingleInferredProject = server.hasArgument("--useSingleInferredProject");
+        var disableAutomaticTypingAcquisition = server.hasArgument("--disableAutomaticTypingAcquisition");
+        var telemetryEnabled = server.hasArgument(server.Arguments.EnableTelemetry);
+        var ioSession = new IOSession(sys, cancellationToken, eventPort, eventPort === undefined, useSingleInferredProject, disableAutomaticTypingAcquisition, getGlobalTypingsCacheLocation(), telemetryEnabled, logger);
         process.on("uncaughtException", function (err) {
             ioSession.logError(err, "unknown");
         });
diff --git a/lib/tsserverlibrary.d.ts b/lib/tsserverlibrary.d.ts
index a07ac62..80b05d8 100644
--- a/lib/tsserverlibrary.d.ts
+++ b/lib/tsserverlibrary.d.ts
@@ -647,6 +647,23 @@ declare namespace ts.server.protocol {
         spans: TextSpan[];
         childItems?: NavigationTree[];
     }
+    type TelemetryEventName = "telemetry";
+    interface TelemetryEvent extends Event {
+        event: TelemetryEventName;
+        body: TelemetryEventBody;
+    }
+    interface TelemetryEventBody {
+        telemetryEventName: string;
+        payload: any;
+    }
+    type TypingsInstalledTelemetryEventName = "typingsInstalled";
+    interface TypingsInstalledTelemetryEventBody extends TelemetryEventBody {
+        telemetryEventName: TypingsInstalledTelemetryEventName;
+        payload: TypingsInstalledTelemetryEventPayload;
+    }
+    interface TypingsInstalledTelemetryEventPayload {
+        installedPackages: string;
+    }
     interface NavBarResponse extends Response {
         body?: NavigationBarItem[];
     }
@@ -1974,6 +1991,7 @@ declare namespace ts {
         getTypeCount(): number;
         getFileProcessingDiagnostics(): DiagnosticCollection;
         getResolvedTypeReferenceDirectives(): Map<ResolvedTypeReferenceDirective>;
+        isSourceFileFromExternalLibrary(file: SourceFile): boolean;
         structureIsReused?: boolean;
     }
     interface SourceMapSpan {
@@ -3096,7 +3114,7 @@ declare namespace ts {
         readFile(path: string, encoding?: string): string;
         getFileSize?(path: string): number;
         writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
-        watchFile?(path: string, callback: FileWatcherCallback): FileWatcher;
+        watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher;
         watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
         resolvePath(path: string): string;
         fileExists(path: string): boolean;
@@ -7814,6 +7832,18 @@ declare namespace ts.JsTyping {
     };
 }
 declare namespace ts.server {
+    const ActionSet: ActionSet;
+    const ActionInvalidate: ActionInvalidate;
+    const EventInstall: EventInstall;
+    namespace Arguments {
+        const GlobalCacheLocation: string;
+        const LogFile: string;
+        const EnableTelemetry: string;
+    }
+    function hasArgument(argumentName: string): boolean;
+    function findArgument(argumentName: string): string;
+}
+declare namespace ts.server {
     enum LogLevel {
         terse = 0,
         normal = 1,
@@ -9513,7 +9543,7 @@ declare namespace ts.server {
         getRootScriptInfos(): ScriptInfo[];
         getScriptInfos(): ScriptInfo[];
         getFileEmitOutput(info: ScriptInfo, emitOnlyDtsFiles: boolean): EmitOutput;
-        getFileNames(): NormalizedPath[];
+        getFileNames(excludeFilesFromExternalLibraries?: boolean): NormalizedPath[];
         getAllEmittableFiles(): string[];
         containsScriptInfo(info: ScriptInfo): boolean;
         containsFile(filename: NormalizedPath, requireOpen?: boolean): boolean;
@@ -9702,6 +9732,9 @@ declare namespace ts.server {
         fileName: NormalizedPath;
         project: Project;
     }
+    interface EventSender {
+        event(payload: any, eventName: string): void;
+    }
     namespace CommandNames {
         const Brace: protocol.CommandTypes.Brace;
         const BraceFull: protocol.CommandTypes.BraceFull;
@@ -9768,7 +9801,7 @@ declare namespace ts.server {
         const CompilerOptionsForInferredProjects: protocol.CommandTypes.CompilerOptionsForInferredProjects;
     }
     function formatMessage<T extends protocol.Message>(msg: T, logger: server.Logger, byteLength: (s: string, encoding: string) => number, newLine: string): string;
-    class Session {
+    class Session implements EventSender {
         private host;
         protected readonly typingsInstaller: ITypingsInstaller;
         private byteLength;
diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js
index 8b468b4..4fc9ce8 100644
--- a/lib/tsserverlibrary.js
+++ b/lib/tsserverlibrary.js
@@ -1694,7 +1694,7 @@ var ts;
                 },
                 readFile: readFile,
                 writeFile: writeFile,
-                watchFile: function (fileName, callback) {
+                watchFile: function (fileName, callback, pollingInterval) {
                     if (useNonPollingWatchers) {
                         var watchedFile_1 = watchedFileSet.addFile(fileName, callback);
                         return {
@@ -1702,7 +1702,7 @@ var ts;
                         };
                     }
                     else {
-                        _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged);
+                        _fs.watchFile(fileName, { persistent: true, interval: pollingInterval || 250 }, fileChanged);
                         return {
                             close: function () { return _fs.unwatchFile(fileName, fileChanged); }
                         };
@@ -5145,7 +5145,7 @@ var ts;
             mergeTypings(typingOptions.include);
             exclude = typingOptions.exclude || [];
             var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath);
-            if (projectRootPath !== undefined) {
+            if (projectRootPath) {
                 possibleSearchDirs.push(projectRootPath);
             }
             searchDirs = ts.deduplicate(possibleSearchDirs);
@@ -5265,6 +5265,32 @@ var ts;
 (function (ts) {
     var server;
     (function (server) {
+        server.ActionSet = "action::set";
+        server.ActionInvalidate = "action::invalidate";
+        server.EventInstall = "event::install";
+        var Arguments;
+        (function (Arguments) {
+            Arguments.GlobalCacheLocation = "--globalTypingsCacheLocation";
+            Arguments.LogFile = "--logFile";
+            Arguments.EnableTelemetry = "--enableTelemetry";
+        })(Arguments = server.Arguments || (server.Arguments = {}));
+        function hasArgument(argumentName) {
+            return ts.sys.args.indexOf(argumentName) >= 0;
+        }
+        server.hasArgument = hasArgument;
+        function findArgument(argumentName) {
+            var index = ts.sys.args.indexOf(argumentName);
+            return index >= 0 && index < ts.sys.args.length - 1
+                ? ts.sys.args[index + 1]
+                : undefined;
+        }
+        server.findArgument = findArgument;
+    })(server = ts.server || (ts.server = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+    var server;
+    (function (server) {
         (function (LogLevel) {
             LogLevel[LogLevel["terse"] = 0] = "terse";
             LogLevel[LogLevel["normal"] = 1] = "normal";
@@ -5293,7 +5319,7 @@ var ts;
         function createInstallTypingsRequest(project, typingOptions, cachePath) {
             return {
                 projectName: project.getProjectName(),
-                fileNames: project.getFileNames(),
+                fileNames: project.getFileNames(true),
                 compilerOptions: project.getCompilerOptions(),
                 typingOptions: typingOptions,
                 projectRootPath: getProjectRootPath(project),
@@ -38527,7 +38553,7 @@ var ts;
 })(ts || (ts = {}));
 var ts;
 (function (ts) {
-    ts.version = "2.0.7";
+    ts.version = "2.0.8";
     var emptyArray = [];
     function findConfigFile(searchPath, fileExists, configName) {
         if (configName === void 0) { configName = "tsconfig.json"; }
@@ -38981,6 +39007,7 @@ var ts;
             getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); },
             getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; },
             getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; },
+            isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
             dropDiagnosticsProducingTypeChecker: dropDiagnosticsProducingTypeChecker
         };
         verifyCompilerOptions();
@@ -39120,11 +39147,14 @@ var ts;
                 getSourceFile: program.getSourceFile,
                 getSourceFileByPath: program.getSourceFileByPath,
                 getSourceFiles: program.getSourceFiles,
-                isSourceFileFromExternalLibrary: function (file) { return !!sourceFilesFoundSearchingNodeModules[file.path]; },
+                isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
                 writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }),
                 isEmitBlocked: isEmitBlocked
             };
         }
+        function isSourceFileFromExternalLibrary(file) {
+            return sourceFilesFoundSearchingNodeModules[file.path];
+        }
         function getDiagnosticsProducingTypeChecker() {
             return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, true));
         }
@@ -52462,7 +52492,7 @@ var ts;
                 }
                 return this.getLanguageService().getEmitOutput(info.fileName, emitOnlyDtsFiles);
             };
-            Project.prototype.getFileNames = function () {
+            Project.prototype.getFileNames = function (excludeFilesFromExternalLibraries) {
                 if (!this.program) {
                     return [];
                 }
@@ -52476,8 +52506,15 @@ var ts;
                     }
                     return rootFiles;
                 }
-                var sourceFiles = this.program.getSourceFiles();
-                return sourceFiles.map(function (sourceFile) { return server.asNormalizedPath(sourceFile.fileName); });
+                var result = [];
+                for (var _i = 0, _a = this.program.getSourceFiles(); _i < _a.length; _i++) {
+                    var f = _a[_i];
+                    if (excludeFilesFromExternalLibraries && this.program.isSourceFileFromExternalLibrary(f)) {
+                        continue;
+                    }
+                    result.push(server.asNormalizedPath(f.fileName));
+                }
+                return result;
             };
             Project.prototype.getAllEmittableFiles = function () {
                 if (!this.languageServiceEnabled) {
@@ -53067,11 +53104,11 @@ var ts;
                     return;
                 }
                 switch (response.kind) {
-                    case "set":
+                    case server.ActionSet:
                         this.typingsCache.updateTypingsForProject(response.projectName, response.compilerOptions, response.typingOptions, response.typings);
                         project.updateGraph();
                         break;
-                    case "invalidate":
+                    case server.ActionInvalidate:
                         this.typingsCache.invalidateCachedTypingsForProject(project);
                         break;
                 }
diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts
index ab4ffc4..39d6b74 100644
--- a/lib/typescript.d.ts
+++ b/lib/typescript.d.ts
@@ -1774,7 +1774,11 @@ declare namespace ts {
         readFile(path: string, encoding?: string): string;
         getFileSize?(path: string): number;
         writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
-        watchFile?(path: string, callback: FileWatcherCallback): FileWatcher;
+        /**
+         * @pollingInterval - this parameter is used in polling-based watchers and ignored in watchers that
+         * use native OS file watching
+         */
+        watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher;
         watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
         resolvePath(path: string): string;
         fileExists(path: string): boolean;
diff --git a/lib/typescript.js b/lib/typescript.js
index 7c73600..dd38c8e 100644
--- a/lib/typescript.js
+++ b/lib/typescript.js
@@ -2845,7 +2845,7 @@ var ts;
                 },
                 readFile: readFile,
                 writeFile: writeFile,
-                watchFile: function (fileName, callback) {
+                watchFile: function (fileName, callback, pollingInterval) {
                     if (useNonPollingWatchers) {
                         var watchedFile_1 = watchedFileSet.addFile(fileName, callback);
                         return {
@@ -2853,7 +2853,7 @@ var ts;
                         };
                     }
                     else {
-                        _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged);
+                        _fs.watchFile(fileName, { persistent: true, interval: pollingInterval || 250 }, fileChanged);
                         return {
                             close: function () { return _fs.unwatchFile(fileName, fileChanged); }
                         };
@@ -44687,7 +44687,7 @@ var ts;
 var ts;
 (function (ts) {
     /** The version of the TypeScript compiler release */
-    ts.version = "2.0.7";
+    ts.version = "2.0.8";
     var emptyArray = [];
     function findConfigFile(searchPath, fileExists, configName) {
         if (configName === void 0) { configName = "tsconfig.json"; }
@@ -45198,6 +45198,7 @@ var ts;
             getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); },
             getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; },
             getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; },
+            isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
             dropDiagnosticsProducingTypeChecker: dropDiagnosticsProducingTypeChecker
         };
         verifyCompilerOptions();
@@ -45360,11 +45361,14 @@ var ts;
                 getSourceFile: program.getSourceFile,
                 getSourceFileByPath: program.getSourceFileByPath,
                 getSourceFiles: program.getSourceFiles,
-                isSourceFileFromExternalLibrary: function (file) { return !!sourceFilesFoundSearchingNodeModules[file.path]; },
+                isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
                 writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }),
                 isEmitBlocked: isEmitBlocked
             };
         }
+        function isSourceFileFromExternalLibrary(file) {
+            return sourceFilesFoundSearchingNodeModules[file.path];
+        }
         function getDiagnosticsProducingTypeChecker() {
             return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, /*produceDiagnostics:*/ true));
         }
@@ -50402,7 +50406,7 @@ var ts;
             mergeTypings(typingOptions.include);
             exclude = typingOptions.exclude || [];
             var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath);
-            if (projectRootPath !== undefined) {
+            if (projectRootPath) {
                 possibleSearchDirs.push(projectRootPath);
             }
             searchDirs = ts.deduplicate(possibleSearchDirs);
diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts
index 5aa1673..2a99204 100644
--- a/lib/typescriptServices.d.ts
+++ b/lib/typescriptServices.d.ts
@@ -1774,7 +1774,11 @@ declare namespace ts {
         readFile(path: string, encoding?: string): string;
         getFileSize?(path: string): number;
         writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
-        watchFile?(path: string, callback: FileWatcherCallback): FileWatcher;
+        /**
+         * @pollingInterval - this parameter is used in polling-based watchers and ignored in watchers that
+         * use native OS file watching
+         */
+        watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher;
         watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
         resolvePath(path: string): string;
         fileExists(path: string): boolean;
diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js
index 7c73600..dd38c8e 100644
--- a/lib/typescriptServices.js
+++ b/lib/typescriptServices.js
@@ -2845,7 +2845,7 @@ var ts;
                 },
                 readFile: readFile,
                 writeFile: writeFile,
-                watchFile: function (fileName, callback) {
+                watchFile: function (fileName, callback, pollingInterval) {
                     if (useNonPollingWatchers) {
                         var watchedFile_1 = watchedFileSet.addFile(fileName, callback);
                         return {
@@ -2853,7 +2853,7 @@ var ts;
                         };
                     }
                     else {
-                        _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged);
+                        _fs.watchFile(fileName, { persistent: true, interval: pollingInterval || 250 }, fileChanged);
                         return {
                             close: function () { return _fs.unwatchFile(fileName, fileChanged); }
                         };
@@ -44687,7 +44687,7 @@ var ts;
 var ts;
 (function (ts) {
     /** The version of the TypeScript compiler release */
-    ts.version = "2.0.7";
+    ts.version = "2.0.8";
     var emptyArray = [];
     function findConfigFile(searchPath, fileExists, configName) {
         if (configName === void 0) { configName = "tsconfig.json"; }
@@ -45198,6 +45198,7 @@ var ts;
             getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); },
             getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; },
             getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; },
+            isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
             dropDiagnosticsProducingTypeChecker: dropDiagnosticsProducingTypeChecker
         };
         verifyCompilerOptions();
@@ -45360,11 +45361,14 @@ var ts;
                 getSourceFile: program.getSourceFile,
                 getSourceFileByPath: program.getSourceFileByPath,
                 getSourceFiles: program.getSourceFiles,
-                isSourceFileFromExternalLibrary: function (file) { return !!sourceFilesFoundSearchingNodeModules[file.path]; },
+                isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
                 writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }),
                 isEmitBlocked: isEmitBlocked
             };
         }
+        function isSourceFileFromExternalLibrary(file) {
+            return sourceFilesFoundSearchingNodeModules[file.path];
+        }
         function getDiagnosticsProducingTypeChecker() {
             return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, /*produceDiagnostics:*/ true));
         }
@@ -50402,7 +50406,7 @@ var ts;
             mergeTypings(typingOptions.include);
             exclude = typingOptions.exclude || [];
             var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath);
-            if (projectRootPath !== undefined) {
+            if (projectRootPath) {
                 possibleSearchDirs.push(projectRootPath);
             }
             searchDirs = ts.deduplicate(possibleSearchDirs);
diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js
index 3fcd60a..fdbb477 100644
--- a/lib/typingsInstaller.js
+++ b/lib/typingsInstaller.js
@@ -1694,7 +1694,7 @@ var ts;
                 },
                 readFile: readFile,
                 writeFile: writeFile,
-                watchFile: function (fileName, callback) {
+                watchFile: function (fileName, callback, pollingInterval) {
                     if (useNonPollingWatchers) {
                         var watchedFile_1 = watchedFileSet.addFile(fileName, callback);
                         return {
@@ -1702,7 +1702,7 @@ var ts;
                         };
                     }
                     else {
-                        _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged);
+                        _fs.watchFile(fileName, { persistent: true, interval: pollingInterval || 250 }, fileChanged);
                         return {
                             close: function () { return _fs.unwatchFile(fileName, fileChanged); }
                         };
@@ -5145,7 +5145,7 @@ var ts;
             mergeTypings(typingOptions.include);
             exclude = typingOptions.exclude || [];
             var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath);
-            if (projectRootPath !== undefined) {
+            if (projectRootPath) {
                 possibleSearchDirs.push(projectRootPath);
             }
             searchDirs = ts.deduplicate(possibleSearchDirs);
@@ -5263,6 +5263,32 @@ var ts;
 })(ts || (ts = {}));
 var ts;
 (function (ts) {
+    var server;
+    (function (server) {
+        server.ActionSet = "action::set";
+        server.ActionInvalidate = "action::invalidate";
+        server.EventInstall = "event::install";
+        var Arguments;
+        (function (Arguments) {
+            Arguments.GlobalCacheLocation = "--globalTypingsCacheLocation";
+            Arguments.LogFile = "--logFile";
+            Arguments.EnableTelemetry = "--enableTelemetry";
+        })(Arguments = server.Arguments || (server.Arguments = {}));
+        function hasArgument(argumentName) {
+            return ts.sys.args.indexOf(argumentName) >= 0;
+        }
+        server.hasArgument = hasArgument;
+        function findArgument(argumentName) {
+            var index = ts.sys.args.indexOf(argumentName);
+            return index >= 0 && index < ts.sys.args.length - 1
+                ? ts.sys.args[index + 1]
+                : undefined;
+        }
+        server.findArgument = findArgument;
+    })(server = ts.server || (ts.server = {}));
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
     function tryReadTypesSection(packageJsonPath, baseDirectory, state) {
         var jsonContent = ts.readJson(packageJsonPath, state.host);
         function tryReadFromField(fieldName) {
@@ -5734,12 +5760,13 @@ var ts;
             }
             typingsInstaller.validatePackageName = validatePackageName;
             var TypingsInstaller = (function () {
-                function TypingsInstaller(installTypingHost, globalCachePath, safeListPath, throttleLimit, log) {
+                function TypingsInstaller(installTypingHost, globalCachePath, safeListPath, throttleLimit, telemetryEnabled, log) {
                     if (log === void 0) { log = nullLog; }
                     this.installTypingHost = installTypingHost;
                     this.globalCachePath = globalCachePath;
                     this.safeListPath = safeListPath;
                     this.throttleLimit = throttleLimit;
+                    this.telemetryEnabled = telemetryEnabled;
                     this.log = log;
                     this.packageNameToTypingLocation = ts.createMap();
                     this.missingTypingsSet = ts.createMap();
@@ -5926,6 +5953,12 @@ var ts;
                     var requestId = this.installRunCount;
                     this.installRunCount++;
                     this.installTypingsAsync(requestId, scopedTypings, cachePath, function (ok) {
+                        if (_this.telemetryEnabled) {
+                            _this.sendResponse({
+                                kind: server.EventInstall,
+                                packagesToInstall: scopedTypings
+                            });
+                        }
                         if (!ok) {
                             return;
                         }
@@ -5978,10 +6011,10 @@ var ts;
                                 _this.log.writeLine("Got FS notification for " + f + ", handler is already invoked '" + isInvoked + "'");
                             }
                             if (!isInvoked) {
-                                _this.sendResponse({ projectName: projectName, kind: "invalidate" });
+                                _this.sendResponse({ projectName: projectName, kind: server.ActionInvalidate });
                                 isInvoked = true;
                             }
-                        });
+                        }, 2000);
                         watchers.push(w);
                     }
                     this.projectWatchers[projectName] = watchers;
@@ -5992,7 +6025,7 @@ var ts;
                         typingOptions: request.typingOptions,
                         compilerOptions: request.compilerOptions,
                         typings: typings,
-                        kind: "set"
+                        kind: server.ActionSet
                     };
                 };
                 TypingsInstaller.prototype.installTypingsAsync = function (requestId, args, cwd, onRequestCompleted) {
@@ -6073,8 +6106,8 @@ var ts;
             }
             var NodeTypingsInstaller = (function (_super) {
                 __extends(NodeTypingsInstaller, _super);
-                function NodeTypingsInstaller(globalTypingsCacheLocation, throttleLimit, log) {
-                    _super.call(this, ts.sys, globalTypingsCacheLocation, ts.toPath("typingSafeList.json", __dirname, ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)), throttleLimit, log);
+                function NodeTypingsInstaller(globalTypingsCacheLocation, throttleLimit, telemetryEnabled, log) {
+                    _super.call(this, ts.sys, globalTypingsCacheLocation, ts.toPath("typingSafeList.json", __dirname, ts.createGetCanonicalFileName(ts.sys.useCaseSensitiveFileNames)), throttleLimit, telemetryEnabled, log);
                     if (this.log.isEnabled()) {
                         this.log.writeLine("Process id: " + process.pid);
                     }
@@ -6134,14 +6167,9 @@ var ts;
                 return NodeTypingsInstaller;
             }(typingsInstaller.TypingsInstaller));
             typingsInstaller.NodeTypingsInstaller = NodeTypingsInstaller;
-            function findArgument(argumentName) {
-                var index = ts.sys.args.indexOf(argumentName);
-                return index >= 0 && index < ts.sys.args.length - 1
-                    ? ts.sys.args[index + 1]
-                    : undefined;
-            }
-            var logFilePath = findArgument("--logFile");
-            var globalTypingsCacheLocation = findArgument("--globalTypingsCacheLocation");
+            var logFilePath = server.findArgument(server.Arguments.LogFile);
+            var globalTypingsCacheLocation = server.findArgument(server.Arguments.GlobalCacheLocation);
+            var telemetryEnabled = server.hasArgument(server.Arguments.EnableTelemetry);
             var log = new FileLog(logFilePath);
             if (log.isEnabled()) {
                 process.on("uncaughtException", function (e) {
@@ -6154,7 +6182,7 @@ var ts;
                 }
                 process.exit(0);
             });
-            var installer = new NodeTypingsInstaller(globalTypingsCacheLocation, 5, log);
+            var installer = new NodeTypingsInstaller(globalTypingsCacheLocation, 5, telemetryEnabled, log);
             installer.listen();
         })(typingsInstaller = server.typingsInstaller || (server.typingsInstaller = {}));
     })(server = ts.server || (ts.server = {}));
diff --git a/package.json b/package.json
index a5792ee..3857f31 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
     "name": "typescript",
     "author": "Microsoft Corp.",
     "homepage": "http://typescriptlang.org/",
-    "version": "2.0.7",
+    "version": "2.0.8",
     "license": "Apache-2.0",
     "description": "TypeScript is a language for application scale JavaScript development",
     "keywords": [
diff --git a/src/compiler/program.ts b/src/compiler/program.ts
index 904577c..f3f3d15 100644
--- a/src/compiler/program.ts
+++ b/src/compiler/program.ts
@@ -5,7 +5,7 @@
 namespace ts {
     /** The version of the TypeScript compiler release */
 
-    export const version = "2.0.7";
+    export const version = "2.0.8";
 
     const emptyArray: any[] = [];
 
@@ -596,6 +596,7 @@ namespace ts {
             getTypeCount: () => getDiagnosticsProducingTypeChecker().getTypeCount(),
             getFileProcessingDiagnostics: () => fileProcessingDiagnostics,
             getResolvedTypeReferenceDirectives: () => resolvedTypeReferenceDirectives,
+            isSourceFileFromExternalLibrary,
             dropDiagnosticsProducingTypeChecker
         };
 
@@ -781,13 +782,17 @@ namespace ts {
                 getSourceFile: program.getSourceFile,
                 getSourceFileByPath: program.getSourceFileByPath,
                 getSourceFiles: program.getSourceFiles,
-                isSourceFileFromExternalLibrary: (file: SourceFile) => !!sourceFilesFoundSearchingNodeModules[file.path],
+                isSourceFileFromExternalLibrary,
                 writeFile: writeFileCallback || (
                     (fileName, data, writeByteOrderMark, onError, sourceFiles) => host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles)),
                 isEmitBlocked,
             };
         }
 
+        function isSourceFileFromExternalLibrary(file: SourceFile): boolean {
+            return sourceFilesFoundSearchingNodeModules[file.path];
+        }
+
         function getDiagnosticsProducingTypeChecker() {
             return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = createTypeChecker(program, /*produceDiagnostics:*/ true));
         }
diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts
index 318573c..f7774df 100644
--- a/src/compiler/sys.ts
+++ b/src/compiler/sys.ts
@@ -17,7 +17,11 @@ namespace ts {
         readFile(path: string, encoding?: string): string;
         getFileSize?(path: string): number;
         writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
-        watchFile?(path: string, callback: FileWatcherCallback): FileWatcher;
+        /**
+         * @pollingInterval - this parameter is used in polling-based watchers and ignored in watchers that 
+         * use native OS file watching
+         */
+        watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher;
         watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
         resolvePath(path: string): string;
         fileExists(path: string): boolean;
@@ -444,7 +448,7 @@ namespace ts {
                 },
                 readFile,
                 writeFile,
-                watchFile: (fileName, callback) => {
+                watchFile: (fileName, callback, pollingInterval) => {
                     if (useNonPollingWatchers) {
                         const watchedFile = watchedFileSet.addFile(fileName, callback);
                         return {
@@ -452,7 +456,7 @@ namespace ts {
                         };
                     }
                     else {
-                        _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged);
+                        _fs.watchFile(fileName, { persistent: true, interval: pollingInterval || 250 }, fileChanged);
                         return {
                             close: () => _fs.unwatchFile(fileName, fileChanged)
                         };
diff --git a/src/compiler/types.ts b/src/compiler/types.ts
index 90c1899..f35f073 100644
--- a/src/compiler/types.ts
+++ b/src/compiler/types.ts
@@ -1788,6 +1788,7 @@ namespace ts {
 
         /* @internal */ getFileProcessingDiagnostics(): DiagnosticCollection;
         /* @internal */ getResolvedTypeReferenceDirectives(): Map<ResolvedTypeReferenceDirective>;
+        /* @internal */ isSourceFileFromExternalLibrary(file: SourceFile): boolean;
         // For testing purposes only.
         /* @internal */ structureIsReused?: boolean;
     }
diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts
index be161c4..3f36014 100644
--- a/src/harness/unittests/tsserverProjectSystem.ts
+++ b/src/harness/unittests/tsserverProjectSystem.ts
@@ -54,8 +54,9 @@ namespace ts.projectSystem {
             throttleLimit: number,
             installTypingHost: server.ServerHost,
             readonly typesRegistry = createMap<void>(),
+            telemetryEnabled?: boolean,
             log?: TI.Log) {
-            super(installTypingHost, globalTypingsCacheLocation, safeList.path, throttleLimit, log);
+            super(installTypingHost, globalTypingsCacheLocation, safeList.path, throttleLimit, telemetryEnabled, log);
         }
 
         safeFileList = safeList.path;
diff --git a/src/harness/unittests/typingsInstaller.ts b/src/harness/unittests/typingsInstaller.ts
index dec8a9c..ef2208f 100644
--- a/src/harness/unittests/typingsInstaller.ts
+++ b/src/harness/unittests/typingsInstaller.ts
@@ -20,12 +20,13 @@ namespace ts.projectSystem {
     }
 
     class Installer extends TestTypingsInstaller {
-        constructor(host: server.ServerHost, p?: InstallerParams, log?: TI.Log) {
+        constructor(host: server.ServerHost, p?: InstallerParams, telemetryEnabled?: boolean, log?: TI.Log) {
             super(
                 (p && p.globalTypingsCacheLocation) || "/a/data",
                 (p && p.throttleLimit) || 5,
                 host,
                 (p && p.typesRegistry),
+                telemetryEnabled,
                 log);
         }
 
@@ -35,15 +36,16 @@ namespace ts.projectSystem {
         }
     }
 
+    function executeCommand(self: Installer, host: TestServerHost, installedTypings: string[], typingFiles: FileOrFolder[], cb: TI.RequestCompletedAction): void {
+        self.addPostExecAction(installedTypings, success => {
+            for (const file of typingFiles) {
+                host.createFileOrFolder(file, /*createParentDirectory*/ true);
+            }
+            cb(success);
+        });
+    }
+
     describe("typingsInstaller", () => {
-        function executeCommand(self: Installer, host: TestServerHost, installedTypings: string[], typingFiles: FileOrFolder[], cb: TI.RequestCompletedAction): void {
-            self.addPostExecAction(installedTypings, success => {
-                for (const file of typingFiles) {
-                    host.createFileOrFolder(file, /*createParentDirectory*/ true);
-                }
-                cb(success);
-            });
-        }
         it("configured projects (typings installed) 1", () => {
             const file1 = {
                 path: "/a/b/app.js",
@@ -782,7 +784,7 @@ namespace ts.projectSystem {
             const host = createServerHost([f1, packageJson]);
             const installer = new (class extends Installer {
                 constructor() {
-                    super(host, { globalTypingsCacheLocation: "/tmp" }, { isEnabled: () => true, writeLine: msg => messages.push(msg) });
+                    super(host, { globalTypingsCacheLocation: "/tmp" }, /*telemetryEnabled*/ false, { isEnabled: () => true, writeLine: msg => messages.push(msg) });
                 }
                 installWorker(requestId: number, args: string[], cwd: string, cb: server.typingsInstaller.RequestCompletedAction) {
                     assert(false, "runCommand should not be invoked");
@@ -795,4 +797,50 @@ namespace ts.projectSystem {
             assert.isTrue(messages.indexOf("Package name '; say ‘Hello from TypeScript!’ #' contains non URI safe characters") > 0, "should find package with invalid name");
         });
     });
+
+    describe("telemetry events", () => {
+        it ("should be received", () => {
+            const f1 = {
+                path: "/a/app.js",
+                content: ""
+            };
+            const package = {
+                path: "/a/package.json",
+                content: JSON.stringify({ dependencies: { "commander": "1.0.0" } })
+            };
+            const cachePath = "/a/cache/";
+            const commander = {
+                path: cachePath + "node_modules/@types/commander/index.d.ts",
+                content: "export let x: number"
+            };
+            const host = createServerHost([f1, package]);
+            let seenTelemetryEvent = false;
+            const installer = new (class extends Installer {
+                constructor() {
+                    super(host, { globalTypingsCacheLocation: cachePath, typesRegistry: createTypesRegistry("commander") }, /*telemetryEnabled*/ true);
+                }
+                installWorker(requestId: number, args: string[], cwd: string, cb: server.typingsInstaller.RequestCompletedAction) {
+                    const installedTypings = ["@types/commander"];
+                    const typingFiles = [commander];
+                    executeCommand(this, host, installedTypings, typingFiles, cb);
+                }
+                sendResponse(response: server.SetTypings | server.InvalidateCachedTypings | server.TypingsInstallEvent) {
+                    if (response.kind === server.EventInstall) {
+                        assert.deepEqual(response.packagesToInstall, ["@types/commander"]);
+                        seenTelemetryEvent = true;
+                        return;
+                    }
+                    super.sendResponse(response);
+                }
+            })();
+            const projectService = createProjectService(host, { typingsInstaller: installer });
+            projectService.openClientFile(f1.path);
+
+            installer.installAll(/*expectedCount*/ 1);
+
+            assert.isTrue(seenTelemetryEvent);
+            checkNumberOfProjects(projectService, { inferredProjects: 1 });
+            checkProjectActualFiles(projectService.inferredProjects[0], [f1.path, commander.path]);
+        });
+    });
 }
\ No newline at end of file
diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts
index da9fb49..02b62a2 100644
--- a/src/server/editorServices.ts
+++ b/src/server/editorServices.ts
@@ -284,11 +284,11 @@ namespace ts.server {
                 return;
             }
             switch (response.kind) {
-                case "set":
+                case ActionSet:
                     this.typingsCache.updateTypingsForProject(response.projectName, response.compilerOptions, response.typingOptions, response.typings);
                     project.updateGraph();
                     break;
-                case "invalidate":
+                case ActionInvalidate:
                     this.typingsCache.invalidateCachedTypingsForProject(project);
                     break;
             }
diff --git a/src/server/project.ts b/src/server/project.ts
index 62f6d57..7e07dee 100644
--- a/src/server/project.ts
+++ b/src/server/project.ts
@@ -225,7 +225,7 @@ namespace ts.server {
             return this.getLanguageService().getEmitOutput(info.fileName, emitOnlyDtsFiles);
         }
 
-        getFileNames() {
+        getFileNames(excludeFilesFromExternalLibraries?: boolean) {
             if (!this.program) {
                 return [];
             }
@@ -241,8 +241,14 @@ namespace ts.server {
                 }
                 return rootFiles;
             }
-            const sourceFiles = this.program.getSourceFiles();
-            return sourceFiles.map(sourceFile => asNormalizedPath(sourceFile.fileName));
+            const result: NormalizedPath[] = [];
+            for (const f of this.program.getSourceFiles()) {
+                if (excludeFilesFromExternalLibraries && this.program.isSourceFileFromExternalLibrary(f)) {
+                    continue;
+                }
+                result.push(asNormalizedPath(f.fileName));
+            }
+            return result;
         }
 
         getAllEmittableFiles() {
diff --git a/src/server/protocol.ts b/src/server/protocol.ts
index bf4f4fd..986e030 100644
--- a/src/server/protocol.ts
+++ b/src/server/protocol.ts
@@ -1940,6 +1940,32 @@ namespace ts.server.protocol {
         childItems?: NavigationTree[];
     }
 
+    export type TelemetryEventName = "telemetry";
+
+    export interface TelemetryEvent extends Event {
+        event: TelemetryEventName;
+        body: TelemetryEventBody;
+    }
+
+    export interface TelemetryEventBody {
+        telemetryEventName: string;
+        payload: any;
+    }
+
+    export type TypingsInstalledTelemetryEventName = "typingsInstalled";
+
+    export interface TypingsInstalledTelemetryEventBody extends TelemetryEventBody {
+        telemetryEventName: TypingsInstalledTelemetryEventName;
+        payload: TypingsInstalledTelemetryEventPayload;
+    }
+
+    export interface TypingsInstalledTelemetryEventPayload {
+        /**
+         * Comma separated list of installed typing packages
+         */
+        installedPackages: string;
+    }
+
     export interface NavBarResponse extends Response {
         body?: NavigationBarItem[];
     }
diff --git a/src/server/server.ts b/src/server/server.ts
index 5949f5c..30c9a15 100644
--- a/src/server/server.ts
+++ b/src/server/server.ts
@@ -1,4 +1,5 @@
 /// <reference types="node" />
+/// <reference path="shared.ts" />
 /// <reference path="session.ts" />
 // used in fs.writeSync
 /* tslint:disable:no-null-keyword */
@@ -17,7 +18,6 @@ namespace ts.server {
         homedir(): string
     } = require("os");
 
-
     function getGlobalTypingsCacheLocation() {
         let basePath: string;
         switch (process.platform) {
@@ -189,8 +189,10 @@ namespace ts.server {
         private installer: NodeChildProcess;
         private socket: NodeSocket;
         private projectService: ProjectService;
+        private telemetrySender: EventSender;
 
         constructor(
+            private readonly telemetryEnabled: boolean,
             private readonly logger: server.Logger,
             private readonly eventPort: number,
             readonly globalTypingsCacheLocation: string,
@@ -202,15 +204,22 @@ namespace ts.server {
             }
         }
 
+        setTelemetrySender(telemetrySender: EventSender) {
+            this.telemetrySender = telemetrySender;
+        }
+
         attach(projectService: ProjectService) {
             this.projectService = projectService;
             if (this.logger.hasLevel(LogLevel.requestTime)) {
                 this.logger.info("Binding...");
             }
 
-            const args: string[] = ["--globalTypingsCacheLocation", this.globalTypingsCacheLocation];
+            const args: string[] = [Arguments.GlobalCacheLocation, this.globalTypingsCacheLocation];
+            if (this.telemetryEnabled) {
+                args.push(Arguments.EnableTelemetry);
+            }
             if (this.logger.loggingEnabled() && this.logger.getLogFileName()) {
-                args.push("--logFile", combinePaths(getDirectoryPath(normalizeSlashes(this.logger.getLogFileName())), `ti-${process.pid}.log`));
+                args.push(Arguments.LogFile, combinePaths(getDirectoryPath(normalizeSlashes(this.logger.getLogFileName())), `ti-${process.pid}.log`));
             }
             const execArgv: string[] = [];
             {
@@ -247,12 +256,25 @@ namespace ts.server {
             this.installer.send(request);
         }
 
-        private handleMessage(response: SetTypings | InvalidateCachedTypings) {
+        private handleMessage(response: SetTypings | InvalidateCachedTypings | TypingsInstallEvent) {
             if (this.logger.hasLevel(LogLevel.verbose)) {
                 this.logger.info(`Received response: ${JSON.stringify(response)}`);
             }
+            if (response.kind === EventInstall) {
+                if (this.telemetrySender) {
+                    const body: protocol.TypingsInstalledTelemetryEventBody = {
+                        telemetryEventName: "typingsInstalled",
+                        payload: {
+                            installedPackages: response.packagesToInstall.join(",")
+                        }
+                    };
+                    const eventName: protocol.TelemetryEventName = "telemetry";
+                    this.telemetrySender.event(body, eventName);
+                }
+                return;
+            }
             this.projectService.updateTypingsForProject(response);
-            if (response.kind == "set" && this.socket) {
+            if (response.kind == ActionSet && this.socket) {
                 this.socket.write(formatMessage({ seq: 0, type: "event", message: response }, this.logger, Buffer.byteLength, this.newLine), "utf8");
             }
         }
@@ -267,18 +289,25 @@ namespace ts.server {
             useSingleInferredProject: boolean,
             disableAutomaticTypingAcquisition: boolean,
             globalTypingsCacheLocation: string,
+            telemetryEnabled: boolean,
             logger: server.Logger) {
-            super(
-                host,
-                cancellationToken,
-                useSingleInferredProject,
-                disableAutomaticTypingAcquisition
-                    ? nullTypingsInstaller
-                    : new NodeTypingsInstaller(logger, installerEventPort, globalTypingsCacheLocation, host.newLine),
-                Buffer.byteLength,
-                process.hrtime,
-                logger,
-                canUseEvents);
+                const typingsInstaller = disableAutomaticTypingAcquisition
+                    ? undefined
+                    : new NodeTypingsInstaller(telemetryEnabled, logger, installerEventPort, globalTypingsCacheLocation, host.newLine);
+
+                super(
+                    host,
+                    cancellationToken,
+                    useSingleInferredProject,
+                    typingsInstaller || nullTypingsInstaller,
+                    Buffer.byteLength,
+                    process.hrtime,
+                    logger,
+                    canUseEvents);
+
+                if (telemetryEnabled && typingsInstaller) {
+                    typingsInstaller.setTelemetrySender(this);
+                }
         }
 
         exit() {
@@ -505,17 +534,17 @@ namespace ts.server {
 
     let eventPort: number;
     {
-        const index = sys.args.indexOf("--eventPort");
-        if (index >= 0 && index < sys.args.length - 1) {
-            const v = parseInt(sys.args[index + 1]);
-            if (!isNaN(v)) {
-                eventPort = v;
-            }
+        const str = findArgument("--eventPort");
+        const v = str && parseInt(str);
+        if (!isNaN(v)) {
+            eventPort = v;
         }
     }
 
-    const useSingleInferredProject = sys.args.indexOf("--useSingleInferredProject") >= 0;
-    const disableAutomaticTypingAcquisition = sys.args.indexOf("--disableAutomaticTypingAcquisition") >= 0;
+    const useSingleInferredProject = hasArgument("--useSingleInferredProject");
+    const disableAutomaticTypingAcquisition = hasArgument("--disableAutomaticTypingAcquisition");
+    const telemetryEnabled = hasArgument(Arguments.EnableTelemetry);
+
     const ioSession = new IOSession(
         sys,
         cancellationToken,
@@ -524,6 +553,7 @@ namespace ts.server {
         useSingleInferredProject,
         disableAutomaticTypingAcquisition,
         getGlobalTypingsCacheLocation(),
+        telemetryEnabled,
         logger);
     process.on("uncaughtException", function (err: Error) {
         ioSession.logError(err, "unknown");
diff --git a/src/server/session.ts b/src/server/session.ts
index 6817624..8812b1c 100644
--- a/src/server/session.ts
+++ b/src/server/session.ts
@@ -61,6 +61,10 @@ namespace ts.server {
         project: Project;
     }
 
+    export interface EventSender {
+        event(payload: any, eventName: string): void;
+    }
+
     function allEditsBeforePos(edits: ts.TextChange[], pos: number) {
         for (const edit of edits) {
             if (textSpanEnd(edit.span) >= pos) {
@@ -148,7 +152,7 @@ namespace ts.server {
         return `Content-Length: ${1 + len}\r\n\r\n${json}${newLine}`;
     }
 
-    export class Session {
+    export class Session implements EventSender {
         private readonly gcTimer: GcTimer;
         protected projectService: ProjectService;
         private errorTimer: any; /*NodeJS.Timer | number*/
diff --git a/src/server/shared.ts b/src/server/shared.ts
new file mode 100644
index 0000000..81a1f7f
--- /dev/null
+++ b/src/server/shared.ts
@@ -0,0 +1,24 @@
+/// <reference path="types.d.ts" />
+
+namespace ts.server {
+    export const ActionSet: ActionSet = "action::set";
+    export const ActionInvalidate: ActionInvalidate = "action::invalidate";
+    export const EventInstall: EventInstall = "event::install";
+
+    export namespace Arguments {
+        export const GlobalCacheLocation = "--globalTypingsCacheLocation";
+        export const LogFile = "--logFile";
+        export const EnableTelemetry = "--enableTelemetry";
+    }
+
+    export function hasArgument(argumentName: string) {
+        return sys.args.indexOf(argumentName) >= 0;
+    }
+
+    export function findArgument(argumentName: string) {
+        const index = sys.args.indexOf(argumentName);
+        return index >= 0 && index < sys.args.length - 1
+            ? sys.args[index + 1]
+            : undefined;
+    }
+}
\ No newline at end of file
diff --git a/src/server/tsconfig.json b/src/server/tsconfig.json
index fe26d0c..8741e10 100644
--- a/src/server/tsconfig.json
+++ b/src/server/tsconfig.json
@@ -15,6 +15,7 @@
     "files": [
         "../services/shims.ts",
         "../services/utilities.ts",
+        "shared.ts",
         "utilities.ts",
         "scriptVersionCache.ts",
         "scriptInfo.ts",
diff --git a/src/server/tsconfig.library.json b/src/server/tsconfig.library.json
index a450b59..0199143 100644
--- a/src/server/tsconfig.library.json
+++ b/src/server/tsconfig.library.json
@@ -12,6 +12,7 @@
     "files": [
         "../services/shims.ts",
         "../services/utilities.ts",
+        "shared.ts",
         "utilities.ts",
         "scriptVersionCache.ts",
         "scriptInfo.ts",
diff --git a/src/server/types.d.ts b/src/server/types.d.ts
index 14af59d..e6b93ca 100644
--- a/src/server/types.d.ts
+++ b/src/server/types.d.ts
@@ -36,25 +36,37 @@ declare namespace ts.server {
         readonly kind: "closeProject";
     }
 
+    export type ActionSet = "action::set";
+    export type ActionInvalidate = "action::invalidate";
+    export type EventInstall = "event::install";
+
     export interface TypingInstallerResponse {
+        readonly kind: ActionSet | ActionInvalidate | EventInstall;
+    }
+
+    export interface ProjectResponse extends TypingInstallerResponse {
         readonly projectName: string;
-        readonly kind: "set" | "invalidate";
     }
 
-    export interface SetTypings extends TypingInstallerResponse {
+    export interface SetTypings extends ProjectResponse {
         readonly typingOptions: ts.TypingOptions;
         readonly compilerOptions: ts.CompilerOptions;
         readonly typings: string[];
-        readonly kind: "set";
+        readonly kind: ActionSet;
+    }
+
+    export interface InvalidateCachedTypings extends ProjectResponse {
+        readonly kind: ActionInvalidate;
     }
 
-    export interface InvalidateCachedTypings extends TypingInstallerResponse {
-        readonly kind: "invalidate";
+    export interface TypingsInstallEvent extends TypingInstallerResponse {
+        readonly packagesToInstall: ReadonlyArray<string>;
+        readonly kind: EventInstall;
     }
 
     export interface InstallTypingHost extends JsTyping.TypingResolutionHost {
         writeFile(path: string, content: string): void;
         createDirectory(path: string): void;
-        watchFile?(path: string, callback: FileWatcherCallback): FileWatcher;
+        watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher;
     }
 }
\ No newline at end of file
diff --git a/src/server/typingsInstaller/nodeTypingsInstaller.ts b/src/server/typingsInstaller/nodeTypingsInstaller.ts
index cce894d..2e55a20 100644
--- a/src/server/typingsInstaller/nodeTypingsInstaller.ts
+++ b/src/server/typingsInstaller/nodeTypingsInstaller.ts
@@ -75,12 +75,13 @@ namespace ts.server.typingsInstaller {
         private readonly npmPath: string;
         readonly typesRegistry: Map<void>;
 
-        constructor(globalTypingsCacheLocation: string, throttleLimit: number, log: Log) {
+        constructor(globalTypingsCacheLocation: string, throttleLimit: number, telemetryEnabled: boolean, log: Log) {
             super(
                 sys,
                 globalTypingsCacheLocation,
                 toPath("typingSafeList.json", __dirname, createGetCanonicalFileName(sys.useCaseSensitiveFileNames)),
                 throttleLimit,
+                telemetryEnabled,
                 log);
             if (this.log.isEnabled()) {
                 this.log.writeLine(`Process id: ${process.pid}`);
@@ -144,15 +145,10 @@ namespace ts.server.typingsInstaller {
         }
     }
 
-    function findArgument(argumentName: string) {
-        const index = sys.args.indexOf(argumentName);
-        return index >= 0 && index < sys.args.length - 1
-            ? sys.args[index + 1]
-            : undefined;
-    }
+    const logFilePath = findArgument(server.Arguments.LogFile);
+    const globalTypingsCacheLocation = findArgument(server.Arguments.GlobalCacheLocation);
+    const telemetryEnabled = hasArgument(server.Arguments.EnableTelemetry);
 
-    const logFilePath = findArgument("--logFile");
-    const globalTypingsCacheLocation = findArgument("--globalTypingsCacheLocation");
     const log = new FileLog(logFilePath);
     if (log.isEnabled()) {
         process.on("uncaughtException", (e: Error) => {
@@ -165,6 +161,6 @@ namespace ts.server.typingsInstaller {
         }
         process.exit(0);
     });
-    const installer = new NodeTypingsInstaller(globalTypingsCacheLocation, /*throttleLimit*/5, log);
+    const installer = new NodeTypingsInstaller(globalTypingsCacheLocation, /*throttleLimit*/5, telemetryEnabled, log);
     installer.listen();
 }
\ No newline at end of file
diff --git a/src/server/typingsInstaller/tsconfig.json b/src/server/typingsInstaller/tsconfig.json
index fc4b896..a8eb732 100644
--- a/src/server/typingsInstaller/tsconfig.json
+++ b/src/server/typingsInstaller/tsconfig.json
@@ -14,6 +14,7 @@
     },
     "files": [
         "../types.d.ts",
+        "../shared.ts",
         "typingsInstaller.ts",
         "nodeTypingsInstaller.ts"
     ]
diff --git a/src/server/typingsInstaller/typingsInstaller.ts b/src/server/typingsInstaller/typingsInstaller.ts
index 9cb1e00..ad34644 100644
--- a/src/server/typingsInstaller/typingsInstaller.ts
+++ b/src/server/typingsInstaller/typingsInstaller.ts
@@ -2,6 +2,7 @@
 /// <reference path="../../compiler/moduleNameResolver.ts" />
 /// <reference path="../../services/jsTyping.ts"/>
 /// <reference path="../types.d.ts"/>
+/// <reference path="../shared.ts"/>
 
 namespace ts.server.typingsInstaller {
     interface NpmConfig {
@@ -85,6 +86,7 @@ namespace ts.server.typingsInstaller {
             readonly globalCachePath: string,
             readonly safeListPath: Path,
             readonly throttleLimit: number,
+            readonly telemetryEnabled: boolean,
             protected readonly log = nullLog) {
             if (this.log.isEnabled()) {
                 this.log.writeLine(`Global cache location '${globalCachePath}', safe file path '${safeListPath}'`);
@@ -292,9 +294,17 @@ namespace ts.server.typingsInstaller {
             this.installRunCount++;
 
             this.installTypingsAsync(requestId, scopedTypings, cachePath, ok => {
+                if (this.telemetryEnabled) {
+                    this.sendResponse(<TypingsInstallEvent>{
+                        kind: EventInstall,
+                        packagesToInstall: scopedTypings
+                    });
+                }
+
                 if (!ok) {
                     return;
                 }
+
                 // TODO: watch project directory
                 if (this.log.isEnabled()) {
                     this.log.writeLine(`Requested to install typings ${JSON.stringify(scopedTypings)}, installed typings ${JSON.stringify(scopedTypings)}`);
@@ -348,10 +358,10 @@ namespace ts.server.typingsInstaller {
                         this.log.writeLine(`Got FS notification for ${f}, handler is already invoked '${isInvoked}'`);
                     }
                     if (!isInvoked) {
-                        this.sendResponse({ projectName: projectName, kind: "invalidate" });
+                        this.sendResponse({ projectName: projectName, kind: server.ActionInvalidate });
                         isInvoked = true;
                     }
-                });
+                }, /*pollingInterval*/ 2000);
                 watchers.push(w);
             }
             this.projectWatchers[projectName] = watchers;
@@ -363,7 +373,7 @@ namespace ts.server.typingsInstaller {
                 typingOptions: request.typingOptions,
                 compilerOptions: request.compilerOptions,
                 typings,
-                kind: "set"
+                kind: server.ActionSet
             };
         }
 
@@ -385,6 +395,6 @@ namespace ts.server.typingsInstaller {
         }
 
         protected abstract installWorker(requestId: number, args: string[], cwd: string, onRequestCompleted: RequestCompletedAction): void;
-        protected abstract sendResponse(response: SetTypings | InvalidateCachedTypings): void;
+        protected abstract sendResponse(response: SetTypings | InvalidateCachedTypings | TypingsInstallEvent): void;
     }
 }
\ No newline at end of file
diff --git a/src/server/utilities.ts b/src/server/utilities.ts
index f75341b..c224644 100644
--- a/src/server/utilities.ts
+++ b/src/server/utilities.ts
@@ -1,4 +1,5 @@
 /// <reference path="types.d.ts" />
+/// <reference path="shared.ts" />
 
 namespace ts.server {
     export enum LogLevel {
@@ -10,6 +11,7 @@ namespace ts.server {
 
     export const emptyArray: ReadonlyArray<any> = [];
 
+
     export interface Logger {
         close(): void;
         hasLevel(level: LogLevel): boolean;
@@ -48,7 +50,7 @@ namespace ts.server {
     export function createInstallTypingsRequest(project: Project, typingOptions: TypingOptions, cachePath?: string): DiscoverTypings {
         return {
             projectName: project.getProjectName(),
-            fileNames: project.getFileNames(),
+            fileNames: project.getFileNames(/*excludeFilesFromExternalLibraries*/ true),
             compilerOptions: project.getCompilerOptions(),
             typingOptions,
             projectRootPath: getProjectRootPath(project),
diff --git a/src/services/jsTyping.ts b/src/services/jsTyping.ts
index afe23a6..903c663 100644
--- a/src/services/jsTyping.ts
+++ b/src/services/jsTyping.ts
@@ -77,7 +77,7 @@ namespace ts.JsTyping {
         exclude = typingOptions.exclude || [];
 
         const possibleSearchDirs = map(fileNames, getDirectoryPath);
-        if (projectRootPath !== undefined) {
+        if (projectRootPath) {
             possibleSearchDirs.push(projectRootPath);
         }
         searchDirs = deduplicate(possibleSearchDirs);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-typescript.git



More information about the Pkg-javascript-commits mailing list