From 104a27b215806735175c615ec9fc2726919c68b7 Mon Sep 17 00:00:00 2001 From: Adam Shedivy Date: Wed, 6 Nov 2024 15:00:18 -0600 Subject: [PATCH 1/2] ignore context item it its empty --- .../continue/continueContextProvider.ts | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/aiProviders/continue/continueContextProvider.ts b/src/aiProviders/continue/continueContextProvider.ts index e01b1793..2ef47251 100644 --- a/src/aiProviders/continue/continueContextProvider.ts +++ b/src/aiProviders/continue/continueContextProvider.ts @@ -146,18 +146,20 @@ export class db2ContextProvider implements IContextProvider { ); for (const table of Object.keys(tableRefs)) { const columnData: TableColumn[] = tableRefs[table]; - const tableSchema = - columnData.length > 0 ? columnData[0].TABLE_SCHEMA : null; - - // create context item - let prompt = `Db2 for i Table meta data for schema ${tableSchema} table ${table}\n`; - prompt += `Column Info: ${JSON.stringify(columnData)}\n\n`; - - contextItems.push({ - name: `${job.name}-${tableSchema}-${table}`, - description: `Schema and table information for ${table}`, - content: prompt, - }); + if (columnData && columnData.length > 0) { + const tableSchema = + columnData.length > 0 ? columnData[0].TABLE_SCHEMA : null; + + // create context item + let prompt = `Db2 for i Table meta data for schema ${tableSchema} table ${table}\n`; + prompt += `Column Info: ${JSON.stringify(columnData)}\n\n`; + + contextItems.push({ + name: `${job.name}-${tableSchema}-${table}`, + description: `Schema and table information for ${table}`, + content: prompt, + }); + } } return contextItems; From 88eba79dce9b7c674b088dd038c7752e1555a9c8 Mon Sep 17 00:00:00 2001 From: Adam Shedivy Date: Wed, 6 Nov 2024 15:27:03 -0600 Subject: [PATCH 2/2] remove info message --- src/aiProviders/continue/continueContextProvider.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/aiProviders/continue/continueContextProvider.ts b/src/aiProviders/continue/continueContextProvider.ts index 2ef47251..6f08f8a5 100644 --- a/src/aiProviders/continue/continueContextProvider.ts +++ b/src/aiProviders/continue/continueContextProvider.ts @@ -197,6 +197,5 @@ export async function registerContinueProvider() { const continueAPI = continueEx?.exports; continueAPI?.registerCustomContextProvider(provider); vscode.commands.executeCommand('setContext', 'vscode-db2i:continueExtensionActive', true); - vscode.window.showInformationMessage(`@Db2i context provider enabled in Continue!`); } }