Skip to content

Commit 2ce8cbd

Browse files
authored
Merge pull request #53 from MetabobProject/docs/image-updates
docs/image updates
2 parents b88ca0e + 1305e04 commit 2ce8cbd

17 files changed

+24
-85
lines changed

README.md

+4-63
Original file line numberDiff line numberDiff line change
@@ -24,79 +24,20 @@ Metabob is an AI-based code review tool that utilizes a combination of Graph Neu
2424
# Settings​
2525

2626
* To disable Metabob anlaysis from running every time code is saved, go to the extension settings and deselect the checkbox under the text "Metabob: **Analyze Document On Save**"
27-
28-
![](docs/img/docs-analyze-on-save.png)
2927
3028
* To change the backend LLM model Metabob uses to generate problem descriptions and code recommendations, select your preferred model from the "Metabob: **Backend Selection**" drop down menu
31-
32-
![](docs/img/docs-backend-selection.png)
3329
3430
* If you prefer to use one of the openai models, you need to authenticate by inputting your openai API key into the text field under "Metabob: ChatGPT Token" text field on Metabob's extension settings
3531

36-
![](docs/img/docs-openai-token.png)
37-
3832
# Usage​
39-
40-
1. Request an analysis
41-
42-
Users can request Metabob to analyze the file they are currently working on by:
43-
* Using the "**ANALYZE**" -button on the Metabob extension side panel
44-
45-
![analyze-document-sidepanel](docs/img/v2-analyze-sidepanel.png)
46-
47-
48-
* Opening the command palette and using the command "**Metabob: Analyze Document**"
49-
50-
![analyze-document-commandpalette](docs/img/v2-analyzedocument-commandpalette.png)
51-
52-
53-
* Saving the file (requires "**Analyze Document On Save**" to be enabled on the extension settings
54-
55-
56-
Users can confirm that the Metabob Analysis is running by seeing a loading icon next to a text "Metabob: Analyzing Document" on the bottom left corner of the VS Code editor.
57-
58-
![analysis-running](docs/img/v2-analysis-running.png)
59-
60-
61-
Once the analysis has finished, users can see problematic areas highlighted in red on the file they are currently viewing and requested analysis for from Metabob.
62-
63-
![highlighted-problem](docs/img/v2-problem-highlight.png)
6433

34+
1. Analyze code
6535

66-
2. View problem details
36+
2. View detected problems
6737

68-
Users can view problem details by hovering over the red highlighted problem regions in their code and clicking "**More Details**"
38+
3. Generate fixes for detected problems
6939

70-
![more-details](docs/img/v2-view-more-details.png)
71-
72-
73-
3. Generate code recommendations to fix detected problems
74-
75-
Users can generate code recommendations to fix the detected problems by:
76-
* Hovering over the red highlighted problem regions in their and clicking "**Fix**"
77-
78-
![fix-problem](docs/img/v2-fix-and-details.png)
79-
80-
81-
* Clicking the "**GENERATE RECOMMENDATION**" -button on the Metabob extension side panel when viewing problem details
82-
83-
![generate-recommendation](docs/img/v2-generate-rec-sidepanel.png)
84-
85-
86-
If users think that the generated code recommendation is not correct, they can generate another recommendation by using the "**REGENERATE**" -button
87-
88-
![regenerate-recommendation](docs/img/v2-regenerate-rec.png)
89-
90-
91-
Users can view the different generated code recommendations they have asked to generate by using the arrows below the code generated code recommendation
92-
93-
![view-recommendations](docs/img/v2-recommendation-pagination.png)
94-
95-
96-
Users can apply the generated code recommendations to their code by clicking the "APPLY" -button
97-
98-
![apply-recommendation](docs/img/v2-apply-recommendation.png)
99-
40+
![analysis-flow](docs/img/v2-analysis-flow.gif)
10041

10142

10243
# Data Policy

docs/img/v2-analysis-flow.gif

1.63 MB
Loading

docs/img/v2-analysis-running.png

-2.17 KB
Binary file not shown.

docs/img/v2-analyze-sidepanel.png

-10.9 KB
Binary file not shown.
-16.2 KB
Binary file not shown.

docs/img/v2-apply-recommendation.png

-45.8 KB
Binary file not shown.

docs/img/v2-fix-and-details.png

-39.7 KB
Binary file not shown.
-22 KB
Binary file not shown.

docs/img/v2-problem-highlight.png

-22.8 KB
Binary file not shown.
-45.7 KB
Binary file not shown.

docs/img/v2-regenerate-rec.png

-45.9 KB
Binary file not shown.

docs/img/v2-view-more-details.png

-16.9 KB
Binary file not shown.

ext-src/extension.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ let expirationTimer: any = undefined;
2929

3030
export function activate(context: vscode.ExtensionContext): void {
3131
let previousEditor: vscode.TextEditor | undefined = undefined;
32-
const _debug = undefined; // vscode.window.createOutputChannel('Metabob');
32+
const _debug = vscode.window.createOutputChannel('Metabob');
3333
bootstrapExtensionEventEmitter();
3434

3535
initState(context);
@@ -349,7 +349,11 @@ export function activate(context: vscode.ExtensionContext): void {
349349
if (!e) {
350350
return;
351351
}
352-
const { fileName } = Util.extractMetaDataFromDocument(e.document);
352+
const { filePath, fileName } = Util.extractMetaDataFromDocument(e.document);
353+
354+
if (!filePath) {
355+
return;
356+
}
353357

354358
if (!fileName) {
355359
return;
@@ -371,7 +375,7 @@ export function activate(context: vscode.ExtensionContext): void {
371375
return;
372376
}
373377

374-
const results: Problem[] | undefined = Util.getCurrentEditorProblems(analyzeValue, fileName);
378+
const results: Problem[] | undefined = Util.getCurrentEditorProblems(analyzeValue, filePath);
375379
if (!results) {
376380
return;
377381
}

ext-src/helpers/HandleDocumentAnalyze.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ export const handleDocumentAnalyze = async (
3333
suppressRateLimitErrors = false,
3434
_debug?: vscode.OutputChannel,
3535
) => {
36-
const tomorrow = new Date();
37-
tomorrow.setDate(tomorrow.getDate() + 1);
36+
const thirty_minutes = new Date();
37+
thirty_minutes.setHours(thirty_minutes.getHours() + 0.5);
3838

3939
const currentWorkSpaceFolder = Util.getRootFolderName();
4040
const editor = vscode.window.activeTextEditor;
@@ -196,12 +196,12 @@ export const handleDocumentAnalyze = async (
196196
isEndorsed: problem.endorsed,
197197
isViewed: false,
198198
fullFilePath: currentWorkSpaceFolder,
199-
expiration: tomorrow.toISOString(),
199+
expiration: thirty_minutes.toISOString(),
200200
};
201201
results[key] = { ...analyzeMetaData };
202202
});
203203

204-
_debug?.appendLine('AnalyzeDocument.ts: Document File path' + currFile.absPath);
204+
_debug?.appendLine('AnalyzeDocument.ts: Document File path: ' + currFile.absPath);
205205
const problems = Util.getCurrentEditorProblems(results, currFile.absPath);
206206
_debug?.appendLine(
207207
'AnalyzeDocument.ts: handleDocumentAnalyze: problems: ' + JSON.stringify(problems),

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "metabob",
33
"displayName": "Metabob: Debug and Refactor with AI",
44
"description": "Generative AI to automate debugging and refactoring Python code",
5-
"version": "1.2.5",
5+
"version": "1.2.10",
66
"icon": "media/extension-icon.png",
77
"repository": {
88
"url": "https://github.com/MetabobProject/metabob-vscode",

src/context/UserContext.spec.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ describe('AccountSettingProvider', () => {
555555
const mockMessageEvent = (event: MessageEvent<MessageType>) => {
556556
window.dispatchEvent(event);
557557
};
558-
const payload = { fileName: '/path/to/exampleFile.git' };
558+
const payload = { uri: {fsPath: '/path/to/exampleFile.git'} };
559559

560560
render(
561561
<RecoilRoot>
@@ -575,7 +575,7 @@ describe('AccountSettingProvider', () => {
575575
mockMessageEvent(messageEvent);
576576
});
577577

578-
const expectedFilename = payload.fileName.split('/').pop()?.replace('.git', '') ?? undefined;
578+
const expectedFilename = payload.uri.fsPath ?? undefined;
579579

580580
expect(mockCurrentEditorStateHandler).toHaveBeenCalledWith(expectedFilename);
581581
});
@@ -596,7 +596,7 @@ describe('AccountSettingProvider', () => {
596596
);
597597

598598
act(() => {
599-
const payload = { fileName: '/path/to/invalidFile' };
599+
const payload = { uri: {fsPath: '/path/to/invalidFile'} };
600600
const messageEvent = new MessageEvent<MessageType>('message', {
601601
data: {
602602
type: EventDataType.CURRENT_FILE,
@@ -624,7 +624,7 @@ describe('AccountSettingProvider', () => {
624624
);
625625

626626
act(() => {
627-
const payload = { fileName: '' };
627+
const payload = { uri: {fsPath: ''} };
628628
const messageEvent = new MessageEvent<MessageType>('message', {
629629
data: {
630630
type: EventDataType.CURRENT_FILE,
@@ -798,7 +798,7 @@ describe('AccountSettingProvider', () => {
798798
...IdentifiedProblems,
799799
},
800800
currentWorkSpaceFolder: 'exampleProject',
801-
currentFile: { fileName: 'exampleFileName.git' },
801+
currentFile: { uri: {fsPath: 'exampleProject/exampleFileName.git'} },
802802
};
803803
const messageEvent = new MessageEvent<MessageType>('message', {
804804
data: {
@@ -814,7 +814,7 @@ describe('AccountSettingProvider', () => {
814814
expect(mockHasWorkSpaceFoldersStateHandler).toHaveBeenCalledWith(true);
815815
expect(mockIdentifiedProblemsStateHandler).toHaveBeenCalledWith(IdentifiedProblems);
816816
expect(mockCurrentWorkSpaceProjectStateHandler).toHaveBeenCalledWith('exampleProject');
817-
expect(mockCurrentEditorStateHandler).toHaveBeenCalledWith('exampleFileName');
817+
expect(mockCurrentEditorStateHandler).toHaveBeenCalledWith('exampleProject/exampleFileName.git');
818818
});
819819

820820
it('should update Recoil state correctly on INIT_DATA event with valid payload with an edge case', () => {

src/context/UserContext.tsx

+2-8
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,7 @@ const AccountSettingProvider = ({ children }: Props): JSX.Element => {
125125
}
126126

127127
if (currentFile) {
128-
const filename: string | undefined = currentFile?.fileName
129-
?.split('/')
130-
?.pop()
131-
?.replace('.git', '');
128+
const filename: string | undefined = currentFile?.uri?.fsPath;
132129

133130
if (!filename) {
134131
setCurrentEditor(undefined);
@@ -203,10 +200,7 @@ const AccountSettingProvider = ({ children }: Props): JSX.Element => {
203200
}
204201
break;
205202
case EventDataType.CURRENT_FILE:
206-
const filename: string | undefined = payload?.fileName
207-
?.split('/')
208-
?.pop()
209-
?.replace('.git', '');
203+
const filename: string | undefined = payload?.uri?.fsPath;
210204

211205
if (!filename) {
212206
setCurrentEditor(undefined);

0 commit comments

Comments
 (0)