如何使用 vs 代码扩展 API 向用户询问用户名或其他数据

How to ask user for username or other data with vs code extension API

我想从用户那里接收一些输入,例如 username 并在代码中使用它。如何实现?

要请求简单的输入,您可以使用 vscode.window.showInputBox() API。 例如:

import * as vscode from "vscode";

const input = await vscode.window.showInputBox();
vscode.window.showInformationMessage(input);

对于高级用法,还有 vscode.InputBox which is created via the vscode.window.createInputBox() 命令