Skip to content

Commit ac2eb62

Browse files
authored
fix: avoid duplicate url with forward slash in the end (#592)
* fix: avoid duplicate url with forward slash in the end * fix: fix the tests
1 parent 056b635 commit ac2eb62

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

runtimes/runtimes/lsp/router/lspRouter.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,7 @@ describe('LspRouter', () => {
690690
added: [
691691
{ name: 'new', uri: 'file:///new' },
692692
{ name: 'duplicate', uri: 'file:///existing' }, // duplicate URI
693+
{ name: 'duplicate', uri: 'file:///existing/' }, // duplicate URI with /
693694
],
694695
removed: [],
695696
}

runtimes/runtimes/lsp/router/lspRouter.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,12 @@ ${JSON.stringify({ ...result.capabilities, ...result.awsServerCapabilities })}`
145145
folder => !event.removed.some(removed => removed.uri === folder.uri)
146146
)
147147
this.workspaceFolders.push(
148-
...event.added.filter(added => !this.workspaceFolders.some(existing => existing.uri === added.uri))
148+
...event.added.filter(
149+
added =>
150+
!this.workspaceFolders.some(
151+
existing => existing.uri.replace(/\/$/, '') === added.uri.replace(/\/$/, '')
152+
)
153+
)
149154
)
150155
const params: DidChangeWorkspaceFoldersParams = { event }
151156

0 commit comments

Comments
 (0)