Skip to content

Commit

Permalink
fix:vscode bugs (#74)
Browse files Browse the repository at this point in the history
* fix:minor vscode fix bugs

Signed-off-by: Aditya-eddy <[email protected]>

* fix:changelog updated and package bump

Signed-off-by: Aditya-eddy <[email protected]>

---------

Signed-off-by: Aditya-eddy <[email protected]>
  • Loading branch information
Aditya-eddy authored Oct 7, 2024
1 parent 67d0c68 commit fb403eb
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 23 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,10 @@ First Release for Vs Code Extension.
## [1.0.15]

- Reverting to universal release

## [1.0.16]
- Enhanced UI for updating the config file.
- Added support for a chatbot to provide additional prompts.
- Improved Keploy binary update experience.
- Enhanced signup/sign-in experience for users.
- Added support for new imports and installations of new libraries.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "keployio",
"displayName": "Keploy",
"description": "Streamline testing with the power of Keploy, directly in your favorite IDE.",
"version": "1.0.15",
"version": "1.0.16",
"publisher": "Keploy",
"icon": "media/logo.png",
"pricing": "Free",
Expand Down
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 fb403eb

Please sign in to comment.