Skip to content

Commit

Permalink
Decode the file content properly. (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
caponetto authored Aug 21, 2021
1 parent 53a1011 commit c2f8414
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
{
"name": "Launch vscode-extension (web)",
"type": "pwa-extensionHost",
"debugWebWorkerHost": true,
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceFolder}", "--extensionDevelopmentKind=web"],
"outFiles": ["${workspaceRoot}/dist/**/*.js"],
}
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.1.10
Decode the file content properly

# 1.1.9
Add support for *.patch files

Expand Down
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": "vscode-diff-viewer",
"displayName": "Diff Viewer",
"description": "Visualize git diff files in VS Code",
"version": "1.1.9",
"version": "1.1.10",
"license": "MIT",
"publisher": "caponetto",
"repository": {
Expand Down
3 changes: 2 additions & 1 deletion src/DiffDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as vscode from "vscode";

export class DiffDocument implements vscode.CustomDocument {
private readonly _onDidDispose = new vscode.EventEmitter<void>();
private static readonly decoder = new TextDecoder("utf-8");
public readonly onDidDispose = this._onDidDispose.event;

get filename(): string {
Expand All @@ -18,6 +19,6 @@ export class DiffDocument implements vscode.CustomDocument {

public static async create(uri: vscode.Uri): Promise<DiffDocument | PromiseLike<DiffDocument>> {
const fileData = await vscode.workspace.fs.readFile(uri);
return new DiffDocument(uri, fileData.toString());
return new DiffDocument(uri, this.decoder.decode(fileData));
}
}

0 comments on commit c2f8414

Please sign in to comment.