mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-29 16:29:19 -05:00
Merge branch 'master' into reachabilityChecks
This commit is contained in:
@@ -3112,6 +3112,7 @@ namespace ts {
|
||||
let node = currentToken;
|
||||
let isRightOfDot = false;
|
||||
let isRightOfOpenTag = false;
|
||||
let isStartingCloseTag = false;
|
||||
|
||||
let location = getTouchingPropertyName(sourceFile, position);
|
||||
if (contextToken) {
|
||||
@@ -3137,9 +3138,14 @@ namespace ts {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else if (kind === SyntaxKind.LessThanToken && sourceFile.languageVariant === LanguageVariant.JSX) {
|
||||
isRightOfOpenTag = true;
|
||||
location = contextToken;
|
||||
else if (sourceFile.languageVariant === LanguageVariant.JSX) {
|
||||
if (kind === SyntaxKind.LessThanToken) {
|
||||
isRightOfOpenTag = true;
|
||||
location = contextToken;
|
||||
}
|
||||
else if (kind === SyntaxKind.SlashToken && contextToken.parent.kind === SyntaxKind.JsxClosingElement) {
|
||||
isStartingCloseTag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3162,6 +3168,13 @@ namespace ts {
|
||||
isMemberCompletion = true;
|
||||
isNewIdentifierLocation = false;
|
||||
}
|
||||
else if (isStartingCloseTag) {
|
||||
let tagName = (<JsxElement>contextToken.parent.parent).openingElement.tagName;
|
||||
symbols = [typeChecker.getSymbolAtLocation(tagName)];
|
||||
|
||||
isMemberCompletion = true;
|
||||
isNewIdentifierLocation = false;
|
||||
}
|
||||
else {
|
||||
// For JavaScript or TypeScript, if we're not after a dot, then just try to get the
|
||||
// global symbols in scope. These results should be valid for either language as
|
||||
@@ -3318,11 +3331,29 @@ namespace ts {
|
||||
let start = new Date().getTime();
|
||||
let result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken) ||
|
||||
isSolelyIdentifierDefinitionLocation(contextToken) ||
|
||||
isDotOfNumericLiteral(contextToken);
|
||||
isDotOfNumericLiteral(contextToken) ||
|
||||
isInJsxText(contextToken);
|
||||
log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start));
|
||||
return result;
|
||||
}
|
||||
|
||||
function isInJsxText(contextToken: Node): boolean {
|
||||
if (contextToken.kind === SyntaxKind.JsxText) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (contextToken.kind === SyntaxKind.GreaterThanToken && contextToken.parent) {
|
||||
if (contextToken.parent.kind === SyntaxKind.JsxOpeningElement) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (contextToken.parent.kind === SyntaxKind.JsxClosingElement || contextToken.parent.kind === SyntaxKind.JsxSelfClosingElement) {
|
||||
return contextToken.parent.parent && contextToken.parent.parent.kind === SyntaxKind.JsxElement;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isNewIdentifierDefinitionLocation(previousToken: Node): boolean {
|
||||
if (previousToken) {
|
||||
let containingNodeKind = previousToken.parent.kind;
|
||||
|
||||
@@ -989,7 +989,7 @@ namespace ts {
|
||||
() => {
|
||||
let text = sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength());
|
||||
|
||||
let result = parseConfigFileText(fileName, text);
|
||||
let result = parseConfigFileTextToJson(fileName, text);
|
||||
|
||||
if (result.error) {
|
||||
return {
|
||||
@@ -999,7 +999,7 @@ namespace ts {
|
||||
};
|
||||
}
|
||||
|
||||
var configFile = parseConfigFile(result.config, this.host, getDirectoryPath(normalizeSlashes(fileName)));
|
||||
var configFile = parseJsonConfigFileContent(result.config, this.host, getDirectoryPath(normalizeSlashes(fileName)));
|
||||
|
||||
return {
|
||||
options: configFile.options,
|
||||
|
||||
Reference in New Issue
Block a user