Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@
}
],
"commands": [
{
"command": "hexEditor.reopenFile",
"category": "%name%",
"title": "%hexEditor.reopenFile%",
"icon": "$(file-binary)"
},
{
"command": "hexEditor.openFile",
"category": "%name%",
Expand Down Expand Up @@ -198,7 +204,7 @@
],
"editor/title": [
{
"command": "hexEditor.openFile",
"command": "hexEditor.reopenFile",
"group": "navigation@1",
"when": "activeEditor && config.hexeditor.showOpenFileButton"
}
Expand All @@ -221,6 +227,11 @@
}
],
"explorer/context": [
{
"command": "hexEditor.openFile",
"group": "2_open",
"when": "!explorerResourceIsFolder"
},
{
"command": "hexEditor.compareSelected",
"group": "3_compare@30",
Expand Down
3 changes: 2 additions & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"hexeditor.columnWidth": "The number of bytes per row to show in the editor.",
"hexeditor.showDecodedText": "Whether decoded text should be shown in the editor.",
"hexeditor.showOpenFileButton": "Show Hex Editor button in editor menu.",
"hexEditor.openFile": "Open Active File in Hex Editor",
"hexEditor.reopenFile": "Open Active File in Hex Editor",
"hexEditor.openFile": "Open in Hex Editor",
"hexEditor.goToOffset": "Go To Offset",
"hexEditor.selectBetweenOffsets": "Select Between Offsets",
"hexEditor.copyAs": "Copy As...",
Expand Down
15 changes: 13 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ function reopenWithHexEditor() {
uri: vscode.Uri | undefined;
};
if (activeTabInput.uri) {
vscode.commands.executeCommand("vscode.openWith", activeTabInput.uri, "hexEditor.hexedit");
openWithHexEditor(activeTabInput.uri);
}
}

function openWithHexEditor(resource: vscode.Uri | undefined) {
if (resource) {
vscode.commands.executeCommand("vscode.openWith", resource, "hexEditor.hexedit");
}
}

Expand All @@ -53,9 +59,13 @@ export async function activate(context: vscode.ExtensionContext) {

const telemetryReporter = new TelemetryReporter(configValues.aiKey);
context.subscriptions.push(telemetryReporter);
const reopenWithCommand = vscode.commands.registerCommand(
"hexEditor.reopenFile",
reopenWithHexEditor,
);
const openWithCommand = vscode.commands.registerCommand(
"hexEditor.openFile",
reopenWithHexEditor,
openWithHexEditor,
);
const goToOffsetCommand = vscode.commands.registerCommand("hexEditor.goToOffset", () => {
const first = registry.activeMessaging[Symbol.iterator]().next();
Expand Down Expand Up @@ -128,6 +138,7 @@ export async function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(selectBetweenOffsetsCommand);
context.subscriptions.push(copyAsCommand);
context.subscriptions.push(switchEditModeCommand);
context.subscriptions.push(reopenWithCommand);
context.subscriptions.push(openWithCommand);
context.subscriptions.push(telemetryReporter);
context.subscriptions.push(copyOffsetAsDec, copyOffsetAsHex);
Expand Down