From cde35bb79bab64bf4912a7edeb4dac07db2f5404 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 31 Jul 2024 11:53:52 -0700 Subject: [PATCH] Also exclude $ from comletions from start logic --- .../contrib/terminal/browser/media/shellIntegration.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1 b/src/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1 index c13f59df91e..eb8b798dd9a 100644 --- a/src/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1 +++ b/src/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1 @@ -232,11 +232,12 @@ function Send-Completions { # Adjust the completion prefix and cursor index such that tab expansion will be requested # immediately after the last whitespace. This allows the client to perform fuzzy filtering # such that requesting completions in the middle of a word should show the same completions - # as at the start. This only happens when the last word does not include `/` and `\` as - # often it will significantly change completions like when navigating directories. + # as at the start. This only happens when the last word does not include special characters: + # - `/` and `\`: Completions change when navigating directories. + # - `$`: Completions change when variables. $lastWhitespaceIndex = $completionPrefix.LastIndexOf(' ') $lastWord = $completionPrefix.Substring($lastWhitespaceIndex + 1) - if ($lastWord.Contains('/') -eq $false -and $lastWord.Contains('\\') -eq $false) { + if ($lastWord -notmatch '[/\\$]') { if ($lastWhitespaceIndex -ne -1 -and $lastWhitespaceIndex -lt $cursorIndex) { $newCursorIndex = $lastWhitespaceIndex + 1 $completionPrefix = $completionPrefix.Substring(0, $newCursorIndex)