Skip to content

Commit 3edb329

Browse files
committed
Fixed bug causing implicit scopes to replicate
1 parent f46dd04 commit 3edb329

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

server/src/capabilities/capabilities.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,16 @@ export class ScopeItemCapability {
281281
public parent?: ScopeItemCapability,
282282
) { }
283283

284+
clean(): void {
285+
this.deleteInvalidatedScopes();
286+
this.cleanInvalidatedLinks();
287+
}
288+
284289
/**
285290
* Recursively build from this node down.
286291
*/
287292
build(): void {
288-
this.deleteInvalidatedScopes();
289-
this.cleanInvalidatedLinks();
293+
this.clean();
290294

291295
// Don't build self if invalidated.
292296
if (this.isInvalidated) {
@@ -800,7 +804,7 @@ export class ScopeItemCapability {
800804
}
801805

802806
// Add implicitly accessible names to the project scope.
803-
if (item.isPublicScope && this.project) {
807+
if (item.isPublicScope && this.project && this !== this.project) {
804808
this.project.implicitDeclarations ??= new Map();
805809
this.addItem(this.project.implicitDeclarations, item, item.name);
806810
}

server/src/project/document.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ export abstract class BaseProjectDocument {
167167
await (new SyntaxParser(Services.logger)).parse(token, this);
168168
const projectScope = this.currentScope.project;
169169
const buildScope = projectScope?.isDirty ? projectScope : this.currentScope;
170+
projectScope?.clean();
170171
buildScope.build();
171172
buildScope.resolveUnused();
172173

0 commit comments

Comments
 (0)