modify regex

This commit is contained in:
Megan Rogge
2024-11-18 10:57:22 -05:00
parent 69bf92f0bc
commit e718896c65

View File

@@ -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] : '';