From e718896c6583becc83fb69df04d8b3f2e99708d8 Mon Sep 17 00:00:00 2001 From: Megan Rogge Date: Mon, 18 Nov 2024 10:57:22 -0500 Subject: [PATCH] modify regex --- extensions/terminal-suggest/src/terminalSuggestMain.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/terminal-suggest/src/terminalSuggestMain.ts b/extensions/terminal-suggest/src/terminalSuggestMain.ts index b9d6aee997b..7025c64b827 100644 --- a/extensions/terminal-suggest/src/terminalSuggestMain.ts +++ b/extensions/terminal-suggest/src/terminalSuggestMain.ts @@ -214,8 +214,8 @@ function getPrefix(commandLine: string, cursorPosition: number): string { // Extract the part of the line up to the cursor position const beforeCursor = commandLine.slice(0, cursorPosition); - // Find the last word boundary before the cursor - const match = beforeCursor.match(/[\w-]+$/); + // Find the last sequence of non-whitespace characters before the cursor + const match = beforeCursor.match(/(\S+)\s*$/); // Return the match if found, otherwise undefined return match ? match[0] : '';