Skip to content

Commit a48c88e

Browse files
Razmo99JustinGrote
authored andcommitted
added new option to specifiy if an Alias should be generated when a function parameter is renamed
1 parent 9245c93 commit a48c88e

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,12 @@
10111011
"verbose"
10121012
],
10131013
"default": "off",
1014-
"markdownDescription": "Traces the communication between VS Code and the PowerShell Editor Services language server. **This setting is only meant for extension developers!**"
1014+
"description": "Traces the communication between VS Code and the PowerShell Editor Services language server. **This setting is only meant for extension developers!**"
1015+
},
1016+
"powershell.renameSymbol.shouldGenerateAlias": {
1017+
"type": "boolean",
1018+
"default": true,
1019+
"description": "Should an Alias be genereted when renaming a function parameter"
10151020
}
10161021
}
10171022
},

src/features/RenameSymbol.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@ import { RenameProvider, WorkspaceEdit, TextDocument, CancellationToken, Positio
88
import { LanguageClient } from "vscode-languageclient/node";
99
import { ILogger } from "../logging";
1010
// eslint-disable-next-line @typescript-eslint/no-empty-interface
11+
interface RenameSymbolOptions {
12+
ShouldGenerateAlias?:boolean
13+
}
1114
interface IRenameSymbolRequestArguments {
1215
FileName?:string
1316
Line?:number
1417
Column?:number
1518
RenameTo?:string
19+
Options?:RenameSymbolOptions
1620
}
1721
interface IPrepareRenameSymbolRequestArguments {
1822
FileName?:string
@@ -64,6 +68,10 @@ export class RenameSymbolFeature extends LanguageClientConsumer implements Renam
6468
Column : position.character,
6569
RenameTo : newName,
6670
};
71+
const config = vscode.workspace.getConfiguration();
72+
req.Options = {
73+
ShouldGenerateAlias: config.get("powershell.renameSymbol.shouldGenerateAlias")
74+
};
6775

6876
try {
6977
const client = await LanguageClientConsumer.getLanguageClient();

src/settings.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export class Settings extends PartialSettings {
3939
cwd = ""; // NOTE: use validateCwdSetting() instead of this directly!
4040
enableReferencesCodeLens = true;
4141
analyzeOpenDocumentsOnly = false;
42+
renameSymbol = new RenameSymbolSettings();
4243
// TODO: Add (deprecated) useX86Host (for testing)
4344
}
4445

@@ -155,6 +156,10 @@ class ButtonSettings extends PartialSettings {
155156
showPanelMovementButtons = false;
156157
}
157158

159+
class RenameSymbolSettings extends PartialSettings {
160+
shouldGenerateAlias = true;
161+
}
162+
158163
// This is a recursive function which unpacks a WorkspaceConfiguration into our settings.
159164
function getSetting<TSetting>(key: string | undefined, value: TSetting, configuration: vscode.WorkspaceConfiguration): TSetting {
160165
// Base case where we're looking at a primitive type (or our special record).

0 commit comments

Comments
 (0)