File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -42,11 +42,13 @@ async function unusedImportsActiveFile(editor) {
4242 const solhintRuleString = "solhint-disable no-unused-import"
4343 if ( text . includes ( solhintRuleString ) ) return ;
4444
45- const importRegex = / i m p o r t \s + ( (?: \{ .+ ?\} \s + f r o m \s + ) ? (?: \" .* ?\" | ' .* ?' ) ) ; / g;
45+ const importRegex = / (?< ! \/ \/ \/ ? ) . * i m p o r t \s + ( (?: \{ .+ ?\} \s + f r o m \s + ) ? (?: \" .* ?\" | ' .* ?' ) ) ; / g;
4646 const importStatements = text . match ( importRegex ) || [ ] ;
4747 const unusedImportDecorations = [ ] ;
48-
4948 for ( const importStatement of importStatements ) {
49+ // skip commented out import statements
50+ if ( importStatement . startsWith ( "//" ) || importStatement . startsWith ( "/*" ) ) return ;
51+
5052 const imports = extractImports ( importStatement ) ;
5153 for ( const item of imports ) {
5254 const regex = new RegExp ( `\\b${ item } \\b` , 'g' ) ;
You can’t perform that action at this time.
0 commit comments