Skip to content

Commit 8d7791c

Browse files
Merge branch 'master' into limitNavigateTo
2 parents 2b64e50 + fa85b22 commit 8d7791c

35 files changed

Lines changed: 5150 additions & 28 deletions

Jakefile

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ var child_process = require("child_process");
88
// Variables
99
var compilerDirectory = "src/compiler/";
1010
var servicesDirectory = "src/services/";
11+
var serverDirectory = "src/server/";
1112
var harnessDirectory = "src/harness/";
1213
var libraryDirectory = "src/lib/";
1314
var scriptsDirectory = "scripts/";
@@ -90,6 +91,16 @@ var servicesSources = [
9091
return path.join(servicesDirectory, f);
9192
}));
9293

94+
var serverSources = [
95+
"node.d.ts",
96+
"editorServices.ts",
97+
"protocol.d.ts",
98+
"session.ts",
99+
"server.ts"
100+
].map(function (f) {
101+
return path.join(serverDirectory, f);
102+
});
103+
93104
var definitionsRoots = [
94105
"compiler/types.d.ts",
95106
"compiler/scanner.d.ts",
@@ -130,6 +141,13 @@ var harnessSources = [
130141
"services/preProcessFile.ts"
131142
].map(function (f) {
132143
return path.join(unittestsDirectory, f);
144+
})).concat([
145+
"protocol.d.ts",
146+
"session.ts",
147+
"client.ts",
148+
"editorServices.ts",
149+
].map(function (f) {
150+
return path.join(serverDirectory, f);
133151
}));
134152

135153
var librarySourceMap = [
@@ -327,6 +345,7 @@ var tscFile = path.join(builtLocalDirectory, compilerFilename);
327345
compileFile(tscFile, compilerSources, [builtLocalDirectory, copyright].concat(compilerSources), [copyright], /*useBuiltCompiler:*/ false);
328346

329347
var servicesFile = path.join(builtLocalDirectory, "typescriptServices.js");
348+
var nodePackageFile = path.join(builtLocalDirectory, "typescript.js");
330349
compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources),
331350
/*prefixes*/ [copyright],
332351
/*useBuiltCompiler*/ true,
@@ -336,7 +355,10 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca
336355
/*preserveConstEnums*/ true,
337356
/*keepComments*/ false,
338357
/*noResolve*/ false,
339-
/*stripInternal*/ false);
358+
/*stripInternal*/ false,
359+
/*callback*/ function () {
360+
jake.cpR(servicesFile, nodePackageFile, {silent: true});
361+
});
340362

341363
var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts");
342364
var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts");
@@ -378,9 +400,12 @@ compileFile(nodeDefinitionsFile, servicesSources,[builtLocalDirectory, copyright
378400
jake.rmRf(tempDirPath, {silent: true});
379401
});
380402

