From a6d34bc98994462e7a2c42c85fbc6d072f11d7a5 Mon Sep 17 00:00:00 2001 From: Sheng Chen Date: Sat, 14 Sep 2019 15:16:11 +0800 Subject: [PATCH] fix: Detect leetcode file by the comments (#417) --- src/codelens/CustomCodeLensProvider.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/codelens/CustomCodeLensProvider.ts b/src/codelens/CustomCodeLensProvider.ts index f201dbd7..52deaf38 100644 --- a/src/codelens/CustomCodeLensProvider.ts +++ b/src/codelens/CustomCodeLensProvider.ts @@ -22,8 +22,8 @@ export class CustomCodeLensProvider implements vscode.CodeLensProvider { return; } - const fileName: string = document.fileName.trim(); - const matchResult: RegExpMatchArray | null = fileName.match(/\d+\..*\.(.+)/); + const content: string = document.getText(); + const matchResult: RegExpMatchArray | null = content.match(/@lc app=.* id=.* lang=.*/); if (!matchResult) { return undefined; }