Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'editors/code/src/util.ts')
| -rw-r--r-- | editors/code/src/util.ts | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/editors/code/src/util.ts b/editors/code/src/util.ts index 51f921a296..868cb2b780 100644 --- a/editors/code/src/util.ts +++ b/editors/code/src/util.ts @@ -2,6 +2,7 @@ import * as vscode from "vscode"; import { strict as nativeAssert } from "assert"; import { exec, type ExecOptions, spawnSync } from "child_process"; import { inspect } from "util"; +import type { CargoRunnableArgs, ShellRunnableArgs } from "./lsp_ext"; import type { Env } from "./client"; export function assert(condition: boolean, explanation: string): asserts condition { @@ -77,6 +78,12 @@ export function isCargoTomlDocument(document: vscode.TextDocument): document is return document.uri.scheme === "file" && document.fileName.endsWith("Cargo.toml"); } +export function isCargoRunnableArgs( + args: CargoRunnableArgs | ShellRunnableArgs, +): args is CargoRunnableArgs { + return (args as CargoRunnableArgs).executableArgs !== undefined; +} + export function isRustEditor(editor: vscode.TextEditor): editor is RustEditor { return isRustDocument(editor.document); } |