vscode扩展如何显示表格

use*_*803 5 visual-studio-code vscode-extensions

我希望创建一个带有输入表单的VSCode扩展-一种输入方式。到目前为止,我只看到文档处理或扩展的输出。

如何在vscode扩展中显示输入字段的形式?

Tob*_*lez 6

他们需要输入多少数据?如果不是很多,你应该可以用一系列的 InputBoxes 来处理它

来自https://code.visualstudio.com/docs/extensionAPI/vscode-api

showInputBox(options?: InputBoxOptions): Thenable<string>

Opens an input box to ask the user for input.

The returned value will be undefined if the input box was canceled (e.g. pressing ESC). Otherwise the returned value will be the string typed by the user or an empty string if the user did not type anything but dismissed the input box with OK.

Parameter   Description
options?: InputBoxOptions   
Configures the behavior of the input box.

Returns Description
Thenable<string>    
A promise that resolves to a string the user provided or to undefined in case of dismissal.
Run Code Online (Sandbox Code Playgroud)


Ric*_*lva 6

Visual Studio Code API 没有任何本机方法来显示表单以收集输入。但是,您可以将输入框、快速选择等链接在一起...您可以在 vscode.window.(...) 下找到所有这些方法。

如果这些不能满足您的需求,您可以实现一个 webview,它允许您在 Visual Studio Code 中呈现集成的 HTML,并使用扩展来交换消息。

最简单的方法是在您点击提交按钮或类似按钮后,将所有收集到的数据从表单发送到扩展程序。

您对如何做一个可爱的小教程在这里