Skip to content

Commit

Permalink
Add Include Header setting for refactoring actions (#11449)
Browse files Browse the repository at this point in the history
  • Loading branch information
michelleangela authored Sep 27, 2023
1 parent f62cad6 commit 1bde544
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
16 changes: 16 additions & 0 deletions Extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,22 @@
"description": "%c_cpp.configuration.inactiveRegionBackgroundColor.description%",
"scope": "resource"
},
"C_Cpp.refactoring.includeHeader": {
"type": "string",
"enum": [
"always",
"ifNeeded",
"never"
],
"default": "always",
"markdownDescription": "%c_cpp.configuration.refactoring.includeHeader.markdownDescription%",
"enumDescriptions": [
"%c_cpp.configuration.refactoring.includeHeader.always.description%",
"%c_cpp.configuration.refactoring.includeHeader.ifNeeded.description%",
"%c_cpp.configuration.refactoring.includeHeader.never.description%"
],
"scope": "resource"
},
"C_Cpp.renameRequiresIdentifier": {
"type": "boolean",
"default": true,
Expand Down
6 changes: 5 additions & 1 deletion Extension/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -996,5 +996,9 @@
"c_cpp.walkthrough.customize.debugging.windows.description": "You can customize your debug configuration (e.g. to pass arguments to your program at run time) by selecting \"Add Debug Configuration\" to the right of the play button. The custom debug configuration is saved in your project's launch.json file. \n[Learn More](https://code.visualstudio.com/docs/cpp/config-clang-mac#_debug-helloworldcpp)",
"c_cpp.walkthrough.customize.debugging.altText": "Image that shows Add Debug Configuration in the drop-down",
"c_cpp.codeActions.refactor.inline.macro.title": "Inline macro",
"c_cpp.codeActions.refactor.inline.macro.description": "Replace the macro invocation with the expanded code."
"c_cpp.codeActions.refactor.inline.macro.description": "Replace the macro invocation with the expanded code.",
"c_cpp.configuration.refactoring.includeHeader.markdownDescription": "Controls whether to include the header file of a refactored function/symbol to its corresponding source file when doing a refactoring action, such as create declaration/definition.",
"c_cpp.configuration.refactoring.includeHeader.always.description": "Always include the header file if it is not included explicitly in its source file.",
"c_cpp.configuration.refactoring.includeHeader.ifNeeded.description": "Only include the header file if it is not included explicitly in its source file or through implicit inclusion.",
"c_cpp.configuration.refactoring.includeHeader.never.description": "Never include the header file."
}
3 changes: 2 additions & 1 deletion Extension/src/LanguageServer/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1415,7 +1415,8 @@ export class DefaultClient implements Client {
searchExclude: otherSettings.searchExclude,
editorAutoClosingBrackets: otherSettings.editorAutoClosingBrackets,
editorInlayHintsEnabled: otherSettings.editorInlayHintsEnabled,
editorParameterHintsEnabled: otherSettings.editorParameterHintsEnabled
editorParameterHintsEnabled: otherSettings.editorParameterHintsEnabled,
refactoringIncludeHeader: settings.refactoringIncludeHeader
};
return result;
}
Expand Down
2 changes: 2 additions & 0 deletions Extension/src/LanguageServer/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export interface WorkspaceFolderSettingsParams {
editorAutoClosingBrackets: string | undefined;
editorInlayHintsEnabled: boolean | undefined;
editorParameterHintsEnabled: boolean | undefined;
refactoringIncludeHeader: string | undefined;
}

export interface SettingsParams {
Expand Down Expand Up @@ -368,6 +369,7 @@ export class CppSettings extends Settings {
public get workspaceParsingPriority(): string | undefined { return super.Section.get<string>("workspaceParsingPriority"); }
public get workspaceSymbols(): string | undefined { return super.Section.get<string>("workspaceSymbols"); }
public get exclusionPolicy(): string | undefined { return super.Section.get<string>("exclusionPolicy"); }
public get refactoringIncludeHeader(): string | undefined { return super.Section.get<string>("refactoring.includeHeader"); }
public get simplifyStructuredComments(): boolean | undefined { return super.Section.get<boolean>("simplifyStructuredComments"); }
public get doxygenGeneratedCommentStyle(): string | undefined { return super.Section.get<string>("doxygen.generatedStyle"); }
public get doxygenGenerateOnType(): boolean | undefined { return super.Section.get<boolean>("doxygen.generateOnType"); }
Expand Down

0 comments on commit 1bde544

Please sign in to comment.