Skip to content

Commit

Permalink
fix(vscode): compute source offsets correctly (#1963)
Browse files Browse the repository at this point in the history
  • Loading branch information
KazariEX authored Dec 1, 2024
1 parent cabb6c3 commit 7eb29a1
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/vscode/language-server/languagePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ function* getEmbeddedCodes(parsed: SlidevMarkdown): Generator<VirtualCode> {
const lines = parsed.raw.split('\n')
function lineToPos(line: number) {
let pos = 0
for (let i = 0; i <= line; i++) {
if (!lines[i])
break
for (let i = 0; i <= line && i < lines.length; i++) {
pos += lines[i].length + 1
}
return pos
Expand Down

0 comments on commit 7eb29a1

Please sign in to comment.