Closed zhiyuanzmj closed 4 months ago
In 2.0 you need to replace Node.getStart
, Node.forEachChild
with the following.
node.forEachChild(cb)
-> ts.forEachChild(node, cb)
node.getStart(sourceFile)
-> (ts as any).getTokenPosOfNode(node, sourceFile)
\
Or -> require('@vue/language-core').getStartEnd(ts, node, sourceFile).start
I found some another issues when I upgraded @vue-macros/volar
to volar2.0.
ts.isJsxExpression
-> node.kind === 294
node.expression.text
-> node.expression.escapedText
node.getText(sourceFile)
->
sfc.scriptSetup.content.slice(
(ts as any).getTokenPosOfNode(node, sfc.scriptSetup.ast),
node.end
)
When I use vue-tsc to check type, The
sfc.scriptSetup.ast
has nogetStart
&forEachChild
method. But it works fine in vue's vscode plugin.