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

Open the modified header for 'Extract to function'. #11670

Merged
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
9 changes: 9 additions & 0 deletions Extension/src/LanguageServer/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3608,6 +3608,15 @@ export class DefaultClient implements Client {
return;
}

if (headerFormatUriAndRanges.length > 0) {
// The header needs to be open and shown or the formatting will fail
// (due to issues/requirements in the cpptools process).
// It also seems strange and undesirable to have the header modified
// without being opened because otherwise users may not realize that
// the header had changed (unless they view source control differences).
await vscode.window.showTextDocument(headerFormatUriAndRanges[0].uri, { preserveFocus: true });
}

// Apply the extract to function text edits.
await vscode.workspace.applyEdit(workspaceEdits, { isRefactoring: true });

Expand Down