Skip to content

Commit cbe6968

Browse files
authored
Merge pull request #14 from PraneshASP/fix/regex
🔨 Fix: Update regex
2 parents 7266085 + 0445f70 commit cbe6968

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-solidity-inspector",
33
"displayName": "Solidity Inspector",
44
"description": "A vscode extension used to inspect Solidity files",
5-
"version": "1.0.0",
5+
"version": "1.0.1",
66
"engines": {
77
"vscode": "^1.72.0"
88
},

src/commands/highlight-unused-imports.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,9 @@ async function unusedImportsActiveFile(editor) {
4242
for (const importStatement of imports) {
4343
const imports = extractImports(importStatement);
4444
for (const item of imports) {
45-
const filePath = item;
4645
const regex = new RegExp(item, 'g');
4746
const itemOccurancesInImportStatement = (importStatement.replace(/\.sol\b/g, '').match(regex) || []).length;
48-
const totalOccurrencesOfItem = (text.match(new RegExp(filePath, 'g')) || []).length;
47+
const totalOccurrencesOfItem = (text.match(new RegExp(`\\b${item}\\b`, 'gi')) || []).length;
4948
if (totalOccurrencesOfItem == itemOccurancesInImportStatement) {
5049
const lineIndex = editor.document.getText().split('\n').findIndex(line => line.includes(importStatement));
5150
const range = new vscode.Range(editor.document.lineAt(lineIndex).range.start, editor.document.lineAt(lineIndex).range.end);

0 commit comments

Comments
 (0)