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

Clean up disposables in early-return path of ClangdContext.create() #743

Merged
merged 1 commit into from
Dec 4, 2024
Merged
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
11 changes: 5 additions & 6 deletions src/clangd-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,18 @@ export class ClangdContext implements vscode.Disposable {
Promise<ClangdContext|null> {
const subscriptions: vscode.Disposable[] = [];
const clangdPath = await install.activate(subscriptions, globalStoragePath);
if (!clangdPath)
if (!clangdPath) {
subscriptions.forEach((d) => { d.dispose(); });
return null;
}

const clangdArguments = await config.get<string[]>('arguments');

return new ClangdContext(subscriptions, clangdPath, clangdArguments,
outputChannel);
return new ClangdContext(subscriptions, clangdPath, outputChannel);
}

private constructor(subscriptions: vscode.Disposable[], clangdPath: string,
clangdArguments: string[],
outputChannel: vscode.OutputChannel) {
this.subscriptions = subscriptions;
const clangdArguments = config.get<string[]>('arguments');
const clangd: vscodelc.Executable = {
command: clangdPath,
args: clangdArguments,
Expand Down
Loading