Merge branch 'master' into fixTimeMeasurement
This commit is contained in:
commit
cfb9cf0c7d
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -44,3 +44,4 @@ scripts/ior.js
|
|||
scripts/*.js.map
|
||||
coverage/
|
||||
internal/
|
||||
**/.DS_Store
|
||||
|
|
8486
bin/tsc.js
8486
bin/tsc.js
File diff suppressed because it is too large
Load diff
9
bin/typescript.d.ts
vendored
9
bin/typescript.d.ts
vendored
|
@ -686,7 +686,10 @@ declare module "typescript" {
|
|||
endOfFileToken: Node;
|
||||
fileName: string;
|
||||
text: string;
|
||||
amdDependencies: string[];
|
||||
amdDependencies: {
|
||||
path: string;
|
||||
name: string;
|
||||
}[];
|
||||
amdModuleName: string;
|
||||
referencedFiles: FileReference[];
|
||||
hasNoDefaultLib: boolean;
|
||||
|
@ -1367,7 +1370,7 @@ declare module "typescript" {
|
|||
function createNode(kind: SyntaxKind): Node;
|
||||
function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T;
|
||||
function modifierToFlag(token: SyntaxKind): NodeFlags;
|
||||
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile;
|
||||
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
function isEvalOrArgumentsIdentifier(node: Node): boolean;
|
||||
function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile;
|
||||
function isLeftHandSideExpression(expr: Expression): boolean;
|
||||
|
@ -1858,7 +1861,7 @@ declare module "typescript" {
|
|||
}
|
||||
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
|
||||
var disableIncrementalParsing: boolean;
|
||||
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile;
|
||||
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
function createDocumentRegistry(): DocumentRegistry;
|
||||
function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo;
|
||||
function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService;
|
||||
|
|
9
bin/typescriptServices.d.ts
vendored
9
bin/typescriptServices.d.ts
vendored
|
@ -686,7 +686,10 @@ declare module ts {
|
|||
endOfFileToken: Node;
|
||||
fileName: string;
|
||||
text: string;
|
||||
amdDependencies: string[];
|
||||
amdDependencies: {
|
||||
path: string;
|
||||
name: string;
|
||||
}[];
|
||||
amdModuleName: string;
|
||||
referencedFiles: FileReference[];
|
||||
hasNoDefaultLib: boolean;
|
||||
|
@ -1367,7 +1370,7 @@ declare module ts {
|
|||
function createNode(kind: SyntaxKind): Node;
|
||||
function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T;
|
||||
function modifierToFlag(token: SyntaxKind): NodeFlags;
|
||||
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile;
|
||||
function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
function isEvalOrArgumentsIdentifier(node: Node): boolean;
|
||||
function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile;
|
||||
function isLeftHandSideExpression(expr: Expression): boolean;
|
||||
|
@ -1858,7 +1861,7 @@ declare module ts {
|
|||
}
|
||||
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
|
||||
var disableIncrementalParsing: boolean;
|
||||
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile;
|
||||
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
function createDocumentRegistry(): DocumentRegistry;
|
||||
function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo;
|
||||
function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService;
|
||||
|
|
File diff suppressed because it is too large
Load diff
49
scripts/VSDevMode.ps1
Normal file
49
scripts/VSDevMode.ps1
Normal file
|
@ -0,0 +1,49 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Run this PowerShell script to enable dev mode and/or a custom script for the TypeScript language service, e.g.
|
||||
|
||||
PS C:\> .\scripts\VSDevMode.ps1 -enableDevMode -tsScript C:\src\TypeScript\built\local\typescriptServices.js
|
||||
|
||||
Note: If you get security errors, try running powershell as an Administrator and with the "-executionPolicy remoteSigned" switch
|
||||
|
||||
.PARAMETER vsVersion
|
||||
Set to "12" for Dev12 (VS2013) or "14" (the default) for Dev14 (VS2015)
|
||||
|
||||
.PARAMETER enableDevMode
|
||||
Pass this switch to enable attaching a debugger to the language service
|
||||
|
||||
.PARAMETER tsScript
|
||||
The path to a custom language service script to use, e.g. "C:\src\TypeScript\built\local\typescriptServices.js"
|
||||
#>
|
||||
Param(
|
||||
[int]$vsVersion = 14,
|
||||
[switch]$enableDevMode,
|
||||
[string]$tsScript
|
||||
)
|
||||
|
||||
$vsRegKey = "HKCU:\Software\Microsoft\VisualStudio\${vsVersion}.0"
|
||||
$tsRegKey = "${vsRegKey}\TypeScriptLanguageService"
|
||||
|
||||
if($enableDevMode -ne $true -and $tsScript -eq ""){
|
||||
Throw "You must either enable language service debugging (-enableDevMode), set a custom script (-tsScript), or both"
|
||||
}
|
||||
|
||||
if(!(Test-Path $vsRegKey)){
|
||||
Throw "Visual Studio ${vsVersion} is not installed"
|
||||
}
|
||||
if(!(Test-Path $tsRegKey)){
|
||||
# Create the TypeScript subkey if it doesn't exist
|
||||
New-Item -path $tsRegKey
|
||||
}
|
||||
|
||||
if($tsScript -ne ""){
|
||||
if(!(Test-Path $tsScript)){
|
||||
Throw "Could not locate the TypeScript language service script at ${tsScript}"
|
||||
}
|
||||
Set-ItemProperty -path $tsRegKey -name CustomTypeScriptServicesFileLocation -value "${tsScript}"
|
||||
Write-Host "Enabled custom TypeScript language service at ${tsScript} for Dev${vsVersion}"
|
||||
}
|
||||
if($enableDevMode){
|
||||
Set-ItemProperty -path $tsRegKey -name EnableDevMode -value 1
|
||||
Write-Host "Enabled developer mode for Dev${vsVersion}"
|
||||
}
|
|
@ -4057,11 +4057,25 @@ module ts {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
function sortAMDModules(amdModules: {name: string; path: string}[]) {
|
||||
// AMD modules with declared variable names go first
|
||||
return amdModules.sort((moduleA, moduleB) => {
|
||||
if (moduleA.name === moduleB.name) {
|
||||
return 0;
|
||||
} else if (!moduleA.name) {
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function emitAMDModule(node: SourceFile, startIndex: number) {
|
||||
var imports = getExternalImportDeclarations(node);
|
||||
writeLine();
|
||||
write("define(");
|
||||
sortAMDModules(node.amdDependencies);
|
||||
if (node.amdModuleName) {
|
||||
write("\"" + node.amdModuleName + "\", ");
|
||||
}
|
||||
|
@ -4071,7 +4085,7 @@ module ts {
|
|||
emitLiteral(<LiteralExpression>getExternalModuleImportDeclarationExpression(imp));
|
||||
});
|
||||
forEach(node.amdDependencies, amdDependency => {
|
||||
var text = "\"" + amdDependency + "\"";
|
||||
var text = "\"" + amdDependency.path + "\"";
|
||||
write(", ");
|
||||
write(text);
|
||||
});
|
||||
|
@ -4080,6 +4094,12 @@ module ts {
|
|||
write(", ");
|
||||
emit(imp.name);
|
||||
});
|
||||
forEach(node.amdDependencies, amdDependency => {
|
||||
if (amdDependency.name) {
|
||||
write(", ");
|
||||
write(amdDependency.name);
|
||||
}
|
||||
});
|
||||
write(") {");
|
||||
increaseIndent();
|
||||
emitCaptureThisForNodeIfNecessary(node);
|
||||
|
|
|
@ -4749,7 +4749,7 @@ module ts {
|
|||
function processReferenceComments(sourceFile: SourceFile): void {
|
||||
var triviaScanner = createScanner(sourceFile.languageVersion, /*skipTrivia*/false, sourceText);
|
||||
var referencedFiles: FileReference[] = [];
|
||||
var amdDependencies: string[] = [];
|
||||
var amdDependencies: {path: string; name: string}[] = [];
|
||||
var amdModuleName: string;
|
||||
|
||||
// Keep scanning all the leading trivia in the file until we get to something that
|
||||
|
@ -4789,10 +4789,17 @@ module ts {
|
|||
amdModuleName = amdModuleNameMatchResult[2];
|
||||
}
|
||||
|
||||
var amdDependencyRegEx = /^\/\/\/\s*<amd-dependency\s+path\s*=\s*('|")(.+?)\1/gim;
|
||||
var amdDependencyRegEx = /^\/\/\/\s*<amd-dependency\s/gim;
|
||||
var pathRegex = /\spath\s*=\s*('|")(.+?)\1/gim;
|
||||
var nameRegex = /\sname\s*=\s*('|")(.+?)\1/gim;
|
||||
var amdDependencyMatchResult = amdDependencyRegEx.exec(comment);
|
||||
if (amdDependencyMatchResult) {
|
||||
amdDependencies.push(amdDependencyMatchResult[2]);
|
||||
var pathMatchResult = pathRegex.exec(comment);
|
||||
var nameMatchResult = nameRegex.exec(comment);
|
||||
if (pathMatchResult) {
|
||||
var amdDependency = {path: pathMatchResult[2], name: nameMatchResult ? nameMatchResult[2] : undefined };
|
||||
amdDependencies.push(amdDependency);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -887,7 +887,7 @@ module ts {
|
|||
fileName: string;
|
||||
text: string;
|
||||
|
||||
amdDependencies: string[];
|
||||
amdDependencies: {path: string; name: string}[];
|
||||
amdModuleName: string;
|
||||
referencedFiles: FileReference[];
|
||||
|
||||
|
|
|
@ -725,7 +725,7 @@ module ts {
|
|||
public statements: NodeArray<Statement>;
|
||||
public endOfFileToken: Node;
|
||||
|
||||
public amdDependencies: string[];
|
||||
public amdDependencies: {name: string; path: string}[];
|
||||
public amdModuleName: string;
|
||||
public referencedFiles: FileReference[];
|
||||
|
||||
|
|
|
@ -295,8 +295,8 @@ module ts.SignatureHelp {
|
|||
var tagExpression = <TaggedTemplateExpression>templateExpression.parent;
|
||||
Debug.assert(templateExpression.kind === SyntaxKind.TemplateExpression);
|
||||
|
||||
// If we're just after a template tail, don't show signature help.
|
||||
if (node.kind === SyntaxKind.TemplateTail && position >= node.getEnd() && !(<LiteralExpression>node).isUnterminated) {
|
||||
// If we're just after a template tail, don't show signature help.
|
||||
if (node.kind === SyntaxKind.TemplateTail && !isInsideTemplateLiteral(<LiteralExpression>node, position)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
|
|
@ -723,7 +723,10 @@ declare module "typescript" {
|
|||
endOfFileToken: Node;
|
||||
fileName: string;
|
||||
text: string;
|
||||
amdDependencies: string[];
|
||||
amdDependencies: {
|
||||
path: string;
|
||||
name: string;
|
||||
}[];
|
||||
amdModuleName: string;
|
||||
referencedFiles: FileReference[];
|
||||
hasNoDefaultLib: boolean;
|
||||
|
|
|
@ -2195,9 +2195,16 @@ declare module "typescript" {
|
|||
text: string;
|
||||
>text : string
|
||||
|
||||
amdDependencies: string[];
|
||||
>amdDependencies : string[]
|
||||
amdDependencies: {
|
||||
>amdDependencies : { path: string; name: string; }[]
|
||||
|
||||
path: string;
|
||||
>path : string
|
||||
|
||||
name: string;
|
||||
>name : string
|
||||
|
||||
}[];
|
||||
amdModuleName: string;
|
||||
>amdModuleName : string
|
||||
|
||||
|
|
|
@ -754,7 +754,10 @@ declare module "typescript" {
|
|||
endOfFileToken: Node;
|
||||
fileName: string;
|
||||
text: string;
|
||||
amdDependencies: string[];
|
||||
amdDependencies: {
|
||||
path: string;
|
||||
name: string;
|
||||
}[];
|
||||
amdModuleName: string;
|
||||
referencedFiles: FileReference[];
|
||||
hasNoDefaultLib: boolean;
|
||||
|
|
|
@ -2339,9 +2339,16 @@ declare module "typescript" {
|
|||
text: string;
|
||||
>text : string
|
||||
|
||||
amdDependencies: string[];
|
||||
>amdDependencies : string[]
|
||||
amdDependencies: {
|
||||
>amdDependencies : { path: string; name: string; }[]
|
||||
|
||||
path: string;
|
||||
>path : string
|
||||
|
||||
name: string;
|
||||
>name : string
|
||||
|
||||
}[];
|
||||
amdModuleName: string;
|
||||
>amdModuleName : string
|
||||
|
||||
|
|
|
@ -755,7 +755,10 @@ declare module "typescript" {
|
|||
endOfFileToken: Node;
|
||||
fileName: string;
|
||||
text: string;
|
||||
amdDependencies: string[];
|
||||
amdDependencies: {
|
||||
path: string;
|
||||
name: string;
|
||||
}[];
|
||||
amdModuleName: string;
|
||||
referencedFiles: FileReference[];
|
||||
hasNoDefaultLib: boolean;
|
||||
|
|
|
@ -2291,9 +2291,16 @@ declare module "typescript" {
|
|||
text: string;
|
||||
>text : string
|
||||
|
||||
amdDependencies: string[];
|
||||
>amdDependencies : string[]
|
||||
amdDependencies: {
|
||||
>amdDependencies : { path: string; name: string; }[]
|
||||
|
||||
path: string;
|
||||
>path : string
|
||||
|
||||
name: string;
|
||||
>name : string
|
||||
|
||||
}[];
|
||||
amdModuleName: string;
|
||||
>amdModuleName : string
|
||||
|
||||
|
|
|
@ -792,7 +792,10 @@ declare module "typescript" {
|
|||
endOfFileToken: Node;
|
||||
fileName: string;
|
||||
text: string;
|
||||
amdDependencies: string[];
|
||||
amdDependencies: {
|
||||
path: string;
|
||||
name: string;
|
||||
}[];
|
||||
amdModuleName: string;
|
||||
referencedFiles: FileReference[];
|
||||
hasNoDefaultLib: boolean;
|
||||
|
|
|
@ -2464,9 +2464,16 @@ declare module "typescript" {
|
|||
text: string;
|
||||
>text : string
|
||||
|
||||
amdDependencies: string[];
|
||||
>amdDependencies : string[]
|
||||
amdDependencies: {
|
||||
>amdDependencies : { path: string; name: string; }[]
|
||||
|
||||
path: string;
|
||||
>path : string
|
||||
|
||||
name: string;
|
||||
>name : string
|
||||
|
||||
}[];
|
||||
amdModuleName: string;
|
||||
>amdModuleName : string
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
tests/cases/compiler/amdDependencyCommentName1.ts(3,21): error TS2307: Cannot find external module 'm2'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/amdDependencyCommentName1.ts (1 errors) ====
|
||||
///<amd-dependency path='bar' name='b'/>
|
||||
|
||||
import m1 = require("m2")
|
||||
~~~~
|
||||
!!! error TS2307: Cannot find external module 'm2'.
|
||||
m1.f();
|
10
tests/baselines/reference/amdDependencyCommentName1.js
Normal file
10
tests/baselines/reference/amdDependencyCommentName1.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
//// [amdDependencyCommentName1.ts]
|
||||
///<amd-dependency path='bar' name='b'/>
|
||||
|
||||
import m1 = require("m2")
|
||||
m1.f();
|
||||
|
||||
//// [amdDependencyCommentName1.js]
|
||||
///<amd-dependency path='bar' name='b'/>
|
||||
var m1 = require("m2");
|
||||
m1.f();
|
|
@ -0,0 +1,10 @@
|
|||
tests/cases/compiler/amdDependencyCommentName2.ts(3,21): error TS2307: Cannot find external module 'm2'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/amdDependencyCommentName2.ts (1 errors) ====
|
||||
///<amd-dependency path='bar' name='b'/>
|
||||
|
||||
import m1 = require("m2")
|
||||
~~~~
|
||||
!!! error TS2307: Cannot find external module 'm2'.
|
||||
m1.f();
|
11
tests/baselines/reference/amdDependencyCommentName2.js
Normal file
11
tests/baselines/reference/amdDependencyCommentName2.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
//// [amdDependencyCommentName2.ts]
|
||||
///<amd-dependency path='bar' name='b'/>
|
||||
|
||||
import m1 = require("m2")
|
||||
m1.f();
|
||||
|
||||
//// [amdDependencyCommentName2.js]
|
||||
///<amd-dependency path='bar' name='b'/>
|
||||
define(["require", "exports", "m2", "bar"], function (require, exports, m1, b) {
|
||||
m1.f();
|
||||
});
|
|
@ -0,0 +1,12 @@
|
|||
tests/cases/compiler/amdDependencyCommentName3.ts(5,21): error TS2307: Cannot find external module 'm2'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/amdDependencyCommentName3.ts (1 errors) ====
|
||||
///<amd-dependency path='bar' name='b'/>
|
||||
///<amd-dependency path='foo'/>
|
||||
///<amd-dependency path='goo' name='c'/>
|
||||
|
||||
import m1 = require("m2")
|
||||
~~~~
|
||||
!!! error TS2307: Cannot find external module 'm2'.
|
||||
m1.f();
|
15
tests/baselines/reference/amdDependencyCommentName3.js
Normal file
15
tests/baselines/reference/amdDependencyCommentName3.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
//// [amdDependencyCommentName3.ts]
|
||||
///<amd-dependency path='bar' name='b'/>
|
||||
///<amd-dependency path='foo'/>
|
||||
///<amd-dependency path='goo' name='c'/>
|
||||
|
||||
import m1 = require("m2")
|
||||
m1.f();
|
||||
|
||||
//// [amdDependencyCommentName3.js]
|
||||
///<amd-dependency path='bar' name='b'/>
|
||||
///<amd-dependency path='foo'/>
|
||||
///<amd-dependency path='goo' name='c'/>
|
||||
define(["require", "exports", "m2", "bar", "goo", "foo"], function (require, exports, m1, b, c) {
|
||||
m1.f();
|
||||
});
|
5
tests/cases/compiler/amdDependencyCommentName1.ts
Normal file
5
tests/cases/compiler/amdDependencyCommentName1.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
//@module: commonjs
|
||||
///<amd-dependency path='bar' name='b'/>
|
||||
|
||||
import m1 = require("m2")
|
||||
m1.f();
|
5
tests/cases/compiler/amdDependencyCommentName2.ts
Normal file
5
tests/cases/compiler/amdDependencyCommentName2.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
//@module: amd
|
||||
///<amd-dependency path='bar' name='b'/>
|
||||
|
||||
import m1 = require("m2")
|
||||
m1.f();
|
7
tests/cases/compiler/amdDependencyCommentName3.ts
Normal file
7
tests/cases/compiler/amdDependencyCommentName3.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
//@module: amd
|
||||
///<amd-dependency path='bar' name='b'/>
|
||||
///<amd-dependency path='foo'/>
|
||||
///<amd-dependency path='goo' name='c'/>
|
||||
|
||||
import m1 = require("m2")
|
||||
m1.f();
|
|
@ -0,0 +1,11 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// function foo(strs, ...rest) {
|
||||
//// }
|
||||
////
|
||||
//// /*1*/fo/*2*/o /*3*/`abcd${0 + 1}abcd{1 + 1}`/*4*/ /*5*/
|
||||
|
||||
test.markers().forEach(m => {
|
||||
goTo.position(m.position);
|
||||
verify.not.signatureHelpPresent();
|
||||
});
|
|
@ -0,0 +1,11 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// function foo(strs, ...rest) {
|
||||
//// }
|
||||
////
|
||||
//// /*1*/fo/*2*/o /*3*/`abcd${0 + 1}abcd{1 + 1}abcd`/*4*/ /*5*/
|
||||
|
||||
test.markers().forEach(m => {
|
||||
goTo.position(m.position);
|
||||
verify.not.signatureHelpPresent();
|
||||
});
|
|
@ -0,0 +1,11 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// function foo(strs, ...rest) {
|
||||
//// }
|
||||
////
|
||||
//// /*1*/fo/*2*/o /*3*/``/*4*/ /*5*/
|
||||
|
||||
test.markers().forEach(m => {
|
||||
goTo.position(m.position);
|
||||
verify.not.signatureHelpPresent();
|
||||
});
|
|
@ -0,0 +1,11 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// function foo(strs, ...rest) {
|
||||
//// }
|
||||
////
|
||||
//// /*1*/fo/*2*/o /*3*/`abcd`/*4*/
|
||||
|
||||
test.markers().forEach(m => {
|
||||
goTo.position(m.position);
|
||||
verify.not.signatureHelpPresent();
|
||||
});
|
Loading…
Reference in a new issue