Skip to content

Commit

Permalink
fix(vscode): more robustly handle VSCode document URI (#1376)
Browse files Browse the repository at this point in the history
  • Loading branch information
ymc9 authored Apr 25, 2024
1 parent da0bbd1 commit 5cc8f18
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/schema/src/utils/ast-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,19 @@ function resolveTransitiveImportsInternal(
documents: LangiumDocuments,
model: Model,
initialModel = model,
visited: Set<URI> = new Set(),
visited: Set<string> = new Set(),
models: Set<Model> = new Set()
): Model[] {
const doc = getDocument(model);
if (initialModel !== model) {
const initialDoc = getDocument(initialModel);

if (initialDoc.uri.fsPath.toLowerCase() !== doc.uri.fsPath.toLowerCase()) {
models.add(model);
}
if (!visited.has(doc.uri)) {
visited.add(doc.uri);

const normalizedPath = doc.uri.fsPath.toLowerCase();
if (!visited.has(normalizedPath)) {
visited.add(normalizedPath);
for (const imp of model.imports) {
const importedModel = resolveImport(documents, imp);
if (importedModel) {
Expand Down

0 comments on commit 5cc8f18

Please sign in to comment.