-
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit introduces the `bazel.pickTarget` and `bazel.pickPackage` command variables. Those commands can be used from `tasks.json` and `launch.json` to prompt the user to select a Bazel target or package. The available choices are determined by a user-specified Bazel query. The implementation reuses the existing quick-pick functionality from `bazel_quickpick.ts`. The `wrapQuickPick` function parses the arguments passed from the `task.json` and then forwards to the existing quickpicks. Those utility functions were restructured as part of this commit: 1. The internal helpers `queryWorkspaceQuickPickPackages` and `queryWorkspaceQuickPickTargets` were inlined into `queryQuickPick{Packages,Targets}` as the internal helper functions got in the way of other changes, but didn't deduplicate any code as they only had one caller. 2. The `queryQuickPick{Packages,Targets}` take an object with named parameters now. 3. `queryQuickPickPackage` now also accepts a `query` parameter instead of using the `queryExpression`. Both `queryQuickPickPackages` and `queryQuickPickTargets` default to the query `//...` if no query string is provided by the caller. Point (3) also is a user-facing change. Commands like "Build package" and "Test package" now use `//...` instead of the configured `queryExpression`. This is in sync with other commands like "Test target" which uses the hardcoded query `kind('.*_test rule', ...)`.
- Loading branch information
1 parent
e50cb97
commit 2ef6d2a
Showing
7 changed files
with
198 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import * as vscode from "vscode"; | ||
|
||
let assertionFailureReported = false; | ||
|
||
/** | ||
* Asserts that the given value is true. | ||
*/ | ||
export function assert(value: boolean): asserts value { | ||
if (!value) { | ||
debugger; // eslint-disable-line no-debugger | ||
if (!assertionFailureReported) { | ||
// Only report one assertion failure, to avoid spamming the | ||
// user with error messages. | ||
assertionFailureReported = true; | ||
// Log an `Error` object which will include the stack trace | ||
// eslint-disable-next-line no-console | ||
console.error(new Error("Assertion violated.")); | ||
// eslint-disable-next-line @typescript-eslint/no-floating-promises | ||
vscode.window.showErrorMessage( | ||
"Assertion violated. This is a programming error.\n" + | ||
"Please file a bug at " + | ||
"https://github.com/bazelbuild/vscode-bazel/issues", | ||
); | ||
} | ||
throw new Error("Assertion violated."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.