MCPcopy Create free account
hub / github.com/nodejs/node / isInsideJsxElement

Function isInsideJsxElement

test/fixtures/snapshot/typescript.js:127712–127737  ·  view source on GitHub ↗
(sourceFile, position)

Source from the content-addressed store, hash-verified

127710 }
127711 ts.isInJSXText = isInJSXText;
127712 function isInsideJsxElement(sourceFile, position) {
127713 function isInsideJsxElementTraversal(node) {
127714 while (node) {
127715 if (node.kind >= 279 /* SyntaxKind.JsxSelfClosingElement */ && node.kind <= 288 /* SyntaxKind.JsxExpression */
127716 || node.kind === 11 /* SyntaxKind.JsxText */
127717 || node.kind === 29 /* SyntaxKind.LessThanToken */
127718 || node.kind === 31 /* SyntaxKind.GreaterThanToken */
127719 || node.kind === 79 /* SyntaxKind.Identifier */
127720 || node.kind === 19 /* SyntaxKind.CloseBraceToken */
127721 || node.kind === 18 /* SyntaxKind.OpenBraceToken */
127722 || node.kind === 43 /* SyntaxKind.SlashToken */) {
127723 node = node.parent;
127724 }
127725 else if (node.kind === 278 /* SyntaxKind.JsxElement */) {
127726 if (position > node.getStart(sourceFile))
127727 return true;
127728 node = node.parent;
127729 }
127730 else {
127731 return false;
127732 }
127733 }
127734 return false;
127735 }
127736 return isInsideJsxElementTraversal(getTokenAtPosition(sourceFile, position));
127737 }
127738 ts.isInsideJsxElement = isInsideJsxElement;
127739 function findPrecedingMatchingToken(token, matchingTokenKind, sourceFile) {
127740 var closeTokenText = ts.tokenToString(token.kind);

Callers

nothing calls this directly

Calls 2

getTokenAtPositionFunction · 0.85

Tested by

no test coverage detected