feat: add install vscode command (#2135)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run

This commit is contained in:
Myriad-Dreamin 2025-09-27 11:46:20 +08:00 committed by GitHub
parent 34bc516466
commit d2a747372f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 47 additions and 46 deletions

View file

@ -127,6 +127,8 @@ export async function checkVersion() {
`Version mismatch: ${cargoVersion} (in Cargo.toml) !== ${pkgVersion} (in package.json)`,
);
}
return { cargoVersion, pkgVersion };
}
export async function buildTinymistVscodeWebBase() {
@ -157,8 +159,8 @@ export async function buildTinymistVscodeSystem() {
]);
}
export async function buildDebugLspBinary() {
await spawnAsync("lsp:debug", "cargo build -p tinymist-cli --color=always", {
export async function buildLspBinary(kind) {
await spawnAsync(`lsp:${kind}`, `cargo build -p tinymist-cli --color=always --profile=${kind}`, {
env: {
...process.env,
FORCE_COLOR: "1",
@ -169,10 +171,10 @@ export async function buildDebugLspBinary() {
await Promise.all([
fs.copyFile(
path.resolve(cwd, `target/debug/${binName}`),
path.resolve(cwd, `target/${kind}/${binName}`),
path.resolve(vscodeDir, `out/${binName}`),
),
process.platform === "win32"
process.platform === "win32" && kind === "debug"
? [
fs.copyFile(
path.resolve(cwd, `target/debug/tinymist.pdb`),
@ -183,8 +185,23 @@ export async function buildDebugLspBinary() {
]);
}
export async function prelaunchVscode() {
await Promise.all([buildTinymistVscodeSystem(), buildDebugLspBinary()]);
export async function prelaunchVscode(kind) {
await Promise.all([buildTinymistVscodeSystem(), buildLspBinary(kind)]);
}
export async function installVscode(kind) {
const [{ pkgVersion }, ..._rest] = await Promise.all([
checkVersion(),
buildTinymistVscodeSystem(),
buildLspBinary(kind),
]);
await spawnAsync("package:vscode", "cd editors/vscode && yarn package");
// install code
await spawnAsync(
"install:vscode",
`cd editors/vscode && code --install-extension tinymist-${pkgVersion}.vsix`,
);
}
export async function buildWebLspBinaryBase() {