Skip to content

Commit

Permalink
fix:minor vscode fix bugs
Browse files Browse the repository at this point in the history
Signed-off-by: Aditya-eddy <aditya282003@gmail.com>
  • Loading branch information
Aditya-eddy committed Oct 7, 2024
1 parent c90dc08 commit db3670b
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 22 deletions.
16 changes: 5 additions & 11 deletions src/SidebarProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class SidebarProvider implements vscode.WebviewViewProvider {
const apiResponse = this._context.globalState.get<string>('apiResponse') || "No response";
const signedIn = this._context.globalState.get<string>('SignedOthers') || "false";
const progressBarVisible = this._context.globalState.get<boolean>('progressVisible') ?? true;


console.log("signedIn others value", signedIn);

Expand Down Expand Up @@ -421,19 +421,13 @@ export class SidebarProvider implements vscode.WebviewViewProvider {
case "keployGenWithAdditionalPrompts":{
try{
const additional_prompts = data.prompt;
const editor = vscode.window.activeTextEditor;
if (!editor) {
vscode.window.showErrorMessage("No file is currently open.");
return;
}

const fileUri = editor.document.uri;
console.log("additional prompts and uri: ", additional_prompts , fileUri);
await vscode.commands.executeCommand('keploy.utg' , fileUri , additional_prompts );
// const editor = vscode.window.activeTextEditor;

console.log("additional prompts and uri: ", additional_prompts );
await vscode.commands.executeCommand('keploy.runAdditionalPrompts',additional_prompts);
}catch(error){
console.error("Error executing keploy.utg command:", error);
}
break;
}
case "progressStatus":{
if(progressBarVisible == true && data.value == "false"){

Check warning on line 433 in src/SidebarProvider.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Expected '===' and instead saw '=='

Check warning on line 433 in src/SidebarProvider.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Expected '===' and instead saw '=='

Check warning on line 433 in src/SidebarProvider.ts

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Expected '===' and instead saw '=='

Check warning on line 433 in src/SidebarProvider.ts

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Expected '===' and instead saw '=='

Check warning on line 433 in src/SidebarProvider.ts

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Expected '===' and instead saw '=='

Check warning on line 433 in src/SidebarProvider.ts

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Expected '===' and instead saw '=='
Expand Down
2 changes: 2 additions & 0 deletions src/Utg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ async function Utg(context: vscode.ExtensionContext , additional_prompts?:string
vscode.window.showErrorMessage(`Unsupported file type: ${extension}`);
return;
}

console.log("additional_prompts" , additional_prompts);
if(!additional_prompts){
additional_prompts = "";
}
Expand Down
33 changes: 23 additions & 10 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class KeployCodeLensProvider implements vscode.CodeLensProvider {
codeLenses.push(new vscode.CodeLens(range, {
title: '🐰 Additional Prompts',
command: 'keploy.showSidebar',
arguments: [document.uri.fsPath]
arguments: [document.uri.fsPath,functionName,fileExtension]
}));
console.log('🐰 Found arrow function:', node.firstChild?.text);
} else if (fileName.endsWith('.js') || fileName.endsWith('.ts')) {
Expand All @@ -175,7 +175,7 @@ class KeployCodeLensProvider implements vscode.CodeLensProvider {
codeLenses.push(new vscode.CodeLens(range, {
title: '🐰 Additional Prompts',
command: 'keploy.showSidebar',
arguments: [document.uri.fsPath]
arguments: [document.uri.fsPath,functionName,fileExtension]
}));
console.log('🐰 Found arrow function:', node.firstChild?.text);
}
Expand All @@ -193,7 +193,7 @@ class KeployCodeLensProvider implements vscode.CodeLensProvider {
codeLenses.push(new vscode.CodeLens(range, {
title: '🐰 Additional Prompts',
command: 'keploy.showSidebar',
arguments: [document.uri.fsPath]
arguments: [document.uri.fsPath,functionName,fileExtension]
}));
} else if (fileName.endsWith('.java') && (node.type === 'method_declaration' || node.type === 'constructor_declaration')) {
const line = document.positionAt(node.startIndex).line;
Expand All @@ -209,7 +209,7 @@ class KeployCodeLensProvider implements vscode.CodeLensProvider {
codeLenses.push(new vscode.CodeLens(range, {
title: '🐰 Additional Prompts',
command: 'keploy.showSidebar',
arguments: [document.uri.fsPath]
arguments: [document.uri.fsPath,functionName,fileExtension]
}));
} else if (fileName.endsWith('.go') && (node.type === 'function_declaration' || node.type === 'method_declaration')) {
const line = document.positionAt(node.startIndex).line;
Expand All @@ -226,7 +226,7 @@ class KeployCodeLensProvider implements vscode.CodeLensProvider {
codeLenses.push(new vscode.CodeLens(range, {
title: '🐰 Additional Prompts',
command: 'keploy.showSidebar',
arguments: [document.uri.fsPath]
arguments: [document.uri.fsPath,functionName,fileExtension]
}));
}

Expand Down Expand Up @@ -458,7 +458,9 @@ export function activate(context: vscode.ExtensionContext) {
// vscode.commands.executeCommand('setContext', 'keploy.signedIn', true);
// sidebarProvider.postMessage('navigateToHome', 'KeployHome');
// }

let functionName="";
let ExtentionName="";
let FunctionFilePath = "";
let accessToken = context.globalState.get<string>('JwtToken');

// Check if the access token is already present in the global state
Expand Down Expand Up @@ -513,7 +515,7 @@ export function activate(context: vscode.ExtensionContext) {
vscode.window.showInformationMessage('Failed to sign in Keploy!');
}
});

context.subscriptions.push(signInCommand);

}
let signInWithOthersCommand = vscode.commands.registerCommand('keploy.SignInWithOthers', async () => {
Expand Down Expand Up @@ -620,15 +622,23 @@ export function activate(context: vscode.ExtensionContext) {

context.subscriptions.push(updateKeployDisposable);

let showSidebarDisposable = vscode.commands.registerCommand('keploy.showSidebar', async () => {
let showSidebarDisposable = vscode.commands.registerCommand('keploy.showSidebar', async (filePath:string,FunctionName:string,FileExtentionName:string) => {
// Show the sidebar when this command is executed
functionName=FunctionName;
ExtentionName=FileExtentionName;
FunctionFilePath = filePath;
vscode.commands.executeCommand('workbench.view.extension.Keploy-Sidebar');
sidebarProvider.postMessage("KeployChatBot")

Check warning on line 631 in src/extension.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Missing semicolon

Check warning on line 631 in src/extension.ts

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Missing semicolon

Check warning on line 631 in src/extension.ts

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Missing semicolon
vscode.window.showInformationMessage('Sidebar opened for additional prompts.');
});

context.subscriptions.push(showSidebarDisposable);

let runAdditionalPrompts = vscode.commands.registerCommand('keploy.runAdditionalPrompts',async(additionalPrompts:string)=>{
console.log("value inside the function: ",functionName,ExtentionName,additionalPrompts);
await vscode.commands.executeCommand('keploy.utg' , FunctionFilePath,functionName, ExtentionName , additionalPrompts);
})

Check warning on line 639 in src/extension.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Missing semicolon

Check warning on line 639 in src/extension.ts

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Missing semicolon

Check warning on line 639 in src/extension.ts

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Missing semicolon

context.subscriptions.push(runAdditionalPrompts);

// Register the command
let disposable = vscode.commands.registerCommand('keploy.utg', async (filePath: string, functionName: string, fileExtension: string, additional_prompts?: string) => {
Expand Down Expand Up @@ -673,13 +683,16 @@ export function activate(context: vscode.ExtensionContext) {
if (updatedSubscriptionEnded === false) {

// If SubscriptionEnded is false or undefined, continue running Utg
if(additional_prompts){
console.log("additional_prompts are present: ",additional_prompts);
}
const testFilesPath = await findTestCasesForFunction(functionName, fileExtension); // Call the function here
if (testFilesPath) {
console.log("testFiles path: ", testFilesPath);
} else {
console.log("no path found")

Check warning on line 693 in src/extension.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Missing semicolon

Check warning on line 693 in src/extension.ts

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Missing semicolon

Check warning on line 693 in src/extension.ts

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Missing semicolon
}

console.log("additional prompts inside the keploy.utg " , additional_prompts);
vscode.window.showInformationMessage('Welcome to Keploy!');
await Utg(context, additional_prompts, testFilesPath);
}
Expand Down
8 changes: 7 additions & 1 deletion webviews/components/KeployChat.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script>
const vscode = acquireVsCodeApi();
let aiQuestion = ""; // This will hold the user input for the AI question.
// Define functions or handlers for the buttons
function generateReport() {
vscode.postMessage({
Expand Down Expand Up @@ -231,6 +231,12 @@
color: #c2c2c2;
}
/* Add this new CSS */
.chat-input-container:hover,
.chat-input-container:focus-within {
background-color: #0f0f0f; /* A slightly darker shade */
}
.chat-submit {
background-color: transparent;
border: none;
Expand Down

0 comments on commit db3670b

Please sign in to comment.