403+
var serverFile = path.join(builtLocalDirectory, "tsserver.js");
404+
compileFile(serverFile, serverSources,[builtLocalDirectory, copyright].concat(serverSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true);
405+
381406
// Local target to build the compiler and services
382407
desc("Builds the full compiler and services");
383-
task("local", ["generate-diagnostics", "lib", tscFile, servicesFile, nodeDefinitionsFile]);
408+
task("local", ["generate-diagnostics", "lib", tscFile, servicesFile, nodeDefinitionsFile, serverFile]);
384409

385410
// Local target to build only tsc.js
386411
desc("Builds only the compiler");
@@ -435,7 +460,7 @@ task("generate-spec", [specMd])
435460
// Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory
436461
desc("Makes a new LKG out of the built js files");
437462
task("LKG", ["clean", "release", "local"].concat(libraryTargets), function() {
438-
var expectedFiles = [tscFile, servicesFile, nodeDefinitionsFile, standaloneDefinitionsFile, internalNodeDefinitionsFile, internalStandaloneDefinitionsFile].concat(libraryTargets);
463+
var expectedFiles = [tscFile, servicesFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, internalNodeDefinitionsFile, internalStandaloneDefinitionsFile].concat(libraryTargets);
439464
var missingFiles = expectedFiles.filter(function (f) {
440465
return !fs.existsSync(f);
441466
});
@@ -542,7 +567,7 @@ task("runtests", ["tests", builtLocalDirectory], function() {
542567
}
543568

544569
if (tests && tests.toLocaleLowerCase() === "rwc") {
545-
testTimeout = 50000;
570+
testTimeout = 100000;
546571
}
547572

548573
colors = process.env.colors || process.env.color

bin/tsserver

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env node
2+
require('./tsserver.js')

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@
2525
"url": "https://github.com/Microsoft/TypeScript.git"
2626
},
2727
"preferGlobal": true,
28-
"main": "./bin/typescriptServices.js",
28+
"main": "./bin/typescript.js",
2929
"bin": {
30-
"tsc": "./bin/tsc"
30+
"tsc": "./bin/tsc",
31+
"tsserver": "./bin/tsserver"
3132
},
3233
"engines": {
3334
"node": ">=0.8.0"

src/harness/fourslash.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,8 @@ module FourSlash {
282282
return new Harness.LanguageService.NativeLanugageServiceAdapter(cancellationToken, compilationOptions);
283283
case FourSlashTestType.Shims:
284284
return new Harness.LanguageService.ShimLanugageServiceAdapter(cancellationToken, compilationOptions);
285+
case FourSlashTestType.Server:
286+
return new Harness.LanguageService.ServerLanugageServiceAdapter(cancellationToken, compilationOptions);
285287
default:
286288
throw new Error("Unknown FourSlash test type: ");
287289
}
@@ -418,6 +420,9 @@ module FourSlash {
418420
this.activeFile = fileToOpen;
419421
var fileName = fileToOpen.fileName.replace(Harness.IO.directoryName(fileToOpen.fileName), '').substr(1);
420422
this.scenarioActions.push('<OpenFile FileName="" SrcFileId="' + fileName + '" FileId="' + fileName + '" />');
423+
424+
// Let the host know that this file is now open
425+
this.languageServiceAdapterHost.openFile(fileToOpen.fileName);
421426
}
422427

423428
public verifyErrorExistsBetweenMarkers(startMarkerName: string, endMarkerName: string, negative: boolean) {
@@ -1927,7 +1932,7 @@ module FourSlash {
19271932
}
19281933

19291934
var missingItem = { name: name, kind: kind };
1930-
this.raiseError('verifyGetScriptLexicalStructureListContains failed - could not find the item: ' + JSON.stringify(missingItem) + ' in the returned list: (' + JSON.stringify(items) + ')');
1935+
this.raiseError('verifyGetScriptLexicalStructureListContains failed - could not find the item: ' + JSON.stringify(missingItem) + ' in the returned list: (' + JSON.stringify(items, null, " ") + ')');
19311936
}
19321937

19331938
private navigationBarItemsContains(items: ts.NavigationBarItem[], name: string, kind: string) {

src/harness/fourslashRunner.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
const enum FourSlashTestType {
66
Native,
7-
Shims
7+
Shims,
8+
Server
89
}
910

1011
class FourSlashRunner extends RunnerBase {
@@ -22,6 +23,10 @@ class FourSlashRunner extends RunnerBase {
2223
this.basePath = 'tests/cases/fourslash/shims';
2324
this.testSuiteName = 'fourslash-shims';
2425
break;
26+
case FourSlashTestType.Server:
27+
this.basePath = 'tests/cases/fourslash/server';
28+
this.testSuiteName = 'fourslash-server';
29+
break;
2530
}
2631
}
2732

src/harness/harness.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@
1616

1717
/// <reference path='..\services\services.ts' />
1818
/// <reference path='..\services\shims.ts' />
19+
/// <reference path='..\server\session.ts' />
20+
/// <reference path='..\server\client.ts' />
21+
/// <reference path='..\server\node.d.ts' />
1922
/// <reference path='external\mocha.d.ts'/>
2023
/// <reference path='external\chai.d.ts'/>
2124
/// <reference path='sourceMapRecorder.ts'/>
2225
/// <reference path='runnerbase.ts'/>
2326

24-
declare var require: any;
25-
declare var process: any;
26-
var Buffer = require('buffer').Buffer;
27+
var Buffer: BufferConstructor = require('buffer').Buffer;
2728

2829
// this will work in the browser via browserify
2930
var _chai: typeof chai = require('chai');

0 commit comments

Comments
 (0)