From 614d382bf205d86cedf152b9e93e041e0581e5a8 Mon Sep 17 00:00:00 2001 From: Abdelrahman Shawki Hassan Date: Wed, 12 Jun 2024 17:37:28 +0200 Subject: [PATCH] fix: applying AI code fixes on Windows [IDE-395] (#471) * fix: applying AI code fixes on Windows * chore: update changelog --- CHANGELOG.md | 3 ++- .../views/suggestion/codeSuggestionWebviewProvider.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a32fffd00..3b55619c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,10 @@ # Snyk Security Changelog ## [2.12.1] -- Fix Code Suggestion rendering issue on Windows. +- Fix applying AI fixes on Windows. ## [2.12.0] +- Fix Code Suggestion rendering issue on Windows. - Renders the AI Fix panel and adds more custom styling for VSCode. - Adds position line interaction. diff --git a/src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts b/src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts index d834b6dd3..d619dc8d4 100644 --- a/src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts +++ b/src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts @@ -286,14 +286,14 @@ export class CodeSuggestionWebviewProvider } const edit = new vscode.WorkspaceEdit(); - const editor = vscode.window.visibleTextEditors.find(editor => editor.document.uri.path === filePath); + const editor = vscode.window.visibleTextEditors.find(editor => editor.document.uri.fsPath === filePath); if (!editor) { throw Error(`Editor with file not found: ${filePath}`); } const editorEndLine = editor.document.lineCount; - edit.replace(vscode.Uri.parse(filePath), new vscode.Range(0, 0, editorEndLine, 0), patchedContent); + edit.replace(vscode.Uri.file(filePath), new vscode.Range(0, 0, editorEndLine, 0), patchedContent); const success = await vscode.workspace.applyEdit(edit); if (!success) {