@@ -4,8 +4,9 @@ import {asLspRange} from "@server/utils/position"
4
4
import { RecursiveVisitor } from "@server/psi/RecursiveVisitor"
5
5
import { Reference } from "@server/psi/Reference"
6
6
import { NamedNode } from "@server/psi/Node"
7
- import { Contract , Primitive } from "@server/psi/Decls"
7
+ import { Contract , Field , Primitive } from "@server/psi/Decls"
8
8
import { Inspection , InspectionIds } from "./Inspection"
9
+ import { index } from "@server/indexes"
9
10
10
11
export class NotImportedSymbolInspection implements Inspection {
11
12
public readonly id : "not-imported-symbol" = InspectionIds . NOT_IMPORTED_SYMBOL
@@ -18,7 +19,13 @@ export class NotImportedSymbolInspection implements Inspection {
18
19
if ( node . type !== "identifier" && node . type !== "type_identifier" ) return
19
20
const resolved = Reference . resolve ( new NamedNode ( node , file ) )
20
21
if ( ! resolved ) return
21
- if ( resolved instanceof Primitive || resolved instanceof Contract ) return
22
+ if (
23
+ resolved instanceof Primitive ||
24
+ resolved instanceof Contract ||
25
+ resolved instanceof Field
26
+ ) {
27
+ return
28
+ }
22
29
23
30
// don't need to import same file
24
31
if ( resolved . file . uri === file . uri ) return
@@ -28,6 +35,8 @@ export class NotImportedSymbolInspection implements Inspection {
28
35
if ( file . alreadyImport ( importPath ) ) return
29
36
// some files like stubs or stdlib imported implicitly
30
37
if ( resolved . file . isImportedImplicitly ( ) ) return
38
+ // guard for multi projects
39
+ if ( index . hasSeveralDeclarations ( resolved . name ( ) ) ) return
31
40
32
41
diagnostics . push ( {
33
42
severity : lsp . DiagnosticSeverity . Error ,
0 commit comments