mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
@@ -3105,6 +3105,7 @@ namespace ts {
|
||||
let node = currentToken;
|
||||
let isRightOfDot = false;
|
||||
let isRightOfOpenTag = false;
|
||||
let isStartingCloseTag = false;
|
||||
|
||||
let location = getTouchingPropertyName(sourceFile, position);
|
||||
if (contextToken) {
|
||||
@@ -3130,9 +3131,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3155,6 +3161,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
|
||||
|
||||
15
tests/cases/fourslash/tsxCompletion10.ts
Normal file
15
tests/cases/fourslash/tsxCompletion10.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//@Filename: file.tsx
|
||||
//// declare module JSX {
|
||||
//// interface Element { }
|
||||
//// interface IntrinsicElements {
|
||||
//// div: { ONE: string; TWO: number; }
|
||||
//// }
|
||||
//// }
|
||||
//// var x1 = <div><//**/
|
||||
|
||||
goTo.marker();
|
||||
verify.completionListItemsCountIsGreaterThan(0);
|
||||
verify.not.completionListItemsCountIsGreaterThan(1);
|
||||
verify.completionListContains('div');
|
||||
Reference in New Issue
Block a user