mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 21:06:50 -05:00
Consistently use "JSX Attribute" completion kind (#19781)
* Consistently use "JSX Attribute" completion kind * Update tests and fix bug * Fix bug: In a JsxOpeningElement, if at an Identifier we are not at an attribute but at the tag itself. If at a GreaterThanToken, we are about to fill in an attribute.
This commit is contained in:
@@ -75,10 +75,16 @@ namespace ts.SymbolDisplay {
|
||||
}
|
||||
return unionPropertyKind;
|
||||
}
|
||||
if (location.parent && isJsxAttribute(location.parent)) {
|
||||
return ScriptElementKind.jsxAttribute;
|
||||
// If we requested completions after `x.` at the top-level, we may be at a source file location.
|
||||
switch (location.parent && location.parent.kind) {
|
||||
// If we've typed a character of the attribute name, will be 'JsxAttribute', else will be 'JsxOpeningElement'.
|
||||
case SyntaxKind.JsxOpeningElement:
|
||||
return location.kind === SyntaxKind.Identifier ? ScriptElementKind.memberVariableElement : ScriptElementKind.jsxAttribute;
|
||||
case SyntaxKind.JsxAttribute:
|
||||
return ScriptElementKind.jsxAttribute;
|
||||
default:
|
||||
return ScriptElementKind.memberVariableElement;
|
||||
}
|
||||
return ScriptElementKind.memberVariableElement;
|
||||
}
|
||||
|
||||
return ScriptElementKind.unknown;
|
||||
|
||||
Reference in New Issue
Block a user