Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 4344319

Browse files
committed
fix(plugins/plugin-bash-like): tab completion sometimes adds double trailing slashes
Fixes #6973
1 parent 765f9a0 commit 4344319

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

plugins/plugin-bash-like/fs/src/lib/tab-completion.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,17 @@ function findMatchingFilesFrom(files: GlobStats[], dirToScan: string, last: stri
5252
return {
5353
mode: 'raw',
5454
content: matches.map(matchStats => {
55-
const match = matchStats.name
55+
const match = matchStats.nameForDisplay
5656
const completion = lastIsDir ? match : match.substring(partial.length)
5757

5858
// show a special label only if we have a dirname prefix
5959
const label = lastHasPath ? basename(matchStats.nameForDisplay) : undefined
6060

6161
if (matchStats.dirent.isDirectory) {
62-
return { completion: `${completion}/`, label: label ? `${label}/` : undefined }
62+
return {
63+
completion: !/\/$/.test(completion) ? `${completion}/` : completion,
64+
label: label ? (!/\/$/.test(label) ? `${label}/` : label) : undefined
65+
}
6366
} else {
6467
return { completion, addSpace: true, label }
6568
}

0 commit comments

Comments
 (0)