Skip to content

Commit 5325b37

Browse files
authored
Open the modified header for 'Extract to function'. (#11670)
* Open the modified header for 'Extract to function'.
1 parent 1af06e1 commit 5325b37

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Extension/src/LanguageServer/client.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3608,6 +3608,15 @@ export class DefaultClient implements Client {
36083608
return;
36093609
}
36103610

3611+
if (headerFormatUriAndRanges.length > 0) {
3612+
// The header needs to be open and shown or the formatting will fail
3613+
// (due to issues/requirements in the cpptools process).
3614+
// It also seems strange and undesirable to have the header modified
3615+
// without being opened because otherwise users may not realize that
3616+
// the header had changed (unless they view source control differences).
3617+
await vscode.window.showTextDocument(headerFormatUriAndRanges[0].uri, { preserveFocus: true });
3618+
}
3619+
36113620
// Apply the extract to function text edits.
36123621
await vscode.workspace.applyEdit(workspaceEdits, { isRefactoring: true });
36133622

0 commit comments

Comments
 (0)