Skip to content
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

Use findArgument in createCancellationToken #60436

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
12 changes: 3 additions & 9 deletions src/tsserver/nodeServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ export function initializeNodeSystem(): StartInput {
sys.gc = () => global.gc?.();
}

const cancellationToken = createCancellationToken(sys.args);
const cancellationToken = createCancellationToken();

const localeStr = ts.server.findArgument("--locale");
if (localeStr) {
Expand Down Expand Up @@ -673,14 +673,8 @@ function pipeExists(name: string): boolean {
return fs.existsSync(name);
}

function createCancellationToken(args: string[]): ts.server.ServerCancellationToken {
let cancellationPipeName: string | undefined;
for (let i = 0; i < args.length - 1; i++) {
if (args[i] === "--cancellationPipeName") {
cancellationPipeName = args[i + 1];
break;
}
}
function createCancellationToken(): ts.server.ServerCancellationToken {
const cancellationPipeName = ts.server.findArgument("--cancellationPipeName");
if (!cancellationPipeName) {
return ts.server.nullCancellationToken;
}
Expand Down