File tree Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -856,7 +856,7 @@ namespace FourSlash {
856
856
private verifyCompletionsWorker ( options : FourSlashInterface . VerifyCompletionsOptions ) : void {
857
857
const actualCompletions = this . getCompletionListAtCaret ( { ...options . preferences , triggerCharacter : options . triggerCharacter } ) ! ;
858
858
if ( ! actualCompletions ) {
859
- if ( options . exact === undefined ) return ;
859
+ if ( "exact" in options && options . exact === undefined ) return ;
860
860
this . raiseError ( `No completions at position '${ this . currentCaretPosition } '.` ) ;
861
861
}
862
862
Original file line number Diff line number Diff line change @@ -961,8 +961,7 @@ namespace ts.Completions {
961
961
break ;
962
962
963
963
case SyntaxKind . BinaryExpression :
964
- if ( ! ( ( parent as BinaryExpression ) . left . flags & NodeFlags . ThisNodeHasError ) ) {
965
- // It has a left-hand side, so we're not in an opening JSX tag.
964
+ if ( ! binaryExpressionMayBeOpenTag ( parent as BinaryExpression ) ) {
966
965
break ;
967
966
}
968
967
// falls through
@@ -2256,7 +2255,7 @@ namespace ts.Completions {
2256
2255
return isStringLiteralOrTemplate ( contextToken ) && position === contextToken . getStart ( sourceFile ) + 1 ;
2257
2256
case "<" :
2258
2257
// Opening JSX tag
2259
- return contextToken . kind === SyntaxKind . LessThanToken && contextToken . parent . kind !== SyntaxKind . BinaryExpression ;
2258
+ return contextToken . kind === SyntaxKind . LessThanToken && ( ! isBinaryExpression ( contextToken . parent ) || binaryExpressionMayBeOpenTag ( contextToken . parent ) ) ;
2260
2259
case "/" :
2261
2260
return isStringLiteralLike ( contextToken )
2262
2261
? ! ! tryGetImportFromModuleSpecifier ( contextToken )
@@ -2266,6 +2265,10 @@ namespace ts.Completions {
2266
2265
}
2267
2266
}
2268
2267
2268
+ function binaryExpressionMayBeOpenTag ( { left } : BinaryExpression ) : boolean {
2269
+ return nodeIsMissing ( left ) ;
2270
+ }
2271
+
2269
2272
function isStringLiteralOrTemplate ( node : Node ) : node is StringLiteralLike | TemplateExpression | TaggedTemplateExpression {
2270
2273
switch ( node . kind ) {
2271
2274
case SyntaxKind . StringLiteral :
Original file line number Diff line number Diff line change 13
13
////whatever
14
14
15
15
// @Filename : /a.tsx
16
- ////declare namespace JSX {
17
- //// interface Element {}
18
- //// interface IntrinsicElements {
19
- //// div: {};
16
+ ////declare global {
17
+ //// namespace JSX {
18
+ //// interface Element {}
19
+ //// interface IntrinsicElements {
20
+ //// div: {};
21
+ //// }
20
22
//// }
21
23
//// }
22
24
////const ctr = </*openTag*/;
You can’t perform that action at this time.
0 commit comments