Skip to content

Commit

Permalink
parser
Browse files Browse the repository at this point in the history
  • Loading branch information
so1ve committed Mar 15, 2024
1 parent 1a61a59 commit 9807cc3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/language-core/lib/parsers/scriptRanges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export function parseScriptRanges(ts: typeof import('typescript'), ast: ts.Sourc
componentsOption: TextRange | undefined,
componentsOptionNode: ts.ObjectLiteralExpression | undefined,
nameOption: TextRange | undefined,
inheritAttrsOption: string | undefined,
}) | undefined;

const bindings = hasScriptSetup ? parseBindingRanges(ts, ast) : [];
Expand All @@ -39,6 +40,7 @@ export function parseScriptRanges(ts: typeof import('typescript'), ast: ts.Sourc
if (obj) {
let componentsOptionNode: ts.ObjectLiteralExpression | undefined;
let nameOptionNode: ts.Expression | undefined;
let inheritAttrsOption: string | undefined;
ts.forEachChild(obj, node => {
if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name)) {
const name = getNodeText(ts, node.name, ast);
Expand All @@ -48,6 +50,9 @@ export function parseScriptRanges(ts: typeof import('typescript'), ast: ts.Sourc
if (name === 'name') {
nameOptionNode = node.initializer;
}
if (name === 'inheritAttrs') {
inheritAttrsOption = getNodeText(ts, node.initializer, ast);
}
}
});
exportDefault = {
Expand All @@ -58,6 +63,7 @@ export function parseScriptRanges(ts: typeof import('typescript'), ast: ts.Sourc
componentsOption: componentsOptionNode ? _getStartEnd(componentsOptionNode) : undefined,
componentsOptionNode: withNode ? componentsOptionNode : undefined,
nameOption: nameOptionNode ? _getStartEnd(nameOptionNode) : undefined,
inheritAttrsOption,
};
}
}
Expand Down

0 comments on commit 9807cc3

Please sign in to comment.