Skip to content

Commit 779df47

Browse files
committed
ignore unused name warnings within prepends
1 parent 51f3146 commit 779df47

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

server/src/ast.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,11 @@ export class AST {
7979
val[0](val[1]);
8080
})
8181

82+
8283
this.declarations.forEach(declarationList => {
8384
for (let i = 0; i < declarationList.length; i++) {
8485
const declaration = declarationList[i];
85-
if (declaration.unused && declaration.name !== "✖")
86+
if (declaration.unused && declaration.name !== "✖" && declaration.range.start.line >= this.prependLines)
8687
this.addDiagnostic("Unused name", DiagnosticSeverity.Warning, rangeToSourceLoc(declaration.selectionRange), [DiagnosticTag.Unnecessary]);
8788
}
8889
})

test_files/imports.source

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
import { black as b } from "rune";
22

3-
b();
3+
4+
5+
6+
7+
8+
const x = 1;

0 commit comments

Comments
 (0)