feature: add build system info; runnables to rust-project.json

This commit is contained in:
Wilfred Hughes 2024-06-11 11:55:04 -04:00 committed by David Barsky
parent 14a1f4530c
commit 71a78a9cdc
17 changed files with 628 additions and 227 deletions

View file

@ -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);
}