mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Merge branch 'master' into jsFileCompilation
This commit is contained in:
commit
b217b8b620
178 files changed
+42151
-6608
No files matched your search
@@ -695,8 +695,8 @@ namespace ts.formatting {
|
||||
let tokenStart = sourceFile.getLineAndCharacterOfPosition(currentTokenInfo.token.pos);
|
||||
if (isTokenInRange) {
|
||||
let rangeHasError = rangeContainsError(currentTokenInfo.token);
|
||||
// save prevStartLine since processRange will overwrite this value with current ones
|
||||
let prevStartLine = previousRangeStartLine;
|
||||
// save previousRange since processRange will overwrite this value with current one
|
||||
let savePreviousRange = previousRange;
|
||||
lineAdded = processRange(currentTokenInfo.token, tokenStart, parent, childContextNode, dynamicIndentation);
|
||||
if (rangeHasError) {
|
||||
// do not indent comments\token if token range overlaps with some error
|
||||
@@ -707,7 +707,9 @@ namespace ts.formatting {
|
||||
indentToken = lineAdded;
|
||||
}
|
||||
else {
|
||||
indentToken = lastTriviaWasNewLine && tokenStart.line !== prevStartLine;
|
||||
// indent token only if end line of previous range does not match start line of the token
|
||||
const prevEndLine = savePreviousRange && sourceFile.getLineAndCharacterOfPosition(savePreviousRange.end).line;
|
||||
indentToken = lastTriviaWasNewLine && tokenStart.line !== prevEndLine;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,9 +174,7 @@ namespace ts {
|
||||
let jsDocCompletionEntries: CompletionEntry[];
|
||||
|
||||
function createNode(kind: SyntaxKind, pos: number, end: number, flags: NodeFlags, parent?: Node): NodeObject {
|
||||
let node = <NodeObject> new (getNodeConstructor(kind))();
|
||||
node.pos = pos;
|
||||
node.end = end;
|
||||
let node = <NodeObject> new (getNodeConstructor(kind))(pos, end);
|
||||
node.flags = flags;
|
||||
node.parent = parent;
|
||||
return node;
|
||||
@@ -7199,7 +7197,7 @@ namespace ts {
|
||||
let sourceFile = current.getSourceFile();
|
||||
var canonicalName = getCanonicalFileName(ts.normalizePath(sourceFile.fileName));
|
||||
if (sourceFile && getCanonicalFileName(ts.normalizePath(sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) {
|
||||
return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key));
|
||||
return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7221,7 +7219,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_this_element.key));
|
||||
return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_this_element));
|
||||
|
||||
function getRenameInfoError(localizedErrorMessage: string): RenameInfo {
|
||||
return {
|
||||
@@ -7804,14 +7802,14 @@ namespace ts {
|
||||
function initializeServices() {
|
||||
objectAllocator = {
|
||||
getNodeConstructor: kind => {
|
||||
function Node() {
|
||||
function Node(pos: number, end: number) {
|
||||
this.pos = pos;
|
||||
this.end = end;
|
||||
this.flags = NodeFlags.None;
|
||||
this.parent = undefined;
|
||||
}
|
||||
let proto = kind === SyntaxKind.SourceFile ? new SourceFileObject() : new NodeObject();
|
||||
proto.kind = kind;
|
||||
proto.pos = -1;
|
||||
proto.end = -1;
|
||||
proto.flags = 0;
|
||||
proto.parent = undefined;
|
||||
Node.prototype = proto;
|
||||
return <any>Node;
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user