Skip to content

Commit e9d7759

Browse files
authored
Fix and document providing flags to getTargetOutput (#287)
I missed testing this case with command input variables in #275. IMO it's a VSCode bug that the calling convention is different than with `vscode.commands.executeCommand` (microsoft/vscode#167970), but nevertheless we need to handle it.
1 parent dfb6c31 commit e9d7759

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/extension/extension.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,11 +418,27 @@ async function bazelCopyTargetToClipboard(
418418
* "args": ["//my/binary:target"],
419419
* }
420420
* ]
421+
*
422+
* Additional Bazel flags can be provided:
423+
*
424+
* "inputs": [
425+
* {
426+
* "id": "debugOutputLocation",
427+
* "type": "command",
428+
* "command": "bazel.getTargetOutput",
429+
* "args": ["//my/binary:target", ["--compilation_mode", "dbg"]],
430+
* }
431+
* ]
421432
*/
422433
async function bazelGetTargetOutput(
423434
target: string,
424435
options: string[] = [],
425436
): Promise<string> {
437+
// Workaround for https://github.com/microsoft/vscode/issues/167970
438+
if (Array.isArray(target)) {
439+
options = (target[1] || [] as any);
440+
target = target[0];
441+
}
426442
const workspaceInfo = await BazelWorkspaceInfo.fromWorkspaceFolders();
427443
if (!workspaceInfo) {
428444
vscode.window.showInformationMessage(

0 commit comments

Comments
 (0)