Skip to content

Commit b7ededc

Browse files
magic-akarijdneo
authored andcommitted
fix: CodeLens position (LeetCode-OpenSource#426)
1 parent ef4bcbd commit b7ededc

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,6 @@
683683
"markdown-it": "^8.4.2",
684684
"require-from-string": "^2.0.2",
685685
"unescape-js": "^1.1.1",
686-
"vsc-leetcode-cli": "2.6.10"
686+
"vsc-leetcode-cli": "2.6.11"
687687
}
688688
}

src/codelens/CustomCodeLensProvider.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,16 @@ export class CustomCodeLensProvider implements vscode.CodeLensProvider {
2828
return undefined;
2929
}
3030

31-
const range: vscode.Range = new vscode.Range(document.lineCount - 1, 0, document.lineCount - 1, 0);
31+
let codeLensLine: number = document.lineCount - 1;
32+
for (let i: number = document.lineCount - 1; i >= 0; i--) {
33+
const lineContent: string = document.lineAt(i).text;
34+
if (lineContent.indexOf("@lc code=end") >= 0) {
35+
codeLensLine = i;
36+
break;
37+
}
38+
}
39+
40+
const range: vscode.Range = new vscode.Range(codeLensLine, 0, codeLensLine, 0);
3241
const codeLens: vscode.CodeLens[] = [];
3342

3443
if (shortcuts.indexOf("submit") >= 0) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy