Skip to content

Commit bfb603d

Browse files
committed
Fix plural bug
1 parent 491b5ca commit bfb603d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/chat/context.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,13 @@ export async function findPossibleTables(stream: vscode.ChatResponseStream, sche
6565
// parse all SCHEMA.TABLE references first
6666
tables = await parsePromptForRefs(stream, words.filter(word => word.includes('.')));
6767

68+
const justWords = words.map(word => word.replace(/[.,\/#!?$%\^&\*;:{}=\-_`~()]/g, ""));
69+
70+
// Remove plurals from words
71+
justWords.push(...justWords.filter(word => word.endsWith('s')).map(word => word.slice(0, -1)));
72+
6873
// filter prompt for possible refs to tables
69-
const validWords = words.map(word => word.replace(/[.,\/#!?$%\^&\*;:{}=\-_`~()]/g, ""))
74+
const validWords = justWords
7075
.filter(word => word.length > 2 && !word.endsWith('s') && !word.includes(`'`))
7176
.map(word => `'${Statement.delimName(word, true)}'`);
7277

0 commit comments

Comments
 (0)