Skip to content

Commit 0f38c43

Browse files
Add improved regex
1 parent 3a4bd7d commit 0f38c43

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

extensions/ql-vscode/src/CodeLensProvider.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ class MyCodeLensProvider implements CodeLensProvider {
1515

1616
for (let index = 0; index < document.lineCount; index++) {
1717
const textLine = document.lineAt(index);
18-
if (textLine.text.includes('predicate')) {
18+
const regex = new RegExp(/\w+\(\s*.*(?:,\s*\S+)*\s*\)/g);
19+
if (textLine.text.match(regex)) {
1920
const uri = document.uri;
20-
const regex = new RegExp(/predicate/);
2121
const startIndex = textLine.text.search(regex);
2222
const range: Range = new Range(
23-
textLine.range.start.line, startIndex + 10,
24-
textLine.range.end.line, startIndex + 11
23+
textLine.range.start.line, startIndex,
24+
textLine.range.end.line, startIndex + 1
2525
);
2626

2727
const command: Command = {

0 commit comments

Comments
 (0)