Skip to content

Commit

Permalink
fix: applying AI code fixes on Windows [IDE-395] (#471)
Browse files Browse the repository at this point in the history
* fix: applying AI code fixes on Windows

* chore: update changelog
  • Loading branch information
ShawkyZ authored Jun 12, 2024
1 parent 7d7e3c0 commit 614d382
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 614d382

Please sign in to comment.