Is it possible to write an binary file import extension for vs code?

纵饮孤独 提交于 2019-12-07 07:46:03

问题


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.



来源:https://stackoverflow.com/questions/50481300/is-it-possible-to-write-an-binary-file-import-extension-for-vs-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!