When trying to open a binary file in Visual Studio Code, the following message will show:
The file will not be displayed in the editor because it is either binary, very large or uses an unsupported text encoding
This is likely a protection to avoid the editor from freezing.
I would love to decode the file before showing it in the editor and have a function ready to handle that. The problem is, that I never have a chance to run my function since the following code never triggers:
vscode.workspace.onDidOpenTextDocument(function (doc) {
if (doc && doc.fileName.endsWith('.scpt')) {
console.log("You're trying to open a binary AppleScript file")
}
});
Unfortunately, the API doesn't provide an equivalent event to onWillSaveTextDocument
for opening files, which would fire before the message above shows. Does anybody know of a different solution?
To run or debug a simple app in VS Code, select Run and Debug on the Debug start view or press F5 and VS Code will try to run your currently active file.
There is an Extension for VSCode called HexDump that you can use to Display a specified file in hexadecimal.
Once installed:
right-click on the file, and select "Show HexDump".
And will display the following:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With