Skip to content

Commit 09ea8ad

Browse files
committed
Add First-Run rename disclaimer
1 parent df463c5 commit 09ea8ad

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

Diff for: media/RenameDisclaimer.txt

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
### PowerShell Extension Rename Disclaimer ###
2+
3+
PowerShell is not a statically typed language. As such, the renaming of functions, parameters, and other symbols can only be done on a best effort basis. While this is sufficient for the majority of use cases, it cannot be relied upon to find all instances of a symbol and rename them across an entire code base such as in C# or TypeScript.
4+
5+
There are several edge case scenarios which may exist where rename is difficult or impossible, or unable to be determined due to the dynamic scoping nature of PowerShell.
6+
7+
# Known Rename Limitations
8+
9+
- Renaming can only be done within a single file. Renaming symbols across multiple files is not supported.

Diff for: src/features/RenameSymbol.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -165,19 +165,22 @@ export class RenameSymbolFeature extends LanguageClientConsumer implements Renam
165165
const acceptRenameDisclaimer = config.get<boolean>("powershell.renameSymbol.acceptRenameDisclaimer", false);
166166

167167
if (!acceptRenameDisclaimer) {
168+
const extensionPath = vscode.extensions.getExtension("ms-vscode.PowerShell")?.extensionPath;
169+
const disclaimerPath = vscode.Uri.file(`${extensionPath}/media/RenameDisclaimer.txt`);
170+
168171
const result = await vscode.window.showWarningMessage(
169172
//TODO: Provide a link to a markdown document that appears in the editor window, preferably one hosted with the extension itself.
170-
"The PowerShell Rename functionality has limitations. Do you accept the limitations and risks?",
171-
"Yes",
172-
"Workspace Only",
173+
`The PowerShell Rename functionality has limitations and risks, please [review the disclaimer](${disclaimerPath}).`,
174+
"I Accept",
175+
"I Accept [Workspace]",
173176
"No"
174177
);
175178

176179
switch (result) {
177-
case "Yes":
180+
case "I Accept":
178181
await config.update("powershell.renameSymbol.acceptRenameDisclaimer", true, vscode.ConfigurationTarget.Global);
179182
break;
180-
case "Workspace Only":
183+
case "I Accept [Workspace]":
181184
await config.update("powershell.renameSymbol.acceptRenameDisclaimer", true, vscode.ConfigurationTarget.Workspace);
182185
break;
183186
default:

0 commit comments

Comments
 (0)