我正在尝试使用表达式块:
var branches = [for (branchName in process.toString().split("\n")) {
{label: branchName};
}];
Vscode.window.showQuickPick(branches); // <-- this line 25, 26 is empty line
但我明白了:
/src/Main.hx:26: characters 8-35 : Constraint check failure for showQuickPick.T
/src/Main.hx:26: characters 8-35 : { label : String } should be vscode.QuickPickItem
/src/Main.hx:26: characters 8-35 : { label : String } should be { label : String, ?detail : Null<String>, description : String }
/src/Main.hx:26: characters 8-35 : { label : String } has no field description
表达式块不允许返回对象吗?
答案 0 :(得分:3)
这一行概述了问题:
/src/Main.hx:26: characters 8-35 : { label : String } has no field description
您的对象需要字符串description
字段,因为该字段不是可选字段。
请参阅:https://github.com/vshaxe/vscode-extern/blob/master/src/vscode/QuickPickItem.hx