Skip to content

Commit

Permalink
Open the modified header for 'Extract to function'. (#11670)
Browse files Browse the repository at this point in the history
* Open the modified header for 'Extract to function'.
  • Loading branch information
sean-mcmanus authored Nov 13, 2023
1 parent 1af06e1 commit 5325b37
Showing 1 changed file with 9 additions and 0 deletions.
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

0 comments on commit 5325b37

Please sign in to comment.