Skip to content

Commit

Permalink
Fix and document providing flags to getTargetOutput (#287)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jfirebaugh committed Dec 5, 2022
1 parent dfb6c31 commit e9d7759
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/extension/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,11 +418,27 @@ async function bazelCopyTargetToClipboard(
* "args": ["//my/binary:target"],
* }
* ]
*
* Additional Bazel flags can be provided:
*
* "inputs": [
* {
* "id": "debugOutputLocation",
* "type": "command",
* "command": "bazel.getTargetOutput",
* "args": ["//my/binary:target", ["--compilation_mode", "dbg"]],
* }
* ]
*/
async function bazelGetTargetOutput(
target: string,
options: string[] = [],
): Promise<string> {
// Workaround for https://github.com/microsoft/vscode/issues/167970
if (Array.isArray(target)) {
options = (target[1] || [] as any);
target = target[0];
}
const workspaceInfo = await BazelWorkspaceInfo.fromWorkspaceFolders();
if (!workspaceInfo) {
vscode.window.showInformationMessage(
Expand Down

0 comments on commit e9d7759

Please sign in to comment.