Skip to content

Commit

Permalink
fix: transform range of file-md correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
KazariEX committed Aug 28, 2024
1 parent 13924d1 commit 3f072e7
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/language-core/lib/plugins/file-md.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,17 @@ const plugin: VueLanguagePlugin = ({ vueCompilerOptions }) => {
return sfc;

function transformRange(block: SFCBlock) {
block.loc.start.offset = -1;
block.loc.end.offset = -1;
for (const [start] of file2VueSourceMap.toSourceLocation(block.loc.start.offset)) {
block.loc.start.offset = start;
const { start, end } = block.loc;
const startOffset = start.offset;
const endOffset = end.offset;
start.offset = -1;
end.offset = -1;
for (const [offset] of file2VueSourceMap.toSourceLocation(startOffset)) {
start.offset = offset;
break;
}
for (const [end] of file2VueSourceMap.toSourceLocation(block.loc.end.offset)) {
block.loc.end.offset = end;
for (const [offset] of file2VueSourceMap.toSourceLocation(endOffset)) {
end.offset = offset;
break;
}
}
Expand Down

0 comments on commit 3f072e7

Please sign in to comment.