Text to image conversion in VSCode extension

时间:2019-03-06 11:36:57

标签: visual-studio-code vscode-extensions

I am working on a visual studio code extension. This is basically a language extension. I have implemented syntax highlighting for a language that is developed in our organization. This extension gets activated on ".br" file format. When .br file is opened, syntax highlighting is applied to that file.

Now, I also want to give support to one more file extension. That file extension is ".rqtf". But, I don't want to give syntax highlighting support for this file. When this file is opened in VSCode, extension should create an image and show it in VSCode window. Actual content of ".rqtf" file is textual. I want to create an image based on that information.

For example, the content of the ".rqtf" file is: Input rqtf file content

And output image file from this content should be like:

Output image file

If this is not possible in my existing extension, then I can create separate extension for that. However, I just want to know that: Is this conversion of text information to image is possible in vscode extension?

Thank you in advance.

1 个答案:

答案 0 :(得分:1)

有一个webview API,可让您呈现html:

https://code.visualstudio.com/api/extension-guides/webview

enter image description here



如果要在文本文件中渲染图像,则有一些尚未发布的“代码集”:

https://github.com/Microsoft/vscode/pull/66418

enter image description here