Skip to content

Commit

Permalink
Avoid registering the same scheme multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
urbanfly committed Dec 13, 2024
1 parent 6725358 commit 6e26f07
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions rascal-vscode-extension/src/fs/VSCodeURIResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ export class VSCodeUriResolverServer implements Disposable {
toIgnore.forEach(v => this.rascalNativeSchemes.add(v));
}

getIgnoredSchemes(): string[] {
return Array.from(this.rascalNativeSchemes.values());
}

dispose() {
this.server.close();
this.activeClients.forEach(c => c.dispose());
Expand Down
8 changes: 6 additions & 2 deletions rascal-vscode-extension/src/lsp/RascalLSPConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,12 @@ export async function activateLanguageClient(
const schemesReply = client.sendRequest<string[]>("rascal/filesystem/schemes");

schemesReply.then( schemes => {
vfsServer.ignoreSchemes(schemes);
new RascalFileSystemProvider(client).registerSchemes(schemes);
// avoid registering the same schemes multiple times
const knownRascalNativeSchemes = vfsServer.getIgnoredSchemes();
const remainingSchemes = schemes.filter(s => !knownRascalNativeSchemes.includes(s));
if (remainingSchemes.length) {
new RascalFileSystemProvider(client).registerSchemes(schemes);
}
});


Expand Down

0 comments on commit 6e26f07

Please sign in to comment.