Merge branch 'master' into reportDeclarationEmitErrors
This commit is contained in:
commit
3721382933
|
@ -65,7 +65,8 @@ module ts {
|
||||||
symbolToString: symbolToString,
|
symbolToString: symbolToString,
|
||||||
getAugmentedPropertiesOfApparentType: getAugmentedPropertiesOfApparentType,
|
getAugmentedPropertiesOfApparentType: getAugmentedPropertiesOfApparentType,
|
||||||
getRootSymbol: getRootSymbol,
|
getRootSymbol: getRootSymbol,
|
||||||
getContextualType: getContextualType
|
getContextualType: getContextualType,
|
||||||
|
getFullyQualifiedName: getFullyQualifiedName
|
||||||
};
|
};
|
||||||
|
|
||||||
var undefinedSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "undefined");
|
var undefinedSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "undefined");
|
||||||
|
@ -2431,7 +2432,7 @@ module ts {
|
||||||
case SyntaxKind.Identifier:
|
case SyntaxKind.Identifier:
|
||||||
case SyntaxKind.QualifiedName:
|
case SyntaxKind.QualifiedName:
|
||||||
var symbol = getSymbolInfo(node);
|
var symbol = getSymbolInfo(node);
|
||||||
return getDeclaredTypeOfSymbol(symbol);
|
return symbol && getDeclaredTypeOfSymbol(symbol);
|
||||||
default:
|
default:
|
||||||
return unknownType;
|
return unknownType;
|
||||||
}
|
}
|
||||||
|
@ -3471,41 +3472,6 @@ module ts {
|
||||||
return getAncestor(node, kind) !== undefined;
|
return getAncestor(node, kind) !== undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAncestor(node: Node, kind: SyntaxKind): Node {
|
|
||||||
switch (kind) {
|
|
||||||
// special-cases that can be come first
|
|
||||||
case SyntaxKind.ClassDeclaration:
|
|
||||||
while (node) {
|
|
||||||
switch (node.kind) {
|
|
||||||
case SyntaxKind.ClassDeclaration:
|
|
||||||
return <ClassDeclaration>node;
|
|
||||||
case SyntaxKind.EnumDeclaration:
|
|
||||||
case SyntaxKind.InterfaceDeclaration:
|
|
||||||
case SyntaxKind.ModuleDeclaration:
|
|
||||||
case SyntaxKind.ImportDeclaration:
|
|
||||||
// early exit cases - declarations cannot be nested in classes
|
|
||||||
return undefined;
|
|
||||||
default:
|
|
||||||
node = node.parent;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
while (node) {
|
|
||||||
if (node.kind === kind) {
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
node = node.parent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
// EXPRESSION TYPE CHECKING
|
// EXPRESSION TYPE CHECKING
|
||||||
|
|
||||||
function checkIdentifier(node: Identifier): Type {
|
function checkIdentifier(node: Identifier): Type {
|
||||||
|
@ -3852,6 +3818,11 @@ module ts {
|
||||||
// Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily
|
// Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily
|
||||||
// be "pushed" onto a node using the contextualType property.
|
// be "pushed" onto a node using the contextualType property.
|
||||||
function getContextualType(node: Expression): Type {
|
function getContextualType(node: Expression): Type {
|
||||||
|
if (isInsideWithStatementBody(node)) {
|
||||||
|
// We cannot answer semantic questions within a with block, do not proceed any further
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
if (node.contextualType) {
|
if (node.contextualType) {
|
||||||
return node.contextualType;
|
return node.contextualType;
|
||||||
}
|
}
|
||||||
|
@ -6717,7 +6688,20 @@ module ts {
|
||||||
return findChildAtPosition(sourceFile);
|
return findChildAtPosition(sourceFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[] {
|
function isInsideWithStatementBody(node: Node): boolean {
|
||||||
|
if (node) {
|
||||||
|
while (node.parent) {
|
||||||
|
if (node.parent.kind === SyntaxKind.WithStatement && (<WithStatement>node.parent).statement === node) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
node = node.parent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]{
|
||||||
var symbols: SymbolTable = {};
|
var symbols: SymbolTable = {};
|
||||||
var memberFlags: NodeFlags = 0;
|
var memberFlags: NodeFlags = 0;
|
||||||
function copySymbol(symbol: Symbol, meaning: SymbolFlags) {
|
function copySymbol(symbol: Symbol, meaning: SymbolFlags) {
|
||||||
|
@ -6737,6 +6721,12 @@ module ts {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isInsideWithStatementBody(location)) {
|
||||||
|
// We cannot answer semantic questions within a with block, do not proceed any further
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
while (location) {
|
while (location) {
|
||||||
if (location.locals && !isGlobalSourceFile(location)) {
|
if (location.locals && !isGlobalSourceFile(location)) {
|
||||||
copySymbols(location.locals, meaning);
|
copySymbols(location.locals, meaning);
|
||||||
|
@ -7009,6 +6999,11 @@ module ts {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSymbolInfo(node: Node) {
|
function getSymbolInfo(node: Node) {
|
||||||
|
if (isInsideWithStatementBody(node)) {
|
||||||
|
// We cannot answer semantic questions within a with block, do not proceed any further
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) {
|
if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) {
|
||||||
// This is a declaration, call getSymbolOfNode
|
// This is a declaration, call getSymbolOfNode
|
||||||
return getSymbolOfNode(node.parent);
|
return getSymbolOfNode(node.parent);
|
||||||
|
@ -7063,9 +7058,15 @@ module ts {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTypeOfNode(node: Node): Type {
|
function getTypeOfNode(node: Node): Type {
|
||||||
|
if (isInsideWithStatementBody(node)) {
|
||||||
|
// We cannot answer semantic questions within a with block, do not proceed any further
|
||||||
|
return unknownType;
|
||||||
|
}
|
||||||
|
|
||||||
if (isExpression(node)) {
|
if (isExpression(node)) {
|
||||||
return getTypeOfExpression(<Expression>node);
|
return getTypeOfExpression(<Expression>node);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isTypeNode(node)) {
|
if (isTypeNode(node)) {
|
||||||
return getTypeFromTypeNode(<TypeNode>node);
|
return getTypeFromTypeNode(<TypeNode>node);
|
||||||
}
|
}
|
||||||
|
@ -7078,7 +7079,7 @@ module ts {
|
||||||
|
|
||||||
if (isTypeDeclarationName(node)) {
|
if (isTypeDeclarationName(node)) {
|
||||||
var symbol = getSymbolInfo(node);
|
var symbol = getSymbolInfo(node);
|
||||||
return getDeclaredTypeOfSymbol(symbol);
|
return symbol && getDeclaredTypeOfSymbol(symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isDeclaration(node)) {
|
if (isDeclaration(node)) {
|
||||||
|
@ -7089,12 +7090,12 @@ module ts {
|
||||||
|
|
||||||
if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) {
|
if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) {
|
||||||
var symbol = getSymbolInfo(node);
|
var symbol = getSymbolInfo(node);
|
||||||
return getTypeOfSymbol(symbol);
|
return symbol && getTypeOfSymbol(symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isInRightSideOfImportOrExportAssignment(node)) {
|
if (isInRightSideOfImportOrExportAssignment(node)) {
|
||||||
var symbol = getSymbolInfo(node);
|
var symbol = getSymbolInfo(node);
|
||||||
var declaredType = getDeclaredTypeOfSymbol(symbol);
|
var declaredType = symbol && getDeclaredTypeOfSymbol(symbol);
|
||||||
return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol);
|
return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7146,7 +7147,7 @@ module ts {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRootSymbol(symbol: Symbol) {
|
function getRootSymbol(symbol: Symbol) {
|
||||||
return (symbol.flags & SymbolFlags.Transient) ? getSymbolLinks(symbol).target : symbol;
|
return ((symbol.flags & SymbolFlags.Transient) && getSymbolLinks(symbol).target) || symbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emitter support
|
// Emitter support
|
||||||
|
|
|
@ -531,6 +531,39 @@ module ts {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getAncestor(node: Node, kind: SyntaxKind): Node {
|
||||||
|
switch (kind) {
|
||||||
|
// special-cases that can be come first
|
||||||
|
case SyntaxKind.ClassDeclaration:
|
||||||
|
while (node) {
|
||||||
|
switch (node.kind) {
|
||||||
|
case SyntaxKind.ClassDeclaration:
|
||||||
|
return <ClassDeclaration>node;
|
||||||
|
case SyntaxKind.EnumDeclaration:
|
||||||
|
case SyntaxKind.InterfaceDeclaration:
|
||||||
|
case SyntaxKind.ModuleDeclaration:
|
||||||
|
case SyntaxKind.ImportDeclaration:
|
||||||
|
// early exit cases - declarations cannot be nested in classes
|
||||||
|
return undefined;
|
||||||
|
default:
|
||||||
|
node = node.parent;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
while (node) {
|
||||||
|
if (node.kind === kind) {
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
node = node.parent;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
enum ParsingContext {
|
enum ParsingContext {
|
||||||
SourceElements, // Elements in source file
|
SourceElements, // Elements in source file
|
||||||
ModuleElements, // Elements in module declaration
|
ModuleElements, // Elements in module declaration
|
||||||
|
@ -2200,10 +2233,38 @@ module ts {
|
||||||
|
|
||||||
function parseCallAndAccess(expr: Expression, inNewExpression: boolean): Expression {
|
function parseCallAndAccess(expr: Expression, inNewExpression: boolean): Expression {
|
||||||
while (true) {
|
while (true) {
|
||||||
|
var dotStart = scanner.getTokenPos();
|
||||||
if (parseOptional(SyntaxKind.DotToken)) {
|
if (parseOptional(SyntaxKind.DotToken)) {
|
||||||
var propertyAccess = <PropertyAccess>createNode(SyntaxKind.PropertyAccess, expr.pos);
|
var propertyAccess = <PropertyAccess>createNode(SyntaxKind.PropertyAccess, expr.pos);
|
||||||
|
// Technically a keyword is valid here as all keywords are identifier names.
|
||||||
|
// However, often we'll encounter this in error situations when the keyword
|
||||||
|
// is actually starting another valid construct.
|
||||||
|
//
|
||||||
|
// So, we check for the following specific case:
|
||||||
|
//
|
||||||
|
// name.
|
||||||
|
// keyword identifierNameOrKeyword
|
||||||
|
//
|
||||||
|
// Note: the newlines are important here. For example, if that above code
|
||||||
|
// were rewritten into:
|
||||||
|
//
|
||||||
|
// name.keyword
|
||||||
|
// identifierNameOrKeyword
|
||||||
|
//
|
||||||
|
// Then we would consider it valid. That's because ASI would take effect and
|
||||||
|
// the code would be implicitly: "name.keyword; identifierNameOrKeyword".
|
||||||
|
// In the first case though, ASI will not take effect because there is not a
|
||||||
|
// line terminator after the keyword.
|
||||||
|
if (scanner.hasPrecedingLineBreak() && scanner.isReservedWord() && lookAhead(() => scanner.isReservedWord())) {
|
||||||
|
grammarErrorAtPos(dotStart, scanner.getStartPos() - dotStart, Diagnostics.Identifier_expected);
|
||||||
|
var id = <Identifier>createMissingNode();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var id = parseIdentifierName();
|
||||||
|
}
|
||||||
|
|
||||||
propertyAccess.left = expr;
|
propertyAccess.left = expr;
|
||||||
propertyAccess.right = parseIdentifierName();
|
propertyAccess.right = id;
|
||||||
expr = finishNode(propertyAccess);
|
expr = finishNode(propertyAccess);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -3754,7 +3815,7 @@ module ts {
|
||||||
: undefined);
|
: undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
scanner = createScanner(languageVersion, sourceText, scanError, onComment);
|
scanner = createScanner(languageVersion, /*skipTrivia*/ true, sourceText, scanError, onComment);
|
||||||
var rootNodeFlags: NodeFlags = 0;
|
var rootNodeFlags: NodeFlags = 0;
|
||||||
if (fileExtensionIs(filename, ".d.ts")) {
|
if (fileExtensionIs(filename, ".d.ts")) {
|
||||||
rootNodeFlags = NodeFlags.DeclarationFile;
|
rootNodeFlags = NodeFlags.DeclarationFile;
|
||||||
|
|
|
@ -460,7 +460,7 @@ module ts {
|
||||||
ch > CharacterCodes.maxAsciiCharacter && isUnicodeIdentifierPart(ch, languageVersion);
|
ch > CharacterCodes.maxAsciiCharacter && isUnicodeIdentifierPart(ch, languageVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createScanner(languageVersion: ScriptTarget, text?: string, onError?: ErrorCallback, onComment?: CommentCallback): Scanner {
|
export function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback, onComment?: CommentCallback): Scanner {
|
||||||
var pos: number; // Current position (end position of text of current token)
|
var pos: number; // Current position (end position of text of current token)
|
||||||
var len: number; // Length of text
|
var len: number; // Length of text
|
||||||
var startPos: number; // Start position of whitespace before current token
|
var startPos: number; // Start position of whitespace before current token
|
||||||
|
@ -694,12 +694,34 @@ module ts {
|
||||||
case CharacterCodes.lineFeed:
|
case CharacterCodes.lineFeed:
|
||||||
case CharacterCodes.carriageReturn:
|
case CharacterCodes.carriageReturn:
|
||||||
precedingLineBreak = true;
|
precedingLineBreak = true;
|
||||||
|
if (skipTrivia) {
|
||||||
|
pos++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (ch === CharacterCodes.carriageReturn && pos + 1 < len && text.charCodeAt(pos + 1) === CharacterCodes.lineFeed) {
|
||||||
|
// consume both CR and LF
|
||||||
|
pos += 2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
|
return token = SyntaxKind.NewLineTrivia;
|
||||||
|
}
|
||||||
case CharacterCodes.tab:
|
case CharacterCodes.tab:
|
||||||
case CharacterCodes.verticalTab:
|
case CharacterCodes.verticalTab:
|
||||||
case CharacterCodes.formFeed:
|
case CharacterCodes.formFeed:
|
||||||
case CharacterCodes.space:
|
case CharacterCodes.space:
|
||||||
pos++;
|
if (skipTrivia) {
|
||||||
continue;
|
pos++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
while (pos < len && isWhiteSpace(text.charCodeAt(pos))) {
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
|
return token = SyntaxKind.WhitespaceTrivia;
|
||||||
|
}
|
||||||
case CharacterCodes.exclamation:
|
case CharacterCodes.exclamation:
|
||||||
if (text.charCodeAt(pos + 1) === CharacterCodes.equals) {
|
if (text.charCodeAt(pos + 1) === CharacterCodes.equals) {
|
||||||
if (text.charCodeAt(pos + 2) === CharacterCodes.equals) {
|
if (text.charCodeAt(pos + 2) === CharacterCodes.equals) {
|
||||||
|
@ -776,7 +798,13 @@ module ts {
|
||||||
if (onComment) {
|
if (onComment) {
|
||||||
onComment(tokenPos, pos);
|
onComment(tokenPos, pos);
|
||||||
}
|
}
|
||||||
continue;
|
|
||||||
|
if (skipTrivia) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return token = SyntaxKind.SingleLineCommentTrivia;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Multi-line comment
|
// Multi-line comment
|
||||||
if (text.charCodeAt(pos + 1) === CharacterCodes.asterisk) {
|
if (text.charCodeAt(pos + 1) === CharacterCodes.asterisk) {
|
||||||
|
@ -806,7 +834,12 @@ module ts {
|
||||||
onComment(tokenPos, pos);
|
onComment(tokenPos, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
if (skipTrivia) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return token = SyntaxKind.MultiLineCommentTrivia;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (text.charCodeAt(pos + 1) === CharacterCodes.equals) {
|
if (text.charCodeAt(pos + 1) === CharacterCodes.equals) {
|
||||||
|
|
|
@ -12,6 +12,10 @@ module ts {
|
||||||
export enum SyntaxKind {
|
export enum SyntaxKind {
|
||||||
Unknown,
|
Unknown,
|
||||||
EndOfFileToken,
|
EndOfFileToken,
|
||||||
|
SingleLineCommentTrivia,
|
||||||
|
MultiLineCommentTrivia,
|
||||||
|
NewLineTrivia,
|
||||||
|
WhitespaceTrivia,
|
||||||
// Literals
|
// Literals
|
||||||
NumericLiteral,
|
NumericLiteral,
|
||||||
StringLiteral,
|
StringLiteral,
|
||||||
|
@ -634,6 +638,7 @@ module ts {
|
||||||
getApparentType(type: Type): ApparentType;
|
getApparentType(type: Type): ApparentType;
|
||||||
typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
|
typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
|
||||||
symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string;
|
symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string;
|
||||||
|
getFullyQualifiedName(symbol: Symbol): string;
|
||||||
getAugmentedPropertiesOfApparentType(type: Type): Symbol[];
|
getAugmentedPropertiesOfApparentType(type: Type): Symbol[];
|
||||||
getRootSymbol(symbol: Symbol): Symbol;
|
getRootSymbol(symbol: Symbol): Symbol;
|
||||||
getContextualType(node: Node): Type;
|
getContextualType(node: Node): Type;
|
||||||
|
|
|
@ -898,6 +898,44 @@ module FourSlash {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private validate(name: string, expected: string, actual: string) {
|
||||||
|
if (expected && expected !== actual) {
|
||||||
|
throw new Error("Expected " + name + " '" + expected + "'. Got '" + actual + "' instead.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public verifyRenameInfoSucceeded(displayName?: string, fullDisplayName?: string, kind?: string, kindModifiers?: string) {
|
||||||
|
var renameInfo = this.languageService.getRenameInfo(this.activeFile.fileName, this.currentCaretPosition);
|
||||||
|
if (!renameInfo.canRename) {
|
||||||
|
throw new Error("Rename did not succeed");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.validate("displayName", displayName, renameInfo.displayName);
|
||||||
|
this.validate("fullDisplayName", fullDisplayName, renameInfo.fullDisplayName);
|
||||||
|
this.validate("kind", kind, renameInfo.kind);
|
||||||
|
this.validate("kindModifiers", kindModifiers, renameInfo.kindModifiers);
|
||||||
|
|
||||||
|
if (this.getRanges().length !== 1) {
|
||||||
|
throw new Error("Expected a single range to be selected in the test file.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var expectedRange = this.getRanges()[0];
|
||||||
|
if (renameInfo.triggerSpan.start() !== expectedRange.start ||
|
||||||
|
renameInfo.triggerSpan.end() !== expectedRange.end) {
|
||||||
|
throw new Error("Expected triggerSpan [" + expectedRange.start + "," + expectedRange.end + "). Got [" +
|
||||||
|
renameInfo.triggerSpan.start() + "," + renameInfo.triggerSpan.end() + ") instead.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public verifyRenameInfoFailed(message?: string) {
|
||||||
|
var renameInfo = this.languageService.getRenameInfo(this.activeFile.fileName, this.currentCaretPosition);
|
||||||
|
if (renameInfo.canRename) {
|
||||||
|
throw new Error("Rename was expected to fail");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.validate("error", message, renameInfo.localizedErrorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
//private getFormalParameter() {
|
//private getFormalParameter() {
|
||||||
// var help = this.languageService.getSignatureHelpItems(this.activeFile.fileName, this.currentCaretPosition);
|
// var help = this.languageService.getSignatureHelpItems(this.activeFile.fileName, this.currentCaretPosition);
|
||||||
// return help.formal;
|
// return help.formal;
|
||||||
|
|
32
src/lib/extensions.d.ts
vendored
32
src/lib/extensions.d.ts
vendored
|
@ -63,14 +63,14 @@ interface Int8Array extends ArrayBufferView {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a value or an array of values.
|
* Sets a value or an array of values.
|
||||||
* @param A typed or untyped array of values to set.
|
* @param array A typed or untyped array of values to set.
|
||||||
* @param offset The index in the current array at which the values are to be written.
|
* @param offset The index in the current array at which the values are to be written.
|
||||||
*/
|
*/
|
||||||
set(array: Int8Array, offset?: number): void;
|
set(array: Int8Array, offset?: number): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a value or an array of values.
|
* Sets a value or an array of values.
|
||||||
* @param A typed or untyped array of values to set.
|
* @param array A typed or untyped array of values to set.
|
||||||
* @param offset The index in the current array at which the values are to be written.
|
* @param offset The index in the current array at which the values are to be written.
|
||||||
*/
|
*/
|
||||||
set(array: number[], offset?: number): void;
|
set(array: number[], offset?: number): void;
|
||||||
|
@ -121,14 +121,14 @@ interface Uint8Array extends ArrayBufferView {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a value or an array of values.
|
* Sets a value or an array of values.
|
||||||
* @param A typed or untyped array of values to set.
|
* @param array A typed or untyped array of values to set.
|
||||||
* @param offset The index in the current array at which the values are to be written.
|
* @param offset The index in the current array at which the values are to be written.
|
||||||
*/
|
*/
|
||||||
set(array: Uint8Array, offset?: number): void;
|
set(array: Uint8Array, offset?: number): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a value or an array of values.
|
* Sets a value or an array of values.
|
||||||
* @param A typed or untyped array of values to set.
|
* @param array A typed or untyped array of values to set.
|
||||||
* @param offset The index in the current array at which the values are to be written.
|
* @param offset The index in the current array at which the values are to be written.
|
||||||
*/
|
*/
|
||||||
set(array: number[], offset?: number): void;
|
set(array: number[], offset?: number): void;
|
||||||
|
@ -179,14 +179,14 @@ interface Int16Array extends ArrayBufferView {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a value or an array of values.
|
* Sets a value or an array of values.
|
||||||
* @param A typed or untyped array of values to set.
|
* @param array A typed or untyped array of values to set.
|
||||||
* @param offset The index in the current array at which the values are to be written.
|
* @param offset The index in the current array at which the values are to be written.
|
||||||
*/
|
*/
|
||||||
set(array: Int16Array, offset?: number): void;
|
set(array: Int16Array, offset?: number): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a value or an array of values.
|
* Sets a value or an array of values.
|
||||||
* @param A typed or untyped array of values to set.
|
* @param array A typed or untyped array of values to set.
|
||||||
* @param offset The index in the current array at which the values are to be written.
|
* @param offset The index in the current array at which the values are to be written.
|
||||||
*/
|
*/
|
||||||
set(array: number[], offset?: number): void;
|
set(array: number[], offset?: number): void;
|
||||||
|
@ -237,14 +237,14 @@ interface Uint16Array extends ArrayBufferView {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a value or an array of values.
|
* Sets a value or an array of values.
|
||||||
* @param A typed or untyped array of values to set.
|
* @param array A typed or untyped array of values to set.
|
||||||
* @param offset The index in the current array at which the values are to be written.
|
* @param offset The index in the current array at which the values are to be written.
|
||||||
*/
|
*/
|
||||||
set(array: Uint16Array, offset?: number): void;
|
set(array: Uint16Array, offset?: number): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a value or an array of values.
|
* Sets a value or an array of values.
|
||||||
* @param A typed or untyped array of values to set.
|
* @param array A typed or untyped array of values to set.
|
||||||
* @param offset The index in the current array at which the values are to be written.
|
* @param offset The index in the current array at which the values are to be written.
|
||||||
*/
|
*/
|
||||||
set(array: number[], offset?: number): void;
|
set(array: number[], offset?: number): void;
|
||||||
|
@ -295,14 +295,14 @@ interface Int32Array extends ArrayBufferView {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a value or an array of values.
|
* Sets a value or an array of values.
|
||||||
* @param A typed or untyped array of values to set.
|
* @param array A typed or untyped array of values to set.
|
||||||
* @param offset The index in the current array at which the values are to be written.
|
* @param offset The index in the current array at which the values are to be written.
|
||||||
*/
|
*/
|
||||||
set(array: Int32Array, offset?: number): void;
|
set(array: Int32Array, offset?: number): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a value or an array of values.
|
* Sets a value or an array of values.
|
||||||
* @param A typed or untyped array of values to set.
|
* @param array A typed or untyped array of values to set.
|
||||||
* @param offset The index in the current array at which the values are to be written.
|
* @param offset The index in the current array at which the values are to be written.
|
||||||
*/
|
*/
|
||||||
set(array: number[], offset?: number): void;
|
set(array: number[], offset?: number): void;
|
||||||
|
@ -353,14 +353,14 @@ interface Uint32Array extends ArrayBufferView {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a value or an array of values.
|
* Sets a value or an array of values.
|
||||||
* @param A typed or untyped array of values to set.
|
* @param array A typed or untyped array of values to set.
|
||||||
* @param offset The index in the current array at which the values are to be written.
|
* @param offset The index in the current array at which the values are to be written.
|
||||||
*/
|
*/
|
||||||
set(array: Uint32Array, offset?: number): void;
|
set(array: Uint32Array, offset?: number): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a value or an array of values.
|
* Sets a value or an array of values.
|
||||||
* @param A typed or untyped array of values to set.
|
* @param array A typed or untyped array of values to set.
|
||||||
* @param offset The index in the current array at which the values are to be written.
|
* @param offset The index in the current array at which the values are to be written.
|
||||||
*/
|
*/
|
||||||
set(array: number[], offset?: number): void;
|
set(array: number[], offset?: number): void;
|
||||||
|
@ -411,14 +411,14 @@ interface Float32Array extends ArrayBufferView {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a value or an array of values.
|
* Sets a value or an array of values.
|
||||||
* @param A typed or untyped array of values to set.
|
* @param array A typed or untyped array of values to set.
|
||||||
* @param offset The index in the current array at which the values are to be written.
|
* @param offset The index in the current array at which the values are to be written.
|
||||||
*/
|
*/
|
||||||
set(array: Float32Array, offset?: number): void;
|
set(array: Float32Array, offset?: number): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a value or an array of values.
|
* Sets a value or an array of values.
|
||||||
* @param A typed or untyped array of values to set.
|
* @param array A typed or untyped array of values to set.
|
||||||
* @param offset The index in the current array at which the values are to be written.
|
* @param offset The index in the current array at which the values are to be written.
|
||||||
*/
|
*/
|
||||||
set(array: number[], offset?: number): void;
|
set(array: number[], offset?: number): void;
|
||||||
|
@ -469,14 +469,14 @@ interface Float64Array extends ArrayBufferView {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a value or an array of values.
|
* Sets a value or an array of values.
|
||||||
* @param A typed or untyped array of values to set.
|
* @param array A typed or untyped array of values to set.
|
||||||
* @param offset The index in the current array at which the values are to be written.
|
* @param offset The index in the current array at which the values are to be written.
|
||||||
*/
|
*/
|
||||||
set(array: Float64Array, offset?: number): void;
|
set(array: Float64Array, offset?: number): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a value or an array of values.
|
* Sets a value or an array of values.
|
||||||
* @param A typed or untyped array of values to set.
|
* @param array A typed or untyped array of values to set.
|
||||||
* @param offset The index in the current array at which the values are to be written.
|
* @param offset The index in the current array at which the values are to be written.
|
||||||
*/
|
*/
|
||||||
set(array: number[], offset?: number): void;
|
set(array: number[], offset?: number): void;
|
||||||
|
|
|
@ -75,7 +75,7 @@ module ts {
|
||||||
update(scriptSnapshot: TypeScript.IScriptSnapshot, version: string, isOpen: boolean, textChangeRange: TypeScript.TextChangeRange): SourceFile;
|
update(scriptSnapshot: TypeScript.IScriptSnapshot, version: string, isOpen: boolean, textChangeRange: TypeScript.TextChangeRange): SourceFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
var scanner: Scanner = createScanner(ScriptTarget.ES5);
|
var scanner: Scanner = createScanner(ScriptTarget.ES5, /*skipTrivia*/ true);
|
||||||
|
|
||||||
var emptyArray: any[] = [];
|
var emptyArray: any[] = [];
|
||||||
|
|
||||||
|
@ -770,7 +770,6 @@ module ts {
|
||||||
InMultiLineCommentTrivia,
|
InMultiLineCommentTrivia,
|
||||||
InSingleQuoteStringLiteral,
|
InSingleQuoteStringLiteral,
|
||||||
InDoubleQuoteStringLiteral,
|
InDoubleQuoteStringLiteral,
|
||||||
EndingWithDotToken,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum TokenClass {
|
export enum TokenClass {
|
||||||
|
@ -1684,14 +1683,20 @@ module ts {
|
||||||
/// Completion
|
/// Completion
|
||||||
function getValidCompletionEntryDisplayName(displayName: string, target: ScriptTarget): string {
|
function getValidCompletionEntryDisplayName(displayName: string, target: ScriptTarget): string {
|
||||||
if (displayName && displayName.length > 0) {
|
if (displayName && displayName.length > 0) {
|
||||||
var firstChar = displayName.charCodeAt(0);
|
var firstCharCode = displayName.charCodeAt(0);
|
||||||
if (firstChar === TypeScript.CharacterCodes.singleQuote || firstChar === TypeScript.CharacterCodes.doubleQuote) {
|
if (displayName && displayName.length >= 2 && firstCharCode === displayName.charCodeAt(displayName.length - 1) &&
|
||||||
|
(firstCharCode === CharacterCodes.singleQuote || firstCharCode === CharacterCodes.doubleQuote)) {
|
||||||
// If the user entered name for the symbol was quoted, removing the quotes is not enough, as the name could be an
|
// If the user entered name for the symbol was quoted, removing the quotes is not enough, as the name could be an
|
||||||
// invalid identifier name. We need to check if whatever was inside the quotes is actually a valid identifier name.
|
// invalid identifer name. We need to check if whatever was inside the quotes is actually a valid identifier name.
|
||||||
displayName = TypeScript.stripStartAndEndQuotes(displayName);
|
displayName = displayName.substring(1, displayName.length - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
var isValid = isIdentifierStart(displayName.charCodeAt(0), target);
|
||||||
|
for (var i = 1, n = displayName.length; isValid && i < n; i++) {
|
||||||
|
isValid = isIdentifierPart(displayName.charCodeAt(i), target);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TypeScript.Scanner.isValidIdentifier(TypeScript.SimpleText.fromString(displayName), target)) {
|
if (isValid) {
|
||||||
return displayName;
|
return displayName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1709,7 +1714,6 @@ module ts {
|
||||||
}
|
}
|
||||||
|
|
||||||
var declarations = symbol.getDeclarations();
|
var declarations = symbol.getDeclarations();
|
||||||
var firstDeclaration = [0];
|
|
||||||
return {
|
return {
|
||||||
name: displayName,
|
name: displayName,
|
||||||
kind: getSymbolKind(symbol),
|
kind: getSymbolKind(symbol),
|
||||||
|
@ -1721,7 +1725,7 @@ module ts {
|
||||||
function getCompletionEntriesFromSymbols(symbols: Symbol[], session: CompletionSession): void {
|
function getCompletionEntriesFromSymbols(symbols: Symbol[], session: CompletionSession): void {
|
||||||
forEach(symbols, (symbol) => {
|
forEach(symbols, (symbol) => {
|
||||||
var entry = createCompletionEntry(symbol);
|
var entry = createCompletionEntry(symbol);
|
||||||
if (entry) {
|
if (entry && !lookUp(session.symbols, entry.name)) {
|
||||||
session.entries.push(entry);
|
session.entries.push(entry);
|
||||||
session.symbols[entry.name] = symbol;
|
session.symbols[entry.name] = symbol;
|
||||||
}
|
}
|
||||||
|
@ -1851,6 +1855,49 @@ module ts {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isPunctuation(kind: SyntaxKind) {
|
||||||
|
return (SyntaxKind.FirstPunctuation <= kind && kind <= SyntaxKind.LastPunctuation);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isVisibleWithinClassDeclaration(symbol: Symbol, containingClass: Declaration): boolean {
|
||||||
|
var declaration = symbol.declarations && symbol.declarations[0];
|
||||||
|
if (declaration && (declaration.flags & NodeFlags.Private)) {
|
||||||
|
var declarationClass = getAncestor(declaration, SyntaxKind.ClassDeclaration);
|
||||||
|
return containingClass === declarationClass;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function filterContextualMembersList(contextualMemberSymbols: Symbol[], existingMembers: Declaration[]): Symbol[] {
|
||||||
|
if (!existingMembers || existingMembers.length === 0) {
|
||||||
|
return contextualMemberSymbols;
|
||||||
|
}
|
||||||
|
|
||||||
|
var existingMemberNames: Map<boolean> = {};
|
||||||
|
forEach(existingMembers, m => {
|
||||||
|
if (m.kind !== SyntaxKind.PropertyAssignment) {
|
||||||
|
// Ignore omitted expressions for missing members in the object literal
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m.getStart() <= position && position <= m.getEnd()) {
|
||||||
|
// If this is the current item we are editing right now, do not filter it out
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
existingMemberNames[m.name.text] = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
var filteredMembers: Symbol[] = [];
|
||||||
|
forEach(contextualMemberSymbols, s => {
|
||||||
|
if (!existingMemberNames[s.name]) {
|
||||||
|
filteredMembers.push(s);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return filteredMembers;
|
||||||
|
}
|
||||||
|
|
||||||
synchronizeHostData();
|
synchronizeHostData();
|
||||||
|
|
||||||
filename = TypeScript.switchToForwardSlashes(filename);
|
filename = TypeScript.switchToForwardSlashes(filename);
|
||||||
|
@ -1905,6 +1952,9 @@ module ts {
|
||||||
|
|
||||||
// TODO: this is a hack for now, we need a proper walking mechanism to verify that we have the correct node
|
// TODO: this is a hack for now, we need a proper walking mechanism to verify that we have the correct node
|
||||||
var mappedNode = getNodeAtPosition(sourceFile, TypeScript.end(node) - 1);
|
var mappedNode = getNodeAtPosition(sourceFile, TypeScript.end(node) - 1);
|
||||||
|
if (isPunctuation(mappedNode.kind)) {
|
||||||
|
mappedNode = mappedNode.parent;
|
||||||
|
}
|
||||||
|
|
||||||
Debug.assert(mappedNode, "Could not map a Fidelity node to an AST node");
|
Debug.assert(mappedNode, "Could not map a Fidelity node to an AST node");
|
||||||
|
|
||||||
|
@ -1920,13 +1970,33 @@ module ts {
|
||||||
|
|
||||||
// Right of dot member completion list
|
// Right of dot member completion list
|
||||||
if (isRightOfDot) {
|
if (isRightOfDot) {
|
||||||
var type: ApparentType = typeInfoResolver.getApparentType(typeInfoResolver.getTypeOfNode(mappedNode));
|
var symbols: Symbol[] = [];
|
||||||
if (!type) {
|
var containingClass = getAncestor(mappedNode, SyntaxKind.ClassDeclaration);
|
||||||
return undefined;
|
isMemberCompletion = true;
|
||||||
|
|
||||||
|
if (mappedNode.kind === SyntaxKind.Identifier || mappedNode.kind === SyntaxKind.QualifiedName || mappedNode.kind === SyntaxKind.PropertyAccess) {
|
||||||
|
var symbol = typeInfoResolver.getSymbolInfo(mappedNode);
|
||||||
|
if (symbol && symbol.flags & SymbolFlags.HasExports) {
|
||||||
|
// Extract module or enum members
|
||||||
|
forEachValue(symbol.exports, symbol => {
|
||||||
|
if (isVisibleWithinClassDeclaration(symbol, containingClass)) {
|
||||||
|
symbols.push(symbol);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var type = typeInfoResolver.getTypeOfNode(mappedNode);
|
||||||
|
var apparentType = type && typeInfoResolver.getApparentType(type);
|
||||||
|
if (apparentType) {
|
||||||
|
// Filter private properties
|
||||||
|
forEach(apparentType.getApparentProperties(), symbol => {
|
||||||
|
if (isVisibleWithinClassDeclaration(symbol, containingClass)) {
|
||||||
|
symbols.push(symbol);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var symbols = type.getApparentProperties();
|
|
||||||
isMemberCompletion = true;
|
|
||||||
getCompletionEntriesFromSymbols(symbols, activeCompletionSession);
|
getCompletionEntriesFromSymbols(symbols, activeCompletionSession);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1934,34 +2004,23 @@ module ts {
|
||||||
|
|
||||||
// Object literal expression, look up possible property names from contextual type
|
// Object literal expression, look up possible property names from contextual type
|
||||||
if (containingObjectLiteral) {
|
if (containingObjectLiteral) {
|
||||||
var searchPosition = Math.min(position, TypeScript.end(containingObjectLiteral));
|
var objectLiteral = <ObjectLiteral>(mappedNode.kind === SyntaxKind.ObjectLiteral ? mappedNode : getAncestor(mappedNode, SyntaxKind.ObjectLiteral));
|
||||||
var path = TypeScript.ASTHelpers.getAstAtPosition(sourceUnit, searchPosition);
|
|
||||||
// Get the object literal node
|
|
||||||
|
|
||||||
while (node && node.kind() !== TypeScript.SyntaxKind.ObjectLiteralExpression) {
|
Debug.assert(objectLiteral);
|
||||||
node = node.parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!node || node.kind() !== TypeScript.SyntaxKind.ObjectLiteralExpression) {
|
|
||||||
// AST Path look up did not result in the same node as Fidelity Syntax Tree look up.
|
|
||||||
// Once we remove AST this will no longer be a problem.
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
isMemberCompletion = true;
|
isMemberCompletion = true;
|
||||||
|
|
||||||
//// Try to get the object members form contextual typing
|
var contextualType = typeInfoResolver.getContextualType(objectLiteral);
|
||||||
//var contextualMembers = compiler.getContextualMembersFromAST(node, document);
|
if (!contextualType) {
|
||||||
//if (contextualMembers && contextualMembers.symbols && contextualMembers.symbols.length > 0) {
|
return undefined;
|
||||||
// // get existing members
|
}
|
||||||
// var existingMembers = compiler.getVisibleMemberSymbolsFromAST(node, document);
|
|
||||||
|
|
||||||
// // Add filtered items to the completion list
|
var contextualTypeMembers = typeInfoResolver.getPropertiesOfType(contextualType);
|
||||||
// getCompletionEntriesFromSymbols({
|
if (contextualTypeMembers && contextualTypeMembers.length > 0) {
|
||||||
// symbols: filterContextualMembersList(contextualMembers.symbols, existingMembers, filename, position),
|
// Add filtered items to the completion list
|
||||||
// enclosingScopeSymbol: contextualMembers.enclosingScopeSymbol
|
var filteredMembers = filterContextualMembersList(contextualTypeMembers, objectLiteral.properties);
|
||||||
// }, entries);
|
getCompletionEntriesFromSymbols(filteredMembers, activeCompletionSession);
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
// Get scope members
|
// Get scope members
|
||||||
else {
|
else {
|
||||||
|
@ -2024,6 +2083,7 @@ module ts {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Get the token whose text contains the position, or the containing node. */
|
||||||
function getNodeAtPosition(sourceFile: SourceFile, position: number) {
|
function getNodeAtPosition(sourceFile: SourceFile, position: number) {
|
||||||
var current: Node = sourceFile;
|
var current: Node = sourceFile;
|
||||||
outer: while (true) {
|
outer: while (true) {
|
||||||
|
@ -2034,9 +2094,24 @@ module ts {
|
||||||
current = child;
|
current = child;
|
||||||
continue outer;
|
continue outer;
|
||||||
}
|
}
|
||||||
if (child.end > position) {
|
}
|
||||||
break;
|
return current;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get a token that contains the position. This is guaranteed to return a token, the position can be in the
|
||||||
|
* leading trivia or within the token text.
|
||||||
|
*/
|
||||||
|
function getTokenAtPosition(sourceFile: SourceFile, position: number) {
|
||||||
|
var current: Node = sourceFile;
|
||||||
|
outer: while (true) {
|
||||||
|
// find the child that has this
|
||||||
|
for (var i = 0, n = current.getChildCount(); i < n; i++) {
|
||||||
|
var child = current.getChildAt(i);
|
||||||
|
if (child.getFullStart() <= position && position < child.getEnd()) {
|
||||||
|
current = child;
|
||||||
|
continue outer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
|
@ -2065,7 +2140,7 @@ module ts {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSymbolKind(symbol: Symbol): string {
|
function getSymbolKind(symbol: Symbol): string {
|
||||||
var flags = symbol.getFlags();
|
var flags = typeInfoResolver.getRootSymbol(symbol).getFlags();
|
||||||
|
|
||||||
if (flags & SymbolFlags.Module) return ScriptElementKind.moduleElement;
|
if (flags & SymbolFlags.Module) return ScriptElementKind.moduleElement;
|
||||||
if (flags & SymbolFlags.Class) return ScriptElementKind.classElement;
|
if (flags & SymbolFlags.Class) return ScriptElementKind.classElement;
|
||||||
|
@ -3751,83 +3826,21 @@ module ts {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
function escapeRegExp(str: string): string {
|
function getTodoComments(filename: string, descriptors: TodoCommentDescriptor[]): TodoComment[] {
|
||||||
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
filename = TypeScript.switchToForwardSlashes(filename);
|
||||||
}
|
|
||||||
|
|
||||||
function getTodoCommentsRegExp(descriptors: TodoCommentDescriptor[]): RegExp {
|
var sourceFile = getCurrentSourceFile(filename);
|
||||||
// NOTE: ?: means 'non-capture group'. It allows us to have groups without having to
|
|
||||||
// filter them out later in the final result array.
|
|
||||||
|
|
||||||
// TODO comments can appear in one of the following forms:
|
|
||||||
//
|
|
||||||
// 1) // TODO or /////////// TODO
|
|
||||||
//
|
|
||||||
// 2) /* TODO or /********** TODO
|
|
||||||
//
|
|
||||||
// 3) /*
|
|
||||||
// * TODO
|
|
||||||
// */
|
|
||||||
//
|
|
||||||
// The following three regexps are used to match the start of the text up to the TODO
|
|
||||||
// comment portion.
|
|
||||||
var singleLineCommentStart = /(?:\/\/+\s*)/.source;
|
|
||||||
var multiLineCommentStart = /(?:\/\*+\s*)/.source;
|
|
||||||
var anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source;
|
|
||||||
|
|
||||||
// Match any of the above three TODO comment start regexps.
|
|
||||||
// Note that the outermost group *is* a capture group. We want to capture the preamble
|
|
||||||
// so that we can determine the starting position of the TODO comment match.
|
|
||||||
var preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")";
|
|
||||||
|
|
||||||
// Takes the descriptors and forms a regexp that matches them as if they were literals.
|
|
||||||
// For example, if the descriptors are "TODO(jason)" and "HACK", then this will be:
|
|
||||||
//
|
|
||||||
// (?:(TODO\(jason\))|(HACK))
|
|
||||||
//
|
|
||||||
// Note that the outermost group is *not* a capture group, but the innermost groups
|
|
||||||
// *are* capture groups. By capturing the inner literals we can determine after
|
|
||||||
// matching which descriptor we are dealing with.
|
|
||||||
var literals = "(?:" + descriptors.map(d => "(" + escapeRegExp(d.text) + ")").join("|") + ")";
|
|
||||||
|
|
||||||
// After matching a descriptor literal, the following regexp matches the rest of the
|
|
||||||
// text up to the end of the line (or */).
|
|
||||||
var endOfLineOrEndOfComment = /(?:$|\*\/)/.source
|
|
||||||
var messageRemainder = /(?:.*?)/.source
|
|
||||||
|
|
||||||
// This is the portion of the match we'll return as part of the TODO comment result. We
|
|
||||||
// match the literal portion up to the end of the line or end of comment.
|
|
||||||
var messagePortion = "(" + literals + messageRemainder + ")";
|
|
||||||
var regExpString = preamble + messagePortion + endOfLineOrEndOfComment;
|
|
||||||
|
|
||||||
// The final regexp will look like this:
|
|
||||||
// /((?:\/\/+\s*)|(?:\/\*+\s*)|(?:^(?:\s|\*)*))((?:(TODO\(jason\))|(HACK))(?:.*?))(?:$|\*\/)/gim
|
|
||||||
|
|
||||||
// The flags of the regexp are important here.
|
|
||||||
// 'g' is so that we are doing a global search and can find matches several times
|
|
||||||
// in the input.
|
|
||||||
//
|
|
||||||
// 'i' is for case insensitivity (We do this to match C# TODO comment code).
|
|
||||||
//
|
|
||||||
// 'm' is so we can find matches in a multiline input.
|
|
||||||
return new RegExp(regExpString, "gim");
|
|
||||||
}
|
|
||||||
|
|
||||||
function getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[] {
|
|
||||||
fileName = TypeScript.switchToForwardSlashes(fileName);
|
|
||||||
|
|
||||||
var sourceFile = getCurrentSourceFile(fileName);
|
|
||||||
var syntaxTree = sourceFile.getSyntaxTree();
|
|
||||||
cancellationToken.throwIfCancellationRequested();
|
cancellationToken.throwIfCancellationRequested();
|
||||||
|
|
||||||
var text = syntaxTree.text;
|
var fileContents = sourceFile.text;
|
||||||
var fileContents = text.substr(0, text.length());
|
|
||||||
cancellationToken.throwIfCancellationRequested();
|
cancellationToken.throwIfCancellationRequested();
|
||||||
|
|
||||||
var result: TodoComment[] = [];
|
var result: TodoComment[] = [];
|
||||||
|
|
||||||
if (descriptors.length > 0) {
|
if (descriptors.length > 0) {
|
||||||
var regExp = getTodoCommentsRegExp(descriptors);
|
var regExp = getTodoCommentsRegExp();
|
||||||
|
|
||||||
var matchArray: RegExpExecArray;
|
var matchArray: RegExpExecArray;
|
||||||
while (matchArray = regExp.exec(fileContents)) {
|
while (matchArray = regExp.exec(fileContents)) {
|
||||||
|
@ -3842,7 +3855,7 @@ module ts {
|
||||||
// ["// hack 1", "// ", "hack 1", undefined, "hack"]
|
// ["// hack 1", "// ", "hack 1", undefined, "hack"]
|
||||||
//
|
//
|
||||||
// Here are the relevant capture groups:
|
// Here are the relevant capture groups:
|
||||||
// 0) The full match for the entire regex.
|
// 0) The full match for the entire regexp.
|
||||||
// 1) The preamble to the message portion.
|
// 1) The preamble to the message portion.
|
||||||
// 2) The message portion.
|
// 2) The message portion.
|
||||||
// 3...N) The descriptor that was matched - by index. 'undefined' for each
|
// 3...N) The descriptor that was matched - by index. 'undefined' for each
|
||||||
|
@ -3856,20 +3869,19 @@ module ts {
|
||||||
var preamble = matchArray[1];
|
var preamble = matchArray[1];
|
||||||
var matchPosition = matchArray.index + preamble.length;
|
var matchPosition = matchArray.index + preamble.length;
|
||||||
|
|
||||||
// Ok, we have found a match in the file. This is only an acceptable match if
|
// OK, we have found a match in the file. This is only an acceptable match if
|
||||||
// it is contained within a comment.
|
// it is contained within a comment.
|
||||||
var token = TypeScript.findToken(syntaxTree.sourceUnit(), matchPosition);
|
var token = getTokenAtPosition(sourceFile, matchPosition);
|
||||||
|
|
||||||
if (matchPosition >= TypeScript.start(token) && matchPosition < TypeScript.end(token)) {
|
if (token.getStart() <= matchPosition && matchPosition < token.getEnd()) {
|
||||||
// match was within the token itself. Not in the comment. Keep searching
|
// match was within the token itself. Not in the comment. Keep searching
|
||||||
// descriptor.
|
// descriptor.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Looks to be within the trivia. See if we can find the comment containing it.
|
// Looks to be within the trivia. See if we can find the comment containing it.
|
||||||
var triviaList = matchPosition < TypeScript.start(token) ? token.leadingTrivia(syntaxTree.text) : token.trailingTrivia(syntaxTree.text);
|
if (!getContainingComment(getTrailingComments(fileContents, token.getFullStart()), matchPosition) &&
|
||||||
var trivia = findContainingComment(triviaList, matchPosition);
|
!getContainingComment(getLeadingComments(fileContents, token.getFullStart()), matchPosition)) {
|
||||||
if (trivia === null) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3893,24 +3905,114 @@ module ts {
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
|
||||||
|
|
||||||
function isLetterOrDigit(char: number): boolean {
|
function escapeRegExp(str: string): string {
|
||||||
return (char >= TypeScript.CharacterCodes.a && char <= TypeScript.CharacterCodes.z) ||
|
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
||||||
(char >= TypeScript.CharacterCodes.A && char <= TypeScript.CharacterCodes.Z) ||
|
}
|
||||||
(char >= TypeScript.CharacterCodes._0 && char <= TypeScript.CharacterCodes._9);
|
|
||||||
}
|
|
||||||
|
|
||||||
function findContainingComment(triviaList: TypeScript.ISyntaxTriviaList, position: number): TypeScript.ISyntaxTrivia {
|
function getTodoCommentsRegExp(): RegExp {
|
||||||
for (var i = 0, n = triviaList.count(); i < n; i++) {
|
// NOTE: ?: means 'non-capture group'. It allows us to have groups without having to
|
||||||
var trivia = triviaList.syntaxTriviaAt(i);
|
// filter them out later in the final result array.
|
||||||
var fullEnd = trivia.fullStart() + trivia.fullWidth();
|
|
||||||
if (trivia.isComment() && trivia.fullStart() <= position && position < fullEnd) {
|
// TODO comments can appear in one of the following forms:
|
||||||
return trivia;
|
//
|
||||||
|
// 1) // TODO or /////////// TODO
|
||||||
|
//
|
||||||
|
// 2) /* TODO or /********** TODO
|
||||||
|
//
|
||||||
|
// 3) /*
|
||||||
|
// * TODO
|
||||||
|
// */
|
||||||
|
//
|
||||||
|
// The following three regexps are used to match the start of the text up to the TODO
|
||||||
|
// comment portion.
|
||||||
|
var singleLineCommentStart = /(?:\/\/+\s*)/.source;
|
||||||
|
var multiLineCommentStart = /(?:\/\*+\s*)/.source;
|
||||||
|
var anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source;
|
||||||
|
|
||||||
|
// Match any of the above three TODO comment start regexps.
|
||||||
|
// Note that the outermost group *is* a capture group. We want to capture the preamble
|
||||||
|
// so that we can determine the starting position of the TODO comment match.
|
||||||
|
var preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")";
|
||||||
|
|
||||||
|
// Takes the descriptors and forms a regexp that matches them as if they were literals.
|
||||||
|
// For example, if the descriptors are "TODO(jason)" and "HACK", then this will be:
|
||||||
|
//
|
||||||
|
// (?:(TODO\(jason\))|(HACK))
|
||||||
|
//
|
||||||
|
// Note that the outermost group is *not* a capture group, but the innermost groups
|
||||||
|
// *are* capture groups. By capturing the inner literals we can determine after
|
||||||
|
// matching which descriptor we are dealing with.
|
||||||
|
var literals = "(?:" + map(descriptors, d => "(" + escapeRegExp(d.text) + ")").join("|") + ")";
|
||||||
|
|
||||||
|
// After matching a descriptor literal, the following regexp matches the rest of the
|
||||||
|
// text up to the end of the line (or */).
|
||||||
|
var endOfLineOrEndOfComment = /(?:$|\*\/)/.source
|
||||||
|
var messageRemainder = /(?:.*?)/.source
|
||||||
|
|
||||||
|
// This is the portion of the match we'll return as part of the TODO comment result. We
|
||||||
|
// match the literal portion up to the end of the line or end of comment.
|
||||||
|
var messagePortion = "(" + literals + messageRemainder + ")";
|
||||||
|
var regExpString = preamble + messagePortion + endOfLineOrEndOfComment;
|
||||||
|
|
||||||
|
// The final regexp will look like this:
|
||||||
|
// /((?:\/\/+\s*)|(?:\/\*+\s*)|(?:^(?:\s|\*)*))((?:(TODO\(jason\))|(HACK))(?:.*?))(?:$|\*\/)/gim
|
||||||
|
|
||||||
|
// The flags of the regexp are important here.
|
||||||
|
// 'g' is so that we are doing a global search and can find matches several times
|
||||||
|
// in the input.
|
||||||
|
//
|
||||||
|
// 'i' is for case insensitivity (We do this to match C# TODO comment code).
|
||||||
|
//
|
||||||
|
// 'm' is so we can find matches in a multi-line input.
|
||||||
|
return new RegExp(regExpString, "gim");
|
||||||
|
}
|
||||||
|
|
||||||
|
function getContainingComment(comments: Comment[], position: number): Comment {
|
||||||
|
if (comments) {
|
||||||
|
for (var i = 0, n = comments.length; i < n; i++) {
|
||||||
|
var comment = comments[i];
|
||||||
|
if (comment.pos <= position && position < comment.end) {
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isLetterOrDigit(char: number): boolean {
|
||||||
|
return (char >= TypeScript.CharacterCodes.a && char <= TypeScript.CharacterCodes.z) ||
|
||||||
|
(char >= TypeScript.CharacterCodes.A && char <= TypeScript.CharacterCodes.Z) ||
|
||||||
|
(char >= TypeScript.CharacterCodes._0 && char <= TypeScript.CharacterCodes._9);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getRenameInfo(fileName: string, position: number): RenameInfo {
|
||||||
|
synchronizeHostData();
|
||||||
|
|
||||||
|
fileName = TypeScript.switchToForwardSlashes(fileName);
|
||||||
|
var sourceFile = getSourceFile(fileName);
|
||||||
|
|
||||||
|
var node = getNodeAtPosition(sourceFile, position);
|
||||||
|
|
||||||
|
// Can only rename an identifier.
|
||||||
|
if (node && node.kind === SyntaxKind.Identifier) {
|
||||||
|
var symbol = typeInfoResolver.getSymbolInfo(node);
|
||||||
|
|
||||||
|
// Only allow a symbol to be renamed if it actually has at least one declaration.
|
||||||
|
if (symbol && symbol.getDeclarations() && symbol.getDeclarations().length > 0) {
|
||||||
|
var kind = getSymbolKind(symbol);
|
||||||
|
if (kind) {
|
||||||
|
return RenameInfo.Create(symbol.name, typeInfoResolver.getFullyQualifiedName(symbol), kind,
|
||||||
|
getNodeModifiers(symbol.getDeclarations()[0]),
|
||||||
|
new TypeScript.TextSpan(node.getStart(), node.getWidth()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return RenameInfo.CreateError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_this_element.key));
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -3933,7 +4035,7 @@ module ts {
|
||||||
getNameOrDottedNameSpan: getNameOrDottedNameSpan,
|
getNameOrDottedNameSpan: getNameOrDottedNameSpan,
|
||||||
getBreakpointStatementAtPosition: getBreakpointStatementAtPosition,
|
getBreakpointStatementAtPosition: getBreakpointStatementAtPosition,
|
||||||
getNavigateToItems: getNavigateToItems,
|
getNavigateToItems: getNavigateToItems,
|
||||||
getRenameInfo: (fileName, position): RenameInfo => RenameInfo.CreateError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_this_element.key)),
|
getRenameInfo: getRenameInfo,
|
||||||
getNavigationBarItems: getNavigationBarItems,
|
getNavigationBarItems: getNavigationBarItems,
|
||||||
getOutliningSpans: getOutliningSpans,
|
getOutliningSpans: getOutliningSpans,
|
||||||
getTodoComments: getTodoComments,
|
getTodoComments: getTodoComments,
|
||||||
|
@ -3995,9 +4097,6 @@ module ts {
|
||||||
text = "/*\n" + text;
|
text = "/*\n" + text;
|
||||||
offset = 3;
|
offset = 3;
|
||||||
break;
|
break;
|
||||||
case EndOfLineState.EndingWithDotToken:
|
|
||||||
lastToken = SyntaxKind.DotToken;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var result: ClassificationResult = {
|
var result: ClassificationResult = {
|
||||||
|
@ -4005,7 +4104,7 @@ module ts {
|
||||||
entries: []
|
entries: []
|
||||||
};
|
};
|
||||||
|
|
||||||
scanner = createScanner(ScriptTarget.ES5, text, onError, processComment);
|
scanner = createScanner(ScriptTarget.ES5, /*skipTrivia*/ true, text, onError, processComment);
|
||||||
|
|
||||||
var token = SyntaxKind.Unknown;
|
var token = SyntaxKind.Unknown;
|
||||||
do {
|
do {
|
||||||
|
@ -4065,9 +4164,6 @@ module ts {
|
||||||
: EndOfLineState.InSingleQuoteStringLiteral;
|
: EndOfLineState.InSingleQuoteStringLiteral;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (token === SyntaxKind.DotToken) {
|
|
||||||
result.finalLexState = EndOfLineState.EndingWithDotToken;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
tests/cases/compiler/enumConflictsWithGlobalIdentifier.ts(5,5): error TS1005: ',' expected.
|
tests/cases/compiler/enumConflictsWithGlobalIdentifier.ts(4,28): error TS1003: Identifier expected.
|
||||||
tests/cases/compiler/enumConflictsWithGlobalIdentifier.ts(4,9): error TS2304: Cannot find name 'IgnoreRulesSpecific'.
|
tests/cases/compiler/enumConflictsWithGlobalIdentifier.ts(4,9): error TS2304: Cannot find name 'IgnoreRulesSpecific'.
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,9 +7,9 @@ tests/cases/compiler/enumConflictsWithGlobalIdentifier.ts(4,9): error TS2304: Ca
|
||||||
IgnoreRulesSpecific = 0,
|
IgnoreRulesSpecific = 0,
|
||||||
}
|
}
|
||||||
var x = IgnoreRulesSpecific.
|
var x = IgnoreRulesSpecific.
|
||||||
|
~
|
||||||
|
!!! error TS1003: Identifier expected.
|
||||||
~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~
|
||||||
!!! error TS2304: Cannot find name 'IgnoreRulesSpecific'.
|
!!! error TS2304: Cannot find name 'IgnoreRulesSpecific'.
|
||||||
var y = Position.IgnoreRulesSpecific;
|
var y = Position.IgnoreRulesSpecific;
|
||||||
~
|
|
||||||
!!! error TS1005: ',' expected.
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
tests/cases/compiler/enumMemberResolution.ts(5,5): error TS1005: ',' expected.
|
tests/cases/compiler/enumMemberResolution.ts(4,28): error TS1003: Identifier expected.
|
||||||
tests/cases/compiler/enumMemberResolution.ts(4,9): error TS2304: Cannot find name 'IgnoreRulesSpecific'.
|
tests/cases/compiler/enumMemberResolution.ts(4,9): error TS2304: Cannot find name 'IgnoreRulesSpecific'.
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,10 +7,10 @@ tests/cases/compiler/enumMemberResolution.ts(4,9): error TS2304: Cannot find nam
|
||||||
IgnoreRulesSpecific = 0
|
IgnoreRulesSpecific = 0
|
||||||
}
|
}
|
||||||
var x = IgnoreRulesSpecific. // error
|
var x = IgnoreRulesSpecific. // error
|
||||||
|
~
|
||||||
|
!!! error TS1003: Identifier expected.
|
||||||
~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~
|
||||||
!!! error TS2304: Cannot find name 'IgnoreRulesSpecific'.
|
!!! error TS2304: Cannot find name 'IgnoreRulesSpecific'.
|
||||||
var y = 1;
|
var y = 1;
|
||||||
~
|
|
||||||
!!! error TS1005: ',' expected.
|
|
||||||
var z = Position2.IgnoreRulesSpecific; // no error
|
var z = Position2.IgnoreRulesSpecific; // no error
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
EmitOutputStatus : Succeeded
|
EmitOutputStatus : Succeeded
|
||||||
Filename : tests/cases/fourslash/inputFile1.js
|
Filename : tests/cases/fourslash/inputFile1.js
|
||||||
var x = 5;
|
var x = 5;
|
||||||
var Bar = (function () {
|
var Bar = (function () {
|
||||||
function Bar() {
|
function Bar() {
|
||||||
}
|
}
|
||||||
return Bar;
|
return Bar;
|
||||||
})();
|
})();
|
||||||
Filename : tests/cases/fourslash/inputFile1.d.ts
|
Filename : tests/cases/fourslash/inputFile1.d.ts
|
||||||
declare var x: number;
|
declare var x: number;
|
||||||
declare class Bar {
|
declare class Bar {
|
||||||
x: string;
|
x: string;
|
||||||
y: number;
|
y: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
EmitOutputStatus : Succeeded
|
EmitOutputStatus : Succeeded
|
||||||
Filename : tests/cases/fourslash/inputFile2.js
|
Filename : tests/cases/fourslash/inputFile2.js
|
||||||
var x1 = "hello world";
|
var x1 = "hello world";
|
||||||
var Foo = (function () {
|
var Foo = (function () {
|
||||||
function Foo() {
|
function Foo() {
|
||||||
}
|
}
|
||||||
return Foo;
|
return Foo;
|
||||||
})();
|
})();
|
||||||
Filename : tests/cases/fourslash/inputFile2.d.ts
|
Filename : tests/cases/fourslash/inputFile2.d.ts
|
||||||
declare var x1: string;
|
declare var x1: string;
|
||||||
declare class Foo {
|
declare class Foo {
|
||||||
x: string;
|
x: string;
|
||||||
y: number;
|
y: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
EmitOutputStatus : Succeeded
|
EmitOutputStatus : Succeeded
|
||||||
Filename : declSingleFile.js
|
Filename : declSingleFile.js
|
||||||
var x = 5;
|
var x = 5;
|
||||||
var Bar = (function () {
|
var Bar = (function () {
|
||||||
function Bar() {
|
function Bar() {
|
||||||
}
|
}
|
||||||
return Bar;
|
return Bar;
|
||||||
})();
|
})();
|
||||||
var x1 = "hello world";
|
var x1 = "hello world";
|
||||||
var Foo = (function () {
|
var Foo = (function () {
|
||||||
function Foo() {
|
function Foo() {
|
||||||
}
|
}
|
||||||
return Foo;
|
return Foo;
|
||||||
})();
|
})();
|
||||||
Filename : declSingleFile.d.ts
|
Filename : declSingleFile.d.ts
|
||||||
declare var x: number;
|
declare var x: number;
|
||||||
declare class Bar {
|
declare class Bar {
|
||||||
x: string;
|
x: string;
|
||||||
y: number;
|
y: number;
|
||||||
}
|
}
|
||||||
declare var x1: string;
|
declare var x1: string;
|
||||||
declare class Foo {
|
declare class Foo {
|
||||||
x: string;
|
x: string;
|
||||||
y: number;
|
y: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
EmitOutputStatus : Succeeded
|
EmitOutputStatus : Succeeded
|
||||||
Filename : declSingleFile.js.map
|
Filename : declSingleFile.js.map
|
||||||
{"version":3,"file":"declSingleFile.js","sourceRoot":"","sources":["../tests/cases/fourslash/inputFile.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : declSingleFile.js
|
{"version":3,"file":"declSingleFile.js","sourceRoot":"","sources":["../tests/cases/fourslash/inputFile.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : declSingleFile.js
|
||||||
var x = 109;
|
var x = 109;
|
||||||
var foo = "hello world";
|
var foo = "hello world";
|
||||||
var M = (function () {
|
var M = (function () {
|
||||||
function M() {
|
function M() {
|
||||||
}
|
}
|
||||||
return M;
|
return M;
|
||||||
})();
|
})();
|
||||||
//# sourceMappingURL=mapRootDir/declSingleFile.js.map
|
//# sourceMappingURL=mapRootDir/declSingleFile.js.map
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
EmitOutputStatus : Succeeded
|
EmitOutputStatus : Succeeded
|
||||||
Filename : tests/cases/fourslash/inputFile.js
|
Filename : tests/cases/fourslash/inputFile.js
|
||||||
var x;
|
var x;
|
||||||
var M = (function () {
|
var M = (function () {
|
||||||
function M() {
|
function M() {
|
||||||
}
|
}
|
||||||
return M;
|
return M;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
EmitOutputStatus : Succeeded
|
EmitOutputStatus : Succeeded
|
||||||
Filename : tests/cases/fourslash/inputFile2.js
|
Filename : tests/cases/fourslash/inputFile2.js
|
||||||
var x;
|
var x;
|
||||||
var Foo = (function () {
|
var Foo = (function () {
|
||||||
function Foo() {
|
function Foo() {
|
||||||
}
|
}
|
||||||
return Foo;
|
return Foo;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
EmitOutputStatus : Succeeded
|
EmitOutputStatus : Succeeded
|
||||||
Filename : outputDir/singleFile.js
|
Filename : outputDir/singleFile.js
|
||||||
var x;
|
var x;
|
||||||
var Bar = (function () {
|
var Bar = (function () {
|
||||||
function Bar() {
|
function Bar() {
|
||||||
}
|
}
|
||||||
return Bar;
|
return Bar;
|
||||||
})();
|
})();
|
||||||
var x;
|
var x;
|
||||||
var Foo = (function () {
|
var Foo = (function () {
|
||||||
function Foo() {
|
function Foo() {
|
||||||
}
|
}
|
||||||
return Foo;
|
return Foo;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
|
@ -1,32 +1,32 @@
|
||||||
EmitOutputStatus : Succeeded
|
EmitOutputStatus : Succeeded
|
||||||
Filename : tests/cases/fourslash/inputFile3.js
|
Filename : tests/cases/fourslash/inputFile3.js
|
||||||
exports.foo = 10;
|
exports.foo = 10;
|
||||||
exports.bar = "hello world";
|
exports.bar = "hello world";
|
||||||
Filename : tests/cases/fourslash/inputFile3.d.ts
|
Filename : tests/cases/fourslash/inputFile3.d.ts
|
||||||
export declare var foo: number;
|
export declare var foo: number;
|
||||||
export declare var bar: string;
|
export declare var bar: string;
|
||||||
Filename : declSingleFile.js
|
Filename : declSingleFile.js
|
||||||
var x = 5;
|
var x = 5;
|
||||||
var Bar = (function () {
|
var Bar = (function () {
|
||||||
function Bar() {
|
function Bar() {
|
||||||
}
|
}
|
||||||
return Bar;
|
return Bar;
|
||||||
})();
|
})();
|
||||||
var x1 = "hello world";
|
var x1 = "hello world";
|
||||||
var Foo = (function () {
|
var Foo = (function () {
|
||||||
function Foo() {
|
function Foo() {
|
||||||
}
|
}
|
||||||
return Foo;
|
return Foo;
|
||||||
})();
|
})();
|
||||||
Filename : declSingleFile.d.ts
|
Filename : declSingleFile.d.ts
|
||||||
declare var x: number;
|
declare var x: number;
|
||||||
declare class Bar {
|
declare class Bar {
|
||||||
x: string;
|
x: string;
|
||||||
y: number;
|
y: number;
|
||||||
}
|
}
|
||||||
declare var x1: string;
|
declare var x1: string;
|
||||||
declare class Foo {
|
declare class Foo {
|
||||||
x: string;
|
x: string;
|
||||||
y: number;
|
y: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
EmitOutputStatus : Succeeded
|
EmitOutputStatus : Succeeded
|
||||||
Filename : tests/cases/fourslash/inputFile.js.map
|
Filename : tests/cases/fourslash/inputFile.js.map
|
||||||
{"version":3,"file":"inputFile.js","sourceRoot":"","sources":["inputFile.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : tests/cases/fourslash/inputFile.js
|
{"version":3,"file":"inputFile.js","sourceRoot":"","sources":["inputFile.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : tests/cases/fourslash/inputFile.js
|
||||||
var x = 109;
|
var x = 109;
|
||||||
var foo = "hello world";
|
var foo = "hello world";
|
||||||
var M = (function () {
|
var M = (function () {
|
||||||
function M() {
|
function M() {
|
||||||
}
|
}
|
||||||
return M;
|
return M;
|
||||||
})();
|
})();
|
||||||
//# sourceMappingURL=inputFile.js.map
|
//# sourceMappingURL=inputFile.js.map
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
EmitOutputStatus : Succeeded
|
EmitOutputStatus : Succeeded
|
||||||
Filename : sample/outDir/inputFile1.js.map
|
Filename : sample/outDir/inputFile1.js.map
|
||||||
{"version":3,"file":"inputFile1.js","sourceRoot":"","sources":["../../tests/cases/fourslash/inputFile1.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : sample/outDir/inputFile1.js
|
{"version":3,"file":"inputFile1.js","sourceRoot":"","sources":["../../tests/cases/fourslash/inputFile1.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : sample/outDir/inputFile1.js
|
||||||
var x = 109;
|
var x = 109;
|
||||||
var foo = "hello world";
|
var foo = "hello world";
|
||||||
var M = (function () {
|
var M = (function () {
|
||||||
function M() {
|
function M() {
|
||||||
}
|
}
|
||||||
return M;
|
return M;
|
||||||
})();
|
})();
|
||||||
//# sourceMappingURL=inputFile1.js.map
|
//# sourceMappingURL=inputFile1.js.map
|
||||||
EmitOutputStatus : Succeeded
|
EmitOutputStatus : Succeeded
|
||||||
Filename : sample/outDir/inputFile2.js.map
|
Filename : sample/outDir/inputFile2.js.map
|
||||||
{"version":3,"file":"inputFile2.js","sourceRoot":"","sources":["../../tests/cases/fourslash/inputFile2.ts"],"names":[],"mappings":"AAAA,IAAI,KAAK,GAAG,aAAa,CAAC;AAC1B,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC;IACvB,IAAI,CAAC,GAAG,EAAE,CAAC;AACd,CAAC"}Filename : sample/outDir/inputFile2.js
|
{"version":3,"file":"inputFile2.js","sourceRoot":"","sources":["../../tests/cases/fourslash/inputFile2.ts"],"names":[],"mappings":"AAAA,IAAI,KAAK,GAAG,aAAa,CAAC;AAC1B,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC;IACvB,IAAI,CAAC,GAAG,EAAE,CAAC;AACd,CAAC"}Filename : sample/outDir/inputFile2.js
|
||||||
var intro = "hello world";
|
var intro = "hello world";
|
||||||
if (intro !== undefined) {
|
if (intro !== undefined) {
|
||||||
var k = 10;
|
var k = 10;
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=inputFile2.js.map
|
//# sourceMappingURL=inputFile2.js.map
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
EmitOutputStatus : Succeeded
|
EmitOutputStatus : Succeeded
|
||||||
Filename : tests/cases/fourslash/inputFile.js.map
|
Filename : tests/cases/fourslash/inputFile.js.map
|
||||||
{"version":3,"file":"inputFile.js","sourceRoot":"sourceRootDir/","sources":["inputFile.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : tests/cases/fourslash/inputFile.js
|
{"version":3,"file":"inputFile.js","sourceRoot":"sourceRootDir/","sources":["inputFile.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : tests/cases/fourslash/inputFile.js
|
||||||
var x = 109;
|
var x = 109;
|
||||||
var foo = "hello world";
|
var foo = "hello world";
|
||||||
var M = (function () {
|
var M = (function () {
|
||||||
function M() {
|
function M() {
|
||||||
}
|
}
|
||||||
return M;
|
return M;
|
||||||
})();
|
})();
|
||||||
//# sourceMappingURL=inputFile.js.map
|
//# sourceMappingURL=inputFile.js.map
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
EmitOutputStatus : Succeeded
|
EmitOutputStatus : Succeeded
|
||||||
Filename : tests/cases/fourslash/inputFile1.js.map
|
Filename : tests/cases/fourslash/inputFile1.js.map
|
||||||
{"version":3,"file":"inputFile1.js","sourceRoot":"sourceRootDir/","sources":["inputFile1.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : tests/cases/fourslash/inputFile1.js
|
{"version":3,"file":"inputFile1.js","sourceRoot":"sourceRootDir/","sources":["inputFile1.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : tests/cases/fourslash/inputFile1.js
|
||||||
var x = 109;
|
var x = 109;
|
||||||
var foo = "hello world";
|
var foo = "hello world";
|
||||||
var M = (function () {
|
var M = (function () {
|
||||||
function M() {
|
function M() {
|
||||||
}
|
}
|
||||||
return M;
|
return M;
|
||||||
})();
|
})();
|
||||||
//# sourceMappingURL=inputFile1.js.map
|
//# sourceMappingURL=inputFile1.js.map
|
||||||
EmitOutputStatus : Succeeded
|
EmitOutputStatus : Succeeded
|
||||||
Filename : tests/cases/fourslash/inputFile2.js.map
|
Filename : tests/cases/fourslash/inputFile2.js.map
|
||||||
{"version":3,"file":"inputFile2.js","sourceRoot":"sourceRootDir/","sources":["inputFile2.ts"],"names":["C","C.constructor"],"mappings":"AAAA,IAAI,GAAG,GAAG,wBAAwB,CAAC;AACnC,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : tests/cases/fourslash/inputFile2.js
|
{"version":3,"file":"inputFile2.js","sourceRoot":"sourceRootDir/","sources":["inputFile2.ts"],"names":["C","C.constructor"],"mappings":"AAAA,IAAI,GAAG,GAAG,wBAAwB,CAAC;AACnC,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : tests/cases/fourslash/inputFile2.js
|
||||||
var bar = "hello world Typescript";
|
var bar = "hello world Typescript";
|
||||||
var C = (function () {
|
var C = (function () {
|
||||||
function C() {
|
function C() {
|
||||||
}
|
}
|
||||||
return C;
|
return C;
|
||||||
})();
|
})();
|
||||||
//# sourceMappingURL=inputFile2.js.map
|
//# sourceMappingURL=inputFile2.js.map
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
EmitOutputStatus : EmitErrorsEncountered
|
EmitOutputStatus : EmitErrorsEncountered
|
||||||
Filename : tests/cases/fourslash/inputFile.js
|
Filename : tests/cases/fourslash/inputFile.js
|
||||||
var M;
|
var M;
|
||||||
(function (M) {
|
(function (M) {
|
||||||
var C = (function () {
|
var C = (function () {
|
||||||
function C() {
|
function C() {
|
||||||
}
|
}
|
||||||
return C;
|
return C;
|
||||||
})();
|
})();
|
||||||
M.foo = new C();
|
M.foo = new C();
|
||||||
})(M || (M = {}));
|
})(M || (M = {}));
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
EmitOutputStatus : EmitErrorsEncountered
|
EmitOutputStatus : EmitErrorsEncountered
|
||||||
Filename : tests/cases/fourslash/inputFile.js
|
Filename : tests/cases/fourslash/inputFile.js
|
||||||
define(["require", "exports"], function (require, exports) {
|
define(["require", "exports"], function (require, exports) {
|
||||||
var C = (function () {
|
var C = (function () {
|
||||||
function C() {
|
function C() {
|
||||||
}
|
}
|
||||||
return C;
|
return C;
|
||||||
})();
|
})();
|
||||||
var M;
|
var M;
|
||||||
(function (M) {
|
(function (M) {
|
||||||
M.foo = new C();
|
M.foo = new C();
|
||||||
})(M = exports.M || (exports.M = {}));
|
})(M = exports.M || (exports.M = {}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
EmitOutputStatus : JSGeneratedWithSemanticErrors
|
EmitOutputStatus : JSGeneratedWithSemanticErrors
|
||||||
Filename : tests/cases/fourslash/inputFile.js
|
Filename : tests/cases/fourslash/inputFile.js
|
||||||
var x = "hello world";
|
var x = "hello world";
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
EmitOutputStatus : DeclarationGenerationSkipped
|
EmitOutputStatus : DeclarationGenerationSkipped
|
||||||
Filename : tests/cases/fourslash/inputFile.js
|
Filename : tests/cases/fourslash/inputFile.js
|
||||||
var x = "hello world";
|
var x = "hello world";
|
||||||
|
|
||||||
|
|
|
@ -6,4 +6,4 @@ diagnostics.setEditValidation(IncrementalEditValidation.None);
|
||||||
goTo.marker();
|
goTo.marker();
|
||||||
verify.not.completionListIsEmpty();
|
verify.not.completionListIsEmpty();
|
||||||
edit.insert("nu");
|
edit.insert("nu");
|
||||||
verify.completionListContains("number", undefined, undefined, undefined, "primitive type");
|
verify.completionListContains("number", undefined, undefined, undefined, "keyword");
|
|
@ -12,10 +12,10 @@
|
||||||
////f2./*2*/ // here bar has return type any, but bar2 is Foo2
|
////f2./*2*/ // here bar has return type any, but bar2 is Foo2
|
||||||
|
|
||||||
goTo.marker('1');
|
goTo.marker('1');
|
||||||
verify.completionListContains('bar', '(): IFoo');
|
verify.completionListContains('bar', '() => IFoo');
|
||||||
verify.not.completionListContains('bar2');
|
verify.not.completionListContains('bar2');
|
||||||
edit.insert('bar();'); // just to make the file valid before checking next completion location
|
edit.insert('bar();'); // just to make the file valid before checking next completion location
|
||||||
|
|
||||||
goTo.marker('2');
|
goTo.marker('2');
|
||||||
verify.completionListContains('bar', '(): IFoo');
|
verify.completionListContains('bar', '() => IFoo');
|
||||||
verify.completionListContains('bar2', '(): IFoo2');
|
verify.completionListContains('bar2', '() => IFoo2');
|
|
@ -18,8 +18,15 @@
|
||||||
|
|
||||||
////interface test4 implements Foo./*4*/ {}
|
////interface test4 implements Foo./*4*/ {}
|
||||||
|
|
||||||
test.markers().forEach((marker) => {
|
goTo.marker("1");
|
||||||
goTo.position(marker.position, marker.fileName);
|
verify.completionListIsEmpty();
|
||||||
|
|
||||||
verify.completionListIsEmpty();
|
goTo.marker("2");
|
||||||
});
|
verify.completionListIsEmpty();
|
||||||
|
|
||||||
|
goTo.marker("3");
|
||||||
|
verify.completionListIsEmpty();
|
||||||
|
|
||||||
|
// This needs comletion list filtering based on location to work
|
||||||
|
goTo.marker("4");
|
||||||
|
verify.not.completionListIsEmpty();
|
|
@ -24,9 +24,9 @@ goTo.marker("insideFunctionExpression");
|
||||||
verify.memberListContains("foo");
|
verify.memberListContains("foo");
|
||||||
|
|
||||||
goTo.marker("referenceInsideFunctionExpression");
|
goTo.marker("referenceInsideFunctionExpression");
|
||||||
verify.quickInfoIs("(): number");
|
verify.quickInfoIs("() => number");
|
||||||
|
|
||||||
goTo.marker("referenceInGlobalScope");
|
goTo.marker("referenceInGlobalScope");
|
||||||
verify.quickInfoIs("(a: number): string");
|
verify.quickInfoIs("(a: number) => string");
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ verify.completionListContains("bar");
|
||||||
verify.completionListContains("break");
|
verify.completionListContains("break");
|
||||||
verify.completionListContains("any");
|
verify.completionListContains("any");
|
||||||
verify.completionListContains("$");
|
verify.completionListContains("$");
|
||||||
verify.completionListContains("\\u0062");
|
verify.completionListContains("b");
|
||||||
|
|
||||||
// Nothing else should show up
|
// Nothing else should show up
|
||||||
verify.memberListCount(5);
|
verify.memberListCount(5);
|
|
@ -11,4 +11,4 @@
|
||||||
|
|
||||||
goTo.marker();
|
goTo.marker();
|
||||||
verify.memberListContains("bar", 'any');
|
verify.memberListContains("bar", 'any');
|
||||||
verify.memberListContains("foo", '(bar: any): any');
|
verify.memberListContains("foo", '(bar: any) => any');
|
11
tests/cases/fourslash/completionListOfGnericSymbol.ts
Normal file
11
tests/cases/fourslash/completionListOfGnericSymbol.ts
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
/// <reference path="fourslash.ts" />
|
||||||
|
|
||||||
|
// Ensure kind is set correctelly on completions of a generic symbol
|
||||||
|
|
||||||
|
////var a = [1,2,3];
|
||||||
|
////a./**/
|
||||||
|
|
||||||
|
goTo.marker();
|
||||||
|
verify.memberListContains('length', "number", /*docComments*/ undefined, /*fullSymbolName*/ undefined,/*kind*/ "property");
|
||||||
|
verify.memberListContains('toString', "() => string", /*docComments*/ undefined, /*fullSymbolName*/ undefined,/*kind*/ "method");
|
||||||
|
|
17
tests/cases/fourslash/completionListPrivateMembers2.ts
Normal file
17
tests/cases/fourslash/completionListPrivateMembers2.ts
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
/// <reference path="fourslash.ts"/>
|
||||||
|
|
||||||
|
////class Foo {
|
||||||
|
//// private y;
|
||||||
|
//// constructor(private x) {}
|
||||||
|
//// method() { this./*1*/; }
|
||||||
|
////}
|
||||||
|
////var f:Foo;
|
||||||
|
////f./*2*/
|
||||||
|
|
||||||
|
goTo.marker("1");
|
||||||
|
verify.memberListContains("y");
|
||||||
|
verify.memberListContains("x");
|
||||||
|
|
||||||
|
goTo.marker("2");
|
||||||
|
verify.not.memberListContains("x");
|
||||||
|
verify.not.memberListContains("y");
|
16
tests/cases/fourslash/findAllRefsInsideWithBlock.ts
Normal file
16
tests/cases/fourslash/findAllRefsInsideWithBlock.ts
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
/// <reference path='fourslash.ts'/>
|
||||||
|
|
||||||
|
////var x = 0;
|
||||||
|
////
|
||||||
|
////with ({}) {
|
||||||
|
//// var y = x; // Reference of x here should not be picked
|
||||||
|
//// /*2*/y++; // also reference for y should be ignored
|
||||||
|
////}
|
||||||
|
////
|
||||||
|
////x = /*1*/x + 1;
|
||||||
|
|
||||||
|
goTo.marker('1');
|
||||||
|
verify.referencesCountIs(3);
|
||||||
|
|
||||||
|
goTo.marker('2');
|
||||||
|
verify.referencesCountIs(1);
|
|
@ -404,6 +404,14 @@ module FourSlashInterface {
|
||||||
public semanticClassificationsAre(...classifications: { classificationType: string; text: string }[]) {
|
public semanticClassificationsAre(...classifications: { classificationType: string; text: string }[]) {
|
||||||
FourSlash.currentTestState.verifySemanticClassifications(classifications);
|
FourSlash.currentTestState.verifySemanticClassifications(classifications);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public renameInfoSucceeded(displayName?: string, fullDisplayName?: string, kind?: string, kindModifiers?: string) {
|
||||||
|
FourSlash.currentTestState.verifyRenameInfoSucceeded(displayName, fullDisplayName, kind, kindModifiers)
|
||||||
|
}
|
||||||
|
|
||||||
|
public renameInfoFailed(message?: string) {
|
||||||
|
FourSlash.currentTestState.verifyRenameInfoFailed(message)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class edit {
|
export class edit {
|
||||||
|
|
8
tests/cases/fourslash/getRenameInfoTests1.ts
Normal file
8
tests/cases/fourslash/getRenameInfoTests1.ts
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
/// <reference path="fourslash.ts"/>
|
||||||
|
|
||||||
|
////class [|/**/C|] {
|
||||||
|
////
|
||||||
|
////}
|
||||||
|
|
||||||
|
goTo.marker("");
|
||||||
|
verify.renameInfoSucceeded("C");
|
8
tests/cases/fourslash/getRenameInfoTests2.ts
Normal file
8
tests/cases/fourslash/getRenameInfoTests2.ts
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
/// <reference path="fourslash.ts"/>
|
||||||
|
|
||||||
|
/////**/class C {
|
||||||
|
////
|
||||||
|
////}
|
||||||
|
|
||||||
|
goTo.marker("");
|
||||||
|
verify.renameInfoFailed();
|
|
@ -1,11 +1,11 @@
|
||||||
/// <reference path='fourslash.ts'/>
|
/// <reference path='fourslash.ts'/>
|
||||||
|
|
||||||
////interface IFoo {
|
////interface IFoo {
|
||||||
//// x: number;
|
//// x: number;
|
||||||
//// y: string;
|
//// y: string;
|
||||||
////}
|
////}
|
||||||
////
|
////
|
||||||
////function foo<S, T extends IFoo, U extends T, V extends U>() {
|
////function foo<S, T extends IFoo, U extends Object, V extends IFoo>() {
|
||||||
//// var s:S, t: T, u: U, v: V;
|
//// var s:S, t: T, u: U, v: V;
|
||||||
//// s./*S*/; // no constraint, no completion
|
//// s./*S*/; // no constraint, no completion
|
||||||
//// t./*T*/; // IFoo
|
//// t./*T*/; // IFoo
|
||||||
|
@ -22,9 +22,8 @@ verify.memberListContains("y", "string");
|
||||||
verify.memberListCount(2);
|
verify.memberListCount(2);
|
||||||
|
|
||||||
goTo.marker("U");
|
goTo.marker("U");
|
||||||
verify.memberListContains("x", "number");
|
verify.memberListContains("toString", "() => string");
|
||||||
verify.memberListContains("y", "string");
|
verify.memberListCount(7); // constructor, toString, toLocaleString, valueOf, hasOwnProperty, isPrototypeOf, propertyIsEnumerable
|
||||||
verify.memberListCount(2);
|
|
||||||
|
|
||||||
goTo.marker("V");
|
goTo.marker("V");
|
||||||
verify.memberListContains("x", "number");
|
verify.memberListContains("x", "number");
|
|
@ -1,5 +1,5 @@
|
||||||
/// <reference path='fourslash.ts'/>
|
/// <reference path='fourslash.ts'/>
|
||||||
|
|
||||||
////class A {
|
////class A {
|
||||||
//// foo(): string { return ''; }
|
//// foo(): string { return ''; }
|
||||||
////}
|
////}
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
//// }
|
//// }
|
||||||
////}
|
////}
|
||||||
////
|
////
|
||||||
////class C<U extends T, T extends A> {
|
////class C<U extends A, T extends A> {
|
||||||
//// x: U;
|
//// x: U;
|
||||||
//// y = this.x./**/ // completion list here
|
//// y = this.x./**/ // completion list here
|
||||||
////}
|
////}
|
18
tests/cases/fourslash/memberListInReopenedEnum.ts
Normal file
18
tests/cases/fourslash/memberListInReopenedEnum.ts
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/// <reference path='fourslash.ts'/>
|
||||||
|
|
||||||
|
////module M {
|
||||||
|
//// enum E {
|
||||||
|
//// A, B
|
||||||
|
//// }
|
||||||
|
//// enum E {
|
||||||
|
//// C = 0, D
|
||||||
|
//// }
|
||||||
|
//// var x = E./*1*/
|
||||||
|
////}
|
||||||
|
|
||||||
|
|
||||||
|
goTo.marker('1');
|
||||||
|
verify.memberListContains('A', 'E', undefined, "E.A");
|
||||||
|
verify.memberListContains('B', 'E', undefined, "E.B");
|
||||||
|
verify.memberListContains('C', 'E', undefined, "E.C");
|
||||||
|
verify.memberListContains('D', 'E', undefined, "E.D");
|
|
@ -15,8 +15,10 @@ goTo.marker('1');
|
||||||
verify.memberListIsEmpty();
|
verify.memberListIsEmpty();
|
||||||
|
|
||||||
goTo.marker('2');
|
goTo.marker('2');
|
||||||
|
// Only keywords should show in completion, no members or types
|
||||||
verify.not.completionListContains("foo");
|
verify.not.completionListContains("foo");
|
||||||
verify.not.completionListContains("f");
|
verify.not.completionListContains("f");
|
||||||
verify.not.completionListContains("c");
|
verify.not.completionListContains("c");
|
||||||
verify.not.completionListContains("d");
|
verify.not.completionListContains("d");
|
||||||
verify.not.completionListContains("x");
|
verify.not.completionListContains("x");
|
||||||
|
verify.not.completionListContains("Object");
|
12
tests/cases/fourslash/memberListInWithBlock2.ts
Normal file
12
tests/cases/fourslash/memberListInWithBlock2.ts
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
/// <reference path='fourslash.ts'/>
|
||||||
|
|
||||||
|
////interface IFoo {
|
||||||
|
//// a: number;
|
||||||
|
////}
|
||||||
|
////
|
||||||
|
////with (x) {
|
||||||
|
//// var y: IFoo = { /*1*/ };
|
||||||
|
////}
|
||||||
|
|
||||||
|
goTo.marker('1');
|
||||||
|
verify.memberListIsEmpty();
|
7
tests/cases/fourslash/memberListInWithBlock3.ts
Normal file
7
tests/cases/fourslash/memberListInWithBlock3.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
/// <reference path='fourslash.ts'/>
|
||||||
|
|
||||||
|
////var x = { a: 0 };
|
||||||
|
////with(x./*1*/
|
||||||
|
|
||||||
|
goTo.marker('1');
|
||||||
|
verify.memberListContains("a");
|
|
@ -11,5 +11,5 @@
|
||||||
|
|
||||||
goTo.marker();
|
goTo.marker();
|
||||||
verify.memberListCount(2);
|
verify.memberListCount(2);
|
||||||
verify.memberListContains('pubMeth', '(): void');
|
verify.memberListContains('pubMeth', '() => void');
|
||||||
verify.memberListContains('pubProp', 'number');
|
verify.memberListContains('pubProp', 'number');
|
|
@ -16,9 +16,9 @@
|
||||||
|
|
||||||
// Verify the memberlist of module when the following line has a keyword
|
// Verify the memberlist of module when the following line has a keyword
|
||||||
goTo.marker('namedType');
|
goTo.marker('namedType');
|
||||||
verify.completionListContains('C1', 'TypeModule1.C1');
|
verify.completionListContains('C1');
|
||||||
verify.completionListContains('C2', 'TypeModule1.C2');
|
verify.completionListContains('C2');
|
||||||
|
|
||||||
goTo.marker('dotedExpression');
|
goTo.marker('dotedExpression');
|
||||||
verify.completionListContains('C1', 'TypeModule1.C1');
|
verify.completionListContains('C1');
|
||||||
verify.completionListContains('C2', 'TypeModule1.C2');
|
verify.completionListContains('C2');
|
|
@ -8,6 +8,6 @@
|
||||||
////}
|
////}
|
||||||
|
|
||||||
goTo.marker();
|
goTo.marker();
|
||||||
verify.memberListContains('privMeth', '(): void');
|
verify.memberListContains('privMeth', '() => void');
|
||||||
verify.memberListContains('pubMeth', '(): void');
|
verify.memberListContains('pubMeth', '() => void');
|
||||||
verify.memberListContains('pubProp', 'number');
|
verify.memberListContains('pubProp', 'number');
|
|
@ -1,3 +1,3 @@
|
||||||
//// // [|TODO|]
|
//// // [|TODO|]
|
||||||
debugger;
|
|
||||||
verify.todoCommentsInCurrentFile(["TODO"]);
|
verify.todoCommentsInCurrentFile(["TODO"]);
|
|
@ -2,5 +2,5 @@
|
||||||
//// [|todo 1|]
|
//// [|todo 1|]
|
||||||
//// [|hack 2|]
|
//// [|hack 2|]
|
||||||
//// */
|
//// */
|
||||||
debugger;
|
|
||||||
verify.todoCommentsInCurrentFile(["TODO", "HACK"]);
|
verify.todoCommentsInCurrentFile(["TODO", "HACK"]);
|
|
@ -2,5 +2,5 @@
|
||||||
//// [|TODO(jason) 1|]
|
//// [|TODO(jason) 1|]
|
||||||
//// [|HACK 2|]
|
//// [|HACK 2|]
|
||||||
//// */
|
//// */
|
||||||
debugger;
|
|
||||||
verify.todoCommentsInCurrentFile(["TODO(jason)", "HACK"]);
|
verify.todoCommentsInCurrentFile(["TODO(jason)", "HACK"]);
|
|
@ -2,5 +2,5 @@
|
||||||
//// [|TODO(jason) 1|]
|
//// [|TODO(jason) 1|]
|
||||||
//// [|HACK 2|]
|
//// [|HACK 2|]
|
||||||
//// */
|
//// */
|
||||||
debugger;
|
|
||||||
verify.todoCommentsInCurrentFile(["HACK", "TODO(jason)"]);
|
verify.todoCommentsInCurrentFile(["HACK", "TODO(jason)"]);
|
|
@ -1,4 +1,3 @@
|
||||||
//// TODO
|
//// TODO
|
||||||
|
|
||||||
debugger;
|
|
||||||
verify.todoCommentsInCurrentFile(["TODO"]);
|
verify.todoCommentsInCurrentFile(["TODO"]);
|
|
@ -1,3 +1,3 @@
|
||||||
//// BAR // [|TODO|]
|
//// BAR // [|TODO|]
|
||||||
debugger;
|
|
||||||
verify.todoCommentsInCurrentFile(["TODO"]);
|
verify.todoCommentsInCurrentFile(["TODO"]);
|
|
@ -1,3 +1,3 @@
|
||||||
//// "// HACK 1";
|
//// "// HACK 1";
|
||||||
debugger;
|
|
||||||
verify.todoCommentsInCurrentFile(["TODO(jason)", "HACK"]);
|
verify.todoCommentsInCurrentFile(["TODO(jason)", "HACK"]);
|
|
@ -1,3 +1,3 @@
|
||||||
//// //// [|HACK 1|]
|
//// //// [|HACK 1|]
|
||||||
debugger;
|
|
||||||
verify.todoCommentsInCurrentFile(["TODO(jason)", "HACK"]);
|
verify.todoCommentsInCurrentFile(["TODO(jason)", "HACK"]);
|
|
@ -1,3 +1,3 @@
|
||||||
//// /**** [|HACK 1 |]*/ a
|
//// /**** [|HACK 1 |]*/ a
|
||||||
debugger;
|
|
||||||
verify.todoCommentsInCurrentFile(["TODO(jason)", "HACK"]);
|
verify.todoCommentsInCurrentFile(["TODO(jason)", "HACK"]);
|
|
@ -1,3 +1,3 @@
|
||||||
//// // not TODO
|
//// // not TODO
|
||||||
debugger;
|
|
||||||
verify.todoCommentsInCurrentFile(["TODO"]);
|
verify.todoCommentsInCurrentFile(["TODO"]);
|
|
@ -1,3 +1,3 @@
|
||||||
//// // [|TODO with stuff|]
|
//// // [|TODO with stuff|]
|
||||||
debugger;
|
|
||||||
verify.todoCommentsInCurrentFile(["TODO"]);
|
verify.todoCommentsInCurrentFile(["TODO"]);
|
|
@ -1,3 +1,3 @@
|
||||||
//// // TODOnomatch
|
//// // TODOnomatch
|
||||||
debugger;
|
|
||||||
verify.todoCommentsInCurrentFile(["TODO"]);
|
verify.todoCommentsInCurrentFile(["TODO"]);
|
|
@ -2,5 +2,5 @@
|
||||||
//// [|TODO 1|]
|
//// [|TODO 1|]
|
||||||
//// [|TODO 2|]
|
//// [|TODO 2|]
|
||||||
//// */
|
//// */
|
||||||
debugger;
|
|
||||||
verify.todoCommentsInCurrentFile(["TODO"]);
|
verify.todoCommentsInCurrentFile(["TODO"]);
|
|
@ -2,5 +2,5 @@
|
||||||
//// * [|TODO 1|]
|
//// * [|TODO 1|]
|
||||||
//// * [|TODO 2|]
|
//// * [|TODO 2|]
|
||||||
//// */
|
//// */
|
||||||
debugger;
|
|
||||||
verify.todoCommentsInCurrentFile(["TODO"]);
|
verify.todoCommentsInCurrentFile(["TODO"]);
|
|
@ -2,5 +2,5 @@
|
||||||
//// [|TODO 1|]
|
//// [|TODO 1|]
|
||||||
//// [|HACK 2|]
|
//// [|HACK 2|]
|
||||||
//// */
|
//// */
|
||||||
debugger;
|
|
||||||
verify.todoCommentsInCurrentFile(["TODO", "HACK"]);
|
verify.todoCommentsInCurrentFile(["TODO", "HACK"]);
|
|
@ -2,5 +2,5 @@
|
||||||
//// [|HACK 1|]
|
//// [|HACK 1|]
|
||||||
//// [|TODO 2|]
|
//// [|TODO 2|]
|
||||||
//// */
|
//// */
|
||||||
debugger;
|
|
||||||
verify.todoCommentsInCurrentFile(["TODO", "HACK"]);
|
verify.todoCommentsInCurrentFile(["TODO", "HACK"]);
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue