Skip to content

Added is windows utility #2900

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { openNewEditor } from "@cursorless/vscode-common";
import { getFixturePath, isWindows } from "@cursorless/node-common";
import { openNewEditor, runCursorlessCommand } from "@cursorless/vscode-common";
import * as assert from "assert";
import * as os from "os";
import * as vscode from "vscode";
import { endToEndTestSetup } from "../endToEndTestSetup";
import { runCursorlessCommand } from "@cursorless/vscode-common";
import { getFixturePath } from "@cursorless/node-common";

suite("followLink", async function () {
endToEndTestSetup(this);
Expand Down Expand Up @@ -45,8 +43,9 @@ async function followDefinition() {

async function followLink() {
const filename = getFixturePath("helloWorld.txt");
const linkTextContent =
os.platform() === "win32" ? `file:///${filename}` : `file://${filename}`;
const linkTextContent = isWindows()
? `file:///${filename}`
: `file://${filename}`;
await openNewEditor(linkTextContent);

await runCursorlessCommand({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { isWindows } from "@cursorless/node-common";
import { COMMAND_SERVER_EXTENSION_ID } from "@cursorless/vscode-common";
import { globSync } from "glob";
import * as fs from "node:fs";
Expand Down Expand Up @@ -142,7 +143,7 @@ function commandServerInstalled() {
}

function getTalonHomePath() {
return os.platform() === "win32"
return isWindows()
? `${os.homedir()}\\AppData\\Roaming\\talon`
: `${os.homedir()}/.talon`;
}
3 changes: 2 additions & 1 deletion packages/node-common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ export * from "./FileSystemTutorialContentProvider";
export * from "./getCursorlessRepoRoot";
export * from "./getFixturePaths";
export * from "./getScopeTestPathsRecursively";
export * from "./isWindows";
export * from "./loadFixture";
export * from "./nodeGetRunMode";
export * from "./runRecordedTest";
export * from "./walkAsync";
export * from "./walkSync";
export * from "./loadFixture";
5 changes: 5 additions & 0 deletions packages/node-common/src/isWindows.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import * as os from "node:os";

export function isWindows() {
return os.platform() === "win32";
}
4 changes: 2 additions & 2 deletions packages/test-harness/src/launchNeovimAndRunTests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getEnvironmentVariableStrict } from "@cursorless/common";
import { getCursorlessRepoRoot } from "@cursorless/node-common";
import { getCursorlessRepoRoot, isWindows } from "@cursorless/node-common";
import * as cp from "child_process";
import { copyFile, mkdirSync, readdirSync } from "fs";
import process from "node:process";
Expand Down Expand Up @@ -55,7 +55,7 @@ export async function launchNeovimAndRunTests() {
// testing normal nvim startup
//https://stackoverflow.com/questions/3025615/is-there-a-vim-runtime-log
// if (process.platform === "darwin" || process.platform === "win32") {
if (process.platform === "win32") {
if (isWindows()) {
// const { status, signal, error } = cp.spawnSync(cli, [`-V9`], {
const { status, signal, error } = cp.spawnSync(cli, [`-V25`], {
encoding: "utf-8",
Expand Down
7 changes: 3 additions & 4 deletions packages/test-harness/src/launchVscodeAndRunTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ import {
extensionDependencies,
getEnvironmentVariableStrict,
} from "@cursorless/common";
import { getCursorlessRepoRoot } from "@cursorless/node-common";
import { getCursorlessRepoRoot, isWindows } from "@cursorless/node-common";
import {
downloadAndUnzipVSCode,
resolveCliArgsFromVSCodeExecutablePath,
runTests,
} from "@vscode/test-electron";
import { sync } from "cross-spawn";
import * as os from "node:os";
import * as path from "node:path";

/**
Expand Down Expand Up @@ -41,7 +40,7 @@ export async function launchVscodeAndRunTests(extensionTestsPath: string) {

const vscodeVersion = useLegacyVscode
? "1.82.0"
: os.platform() === "win32"
: isWindows()
? "stable"
: "1.97.2";
const vscodeExecutablePath = await downloadAndUnzipVSCode(vscodeVersion);
Expand Down Expand Up @@ -82,7 +81,7 @@ export async function launchVscodeAndRunTests(extensionTestsPath: string) {
// hangs some of the time, so might be enough to get a crash dump when you
// need it.
launchArgs:
useLegacyVscode || os.platform() === "win32"
useLegacyVscode || isWindows()
? undefined
: [`--crash-reporter-directory=${crashDir}`, `--logsPath=${logsDir}`],
});
Expand Down
Loading