Is it possible to write an binary file import exte

2019-05-07 21:05发布

问题:

I want to display some informations of a binary file in vs code. Is it possible to write an extension for vs code, such that when selecting that file in the Explorer (or opening it directly) you see some text extracted from the binary file by that extension?

So the core functionality of that extension would be (simplified) a binary to text converter.

Any suggestions?

回答1:

The VS Code team member has confirmed they do not have support for registering content providers for binary files in my issue.

I've inspected the workspace.onDidOpenTextDocument and window.onDidChangeActiveTextEditor APIs, but neither seems to be called when opening binary files.

Is there a way to display fallback content using registerTextDocumentContentProvider (or otherwise) for binary files?

That's why these types all carry Text in their names, TextEditor, TextDocument, etc. They can only handle textual, not binary data ;-)

No explanation as to why this works for PDFs, probably special-cased.