Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7c1cff9

Browse files
committed
Update version and fix some bugs
1 parent 1930ee0 commit 7c1cff9

File tree

3 files changed

+14
-21
lines changed

3 files changed

+14
-21
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: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,16 @@ export class CustomCodeLensProvider implements vscode.CodeLensProvider {
2222
return;
2323
}
2424

25-
const fileName: string = document.fileName.trim();
26-
const workspaceFolder: string = vscode.workspace.getConfiguration("leetcode").get("workspaceFolder", "");
27-
28-
if (fileName.indexOf(workspaceFolder) === -1) {
29-
return undefined;
30-
}
31-
3225
const content: string = document.getText();
3326
const matchResult: RegExpMatchArray | null = content.match(/@lc app=.* id=.* lang=.*/);
3427
if (!matchResult) {
3528
return undefined;
3629
}
3730

38-
let codeLensLine: number = content.length - 1;
39-
40-
for (let i: number = 0; i < content.length; ++i) {
41-
if (content[i].indexOf("@lc code=end") >= 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) {
4235
codeLensLine = i;
4336
break;
4437
}

0 commit comments

Comments
 (0)