Skip to content

Commit 02b9917

Browse files
Merge remote-tracking branch 'origin/master' into useReturnedThisFromSuperCalls
2 parents c29ec6f + edd8eb8 commit 02b9917

File tree

120 files changed

+272018
-196539
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+272018
-196539
lines changed

Diff for: Gulpfile.ts

+28-3
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,35 @@ gulp.task(servicesFile, false, ["lib", "generate-diagnostics"], () => {
418418
]).pipe(gulp.dest(builtLocalDirectory));
419419
});
420420

421+
// cancellationToken.js
422+
const cancellationTokenJs = path.join(builtLocalDirectory, "cancellationToken.js");
423+
gulp.task(cancellationTokenJs, false, [servicesFile], () => {
424+
const cancellationTokenProject = tsc.createProject("src/server/cancellationToken/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/true));
425+
return cancellationTokenProject.src()
426+
.pipe(newer(cancellationTokenJs))
427+
.pipe(sourcemaps.init())
428+
.pipe(tsc(cancellationTokenProject))
429+
.pipe(prependCopyright())
430+
.pipe(sourcemaps.write("."))
431+
.pipe(gulp.dest(builtLocalDirectory));
432+
});
433+
434+
// typingsInstallerFile.js
435+
const typingsInstallerJs = path.join(builtLocalDirectory, "typingsInstaller.js");
436+
gulp.task(typingsInstallerJs, false, [servicesFile], () => {
437+
const cancellationTokenProject = tsc.createProject("src/server/typingsInstaller/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/true));
438+
return cancellationTokenProject.src()
439+
.pipe(newer(typingsInstallerJs))
440+
.pipe(sourcemaps.init())
441+
.pipe(tsc(cancellationTokenProject))
442+
.pipe(prependCopyright())
443+
.pipe(sourcemaps.write("."))
444+
.pipe(gulp.dest(builtLocalDirectory));
445+
});
446+
421447
const serverFile = path.join(builtLocalDirectory, "tsserver.js");
422448

423-
gulp.task(serverFile, false, [servicesFile], () => {
449+
gulp.task(serverFile, false, [servicesFile, typingsInstallerJs, cancellationTokenJs], () => {
424450
const serverProject = tsc.createProject("src/server/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/true));
425451
return serverProject.src()
426452
.pipe(newer(serverFile))
@@ -454,7 +480,6 @@ gulp.task("lssl", "Builds language service server library", [tsserverLibraryFile
454480
gulp.task("local", "Builds the full compiler and services", [builtLocalCompiler, servicesFile, serverFile, builtGeneratedDiagnosticMessagesJSON, tsserverLibraryFile]);
455481
gulp.task("tsc", "Builds only the compiler", [builtLocalCompiler]);
456482

457-
458483
// Generate Markdown spec
459484
const word2mdJs = path.join(scriptsDirectory, "word2md.js");
460485
const word2mdTs = path.join(scriptsDirectory, "word2md.ts");
@@ -493,7 +518,7 @@ gulp.task("useDebugMode", false, [], (done) => { useDebugMode = true; done(); })
493518
gulp.task("dontUseDebugMode", false, [], (done) => { useDebugMode = false; done(); });
494519

495520
gulp.task("VerifyLKG", false, [], () => {
496-
const expectedFiles = [builtLocalCompiler, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, tsserverLibraryFile, tsserverLibraryDefinitionFile].concat(libraryTargets);
521+
const expectedFiles = [builtLocalCompiler, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, tsserverLibraryFile, tsserverLibraryDefinitionFile, typingsInstallerJs, cancellationTokenJs].concat(libraryTargets);
497522
const missingFiles = expectedFiles.filter(function(f) {
498523
return !fs.existsSync(f);
499524
});

Diff for: Jakefile.js

+53-6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ var runTestsInParallel = require("./scripts/mocha-parallel").runTestsInParallel;
1111
var compilerDirectory = "src/compiler/";
1212
var servicesDirectory = "src/services/";
1313
var serverDirectory = "src/server/";
14+
var typingsInstallerDirectory = "src/server/typingsInstaller";
15+
var cancellationTokenDirectory = "src/server/cancellationToken";
1416
var harnessDirectory = "src/harness/";
1517
var libraryDirectory = "src/lib/";
1618
var scriptsDirectory = "scripts/";
@@ -164,6 +166,13 @@ var servicesSources = [
164166
}));
165167

166168
var serverCoreSources = [
169+
"types.d.ts",
170+
"utilities.ts",
171+
"scriptVersionCache.ts",
172+
"typingsCache.ts",
173+
"scriptInfo.ts",
174+
"lsHost.ts",
175+
"project.ts",
167176
"editorServices.ts",
168177
"protocol.d.ts",
169178
"session.ts",
@@ -172,12 +181,33 @@ var serverCoreSources = [
172181
return path.join(serverDirectory, f);
173182
});
174183

184+
var cancellationTokenSources = [
185+
"cancellationToken.ts"
186+
].map(function (f) {
187+
return path.join(cancellationTokenDirectory, f);
188+
});
189+
190+
var typingsInstallerSources = [
191+
"../types.d.ts",
192+
"typingsInstaller.ts",
193+
"nodeTypingsInstaller.ts"
194+
].map(function (f) {
195+
return path.join(typingsInstallerDirectory, f);
196+
});
197+
175198
var serverSources = serverCoreSources.concat(servicesSources);
176199

177200
var languageServiceLibrarySources = [
201+
"protocol.d.ts",
202+
"utilities.ts",
203+
"scriptVersionCache.ts",
204+
"scriptInfo.ts",
205+
"lsHost.ts",
206+
"project.ts",
178207
"editorServices.ts",
179208
"protocol.d.ts",
180-
"session.ts"
209+
"session.ts",
210+
181211
].map(function (f) {
182212
return path.join(serverDirectory, f);
183213
}).concat(servicesSources);
@@ -221,15 +251,24 @@ var harnessSources = harnessCoreSources.concat([
221251
"convertCompilerOptionsFromJson.ts",
222252
"convertTypingOptionsFromJson.ts",
223253
"tsserverProjectSystem.ts",
254+
"compileOnSave.ts",
255+
"typingsInstaller.ts",
256+
"projectErrors.ts",
224257
"matchFiles.ts",
225258
"initializeTSConfig.ts",
226259
].map(function (f) {
227260
return path.join(unittestsDirectory, f);
228261
})).concat([
262+
"protocol.d.ts",
263+
"utilities.ts",
264+
"scriptVersionCache.ts",
265+
"scriptInfo.ts",
266+
"lsHost.ts",
267+
"project.ts",
268+
"typingsCache.ts",
269+
"editorServices.ts",
229270
"protocol.d.ts",
230271
"session.ts",
231-
"client.ts",
232-
"editorServices.ts"
233272
].map(function (f) {
234273
return path.join(serverDirectory, f);
235274
}));
@@ -616,8 +655,14 @@ compileFile(
616655
inlineSourceMap: true
617656
});
618657

658+
var cancellationTokenFile = path.join(builtLocalDirectory, "cancellationToken.js");
659+
compileFile(cancellationTokenFile, cancellationTokenSources, [builtLocalDirectory].concat(cancellationTokenSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { outDir: builtLocalDirectory, noOutFile: true });
660+
661+
var typingsInstallerFile = path.join(builtLocalDirectory, "typingsInstaller.js");
662+
compileFile(typingsInstallerFile, typingsInstallerSources, [builtLocalDirectory].concat(typingsInstallerSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { outDir: builtLocalDirectory, noOutFile: false });
663+
619664
var serverFile = path.join(builtLocalDirectory, "tsserver.js");
620-
compileFile(serverFile, serverSources, [builtLocalDirectory, copyright].concat(serverSources), /*prefixes*/[copyright], /*useBuiltCompiler*/ true, { types: ["node"] });
665+
compileFile(serverFile, serverSources, [builtLocalDirectory, copyright, cancellationTokenFile, typingsInstallerFile].concat(serverSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { types: ["node"] });
621666
var tsserverLibraryFile = path.join(builtLocalDirectory, "tsserverlibrary.js");
622667
var tsserverLibraryDefinitionFile = path.join(builtLocalDirectory, "tsserverlibrary.d.ts");
623668
compileFile(
@@ -700,7 +745,7 @@ task("generate-spec", [specMd]);
700745
// Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory
701746
desc("Makes a new LKG out of the built js files");
702747
task("LKG", ["clean", "release", "local"].concat(libraryTargets), function () {
703-
var expectedFiles = [tscFile, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, tsserverLibraryFile, tsserverLibraryDefinitionFile].concat(libraryTargets);
748+
var expectedFiles = [tscFile, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, tsserverLibraryFile, tsserverLibraryDefinitionFile, cancellationTokenFile, typingsInstallerFile].concat(libraryTargets);
704749
var missingFiles = expectedFiles.filter(function (f) {
705750
return !fs.existsSync(f);
706751
});
@@ -948,7 +993,7 @@ desc("Runs the tests using the built run.js file like 'jake runtests'. Syntax is
948993
task("runtests-browser", ["tests", "browserify", builtLocalDirectory, servicesFileInBrowserTest], function () {
949994
cleanTestDirs();
950995
host = "node";
951-
browser = process.env.browser || process.env.b || "IE";
996+
browser = process.env.browser || process.env.b || (os.platform() === "linux" ? "chrome" : "IE");
952997
tests = process.env.test || process.env.tests || process.env.t;
953998
var light = process.env.light || false;
954999
var testConfigFile = 'test.config';
@@ -1130,6 +1175,8 @@ var lintTargets = compilerSources
11301175
.concat(serverCoreSources)
11311176
.concat(tslintRulesFiles)
11321177
.concat(servicesSources)
1178+
.concat(typingsInstallerSources)
1179+
.concat(cancellationTokenSources)
11331180
.concat(["Gulpfile.ts"])
11341181
.concat([nodeServerInFile, perftscPath, "tests/perfsys.ts", webhostPath]);
11351182

Diff for: lib/cancellationToken.js

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*! *****************************************************************************
2+
Copyright (c) Microsoft Corporation. All rights reserved.
3+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4+
this file except in compliance with the License. You may obtain a copy of the
5+
License at http://www.apache.org/licenses/LICENSE-2.0
6+
7+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10+
MERCHANTABLITY OR NON-INFRINGEMENT.
11+
12+
See the Apache Version 2.0 License for specific language governing permissions
13+
and limitations under the License.
14+
***************************************************************************** */
15+
16+
"use strict";
17+
var fs = require("fs");
18+
function createCancellationToken(args) {
19+
var cancellationPipeName;
20+
for (var i = 0; i < args.length - 1; i++) {
21+
if (args[i] === "--cancellationPipeName") {
22+
cancellationPipeName = args[i + 1];
23+
break;
24+
}
25+
}
26+
if (!cancellationPipeName) {
27+
return { isCancellationRequested: function () { return false; } };
28+
}
29+
return {
30+
isCancellationRequested: function () {
31+
try {
32+
fs.statSync(cancellationPipeName);
33+
return true;
34+
}
35+
catch (e) {
36+
return false;
37+
}
38+
}
39+
};
40+
}
41+
module.exports = createCancellationToken;

0 commit comments

Comments
 (0)