Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Adding trailing slash for directory when tab completion. #259

Closed
segln opened this issue Mar 2, 2024 · 1 comment · Fixed by #282
Closed

Feature request: Adding trailing slash for directory when tab completion. #259

segln opened this issue Mar 2, 2024 · 1 comment · Fixed by #282

Comments

@segln
Copy link

segln commented Mar 2, 2024

Please add a trailing slash option for directory when tab completion.

Example

cd C:\Us_

Pressing <Tab>:

Current

cd C:\Users

Trailing slash

cd C:\Users\

Thank you for your consideration.

@segln
Copy link
Author

segln commented Mar 2, 2024

I think it can be done with removing the conditional statement below, but maybe there have been a reason for its existence...

if ($script:continueCompletion) {
$isQuoted = $str.EndsWith("'")
$resultTrimmed = $str.Trim(@('''', '"'))
if (Test-Path "$resultTrimmed" -PathType Container) {
if ($isQuoted) {
$str = "'{0}{1}'" -f "$resultTrimmed", $script:TabContinuousTrigger
}
else {
$str = "$resultTrimmed" + $script:TabContinuousTrigger
}
}
else {
# no more paths to complete, so let's stop completion:
$str += ' '
$script:continueCompletion = $false
}
}

#if ($script:continueCompletion) {
    $isQuoted = $str.EndsWith("'")
    $resultTrimmed = $str.Trim(@('''', '"'))
    if (Test-Path "$resultTrimmed"  -PathType Container) {
        if ($isQuoted) {
            $str = "'{0}{1}'" -f "$resultTrimmed", $script:TabContinuousTrigger
        }
        else {
            $str = "$resultTrimmed" + $script:TabContinuousTrigger
        }
    }
    else {
        # no more paths to complete, so let's stop completion:
        $str += ' '
        $script:continueCompletion = $false
    }
#}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant