theia icon indicating copy to clipboard operation
theia copied to clipboard

VS HexEditor pane comes up blank

Open profbbrown opened this issue 10 months ago • 8 comments

I've installed the VS Hex Editor extension using the Extensions manager. Whenever I try to open a file using it, the pane is empty. It's using a webview, which from experience causes problems for some Theia installations. But webview works fine for things like image viewing. (I've had to set the webview endpoint to {{hostname}} in order to get it to work.)

Attached is a screenshot of the two errors that appear in the JavaScript console.

Screenshot 2024-03-22 at 1 11 59 PM

Is there anything else I need to configure for the hex editor to function properly?

Originally posted by @profbbrown in https://github.com/eclipse-theia/theia/discussions/13519

profbbrown avatar Mar 26 '24 21:03 profbbrown

I'm using ms-vscode.hexeditor, version 1.9.14, installed from the Extensions pane.

Theia version 1.47.0, in a web browser.

profbbrown avatar Mar 26 '24 21:03 profbbrown

This seems fixed in 1.48.0. Please let us know if it's still a problem for you.

tsmaeder avatar Apr 02 '24 12:04 tsmaeder

FYI, preview is avilable here: https://download.eclipse.org/theia/ide-preview/1.48.0/

JonasHelming avatar Apr 02 '24 12:04 JonasHelming

The Hex Editor is now appearing in the pane. That part is fixed.

However, the contents of the pane is just "LOADING". There is a JavaScript error: root ERROR Error: Could not find typed array for code 16. I'll need to build a developer version of Theia to get you a proper file and line number.

Screenshot 2024-04-02 at 8 24 26 AM

profbbrown avatar Apr 02 '24 15:04 profbbrown

My development build still has obfuscated variable names and a single bundle.js. However, some searching around came up with a pretty good match on this: https://greasyfork.org/en/scripts/457386-scenexeutils/code

(Do a search within the page for "could not find typed array for code")

profbbrown avatar Apr 03 '24 03:04 profbbrown

It seems the remaining problem is related to how msgpackr treats array buffers. Consider this script:

const { Packr } = require ('msgpackr');

const inst= new Packr({ moreTypes: true, encodeUndefinedAsNil: false, bundleStrings: false });

const value = {
    type: 16,
    value: new ArrayBuffer(10)
};

const serializedAsBuffer = inst.encode(value);
const data = inst.decode(serializedAsBuffer);
console.log(`object is ${JSON.stringify(data)}`);

The script fails with the same error I get from the hex editor.

Error: Could not find typed array for code 16
    at currentExtensions.<computed> (C:\Users\thomas\code\EclipseSource\theia\node_modules\msgpackr\dist\node.cjs:1056:9)
    at readExt (C:\Users\thomas\code\EclipseSource\theia\node_modules\msgpackr\dist\node.cjs:892:33)
    at read (C:\Users\thomas\code\EclipseSource\theia\node_modules\msgpackr\dist\node.cjs:339:12)
    at Array.readObject [as read] (C:\Users\thomas\code\EclipseSource\theia\node_modules\msgpackr\dist\node.cjs:522:18)
    at recordDefinition (C:\Users\thomas\code\EclipseSource\theia\node_modules\msgpackr\dist\node.cjs:992:19)
    at read (C:\Users\thomas\code\EclipseSource\theia\node_modules\msgpackr\dist\node.cjs:418:13)
    at checkedRead (C:\Users\thomas\code\EclipseSource\theia\node_modules\msgpackr\dist\node.cjs:197:13)
    at Packr.unpack (C:\Users\thomas\code\EclipseSource\theia\node_modules\msgpackr\dist\node.cjs:107:12)
    at Packr.decode (C:\Users\thomas\code\EclipseSource\theia\node_modules\msgpackr\dist\node.cjs:179:15)
    at Object.<anonymous> (C:\Users\thomas\code\EclipseSource\theia\scripts\testpack.js:11:19)

When I flip the flags moreTypesto false when creating the Packr instance, the test runs through.

tsmaeder avatar May 10 '24 08:05 tsmaeder

I have filed https://github.com/kriszyp/msgpackr/issues/135

tsmaeder avatar May 10 '24 09:05 tsmaeder

Let's wait an see how they react to the issue.

tsmaeder avatar May 10 '24 09:05 tsmaeder