Skip to content

Commit 35eea13

Browse files
committed
Remove placeholders/comments and clean up in-progress items
1 parent 981f6e9 commit 35eea13

1 file changed

Lines changed: 5 additions & 22 deletions

File tree

‎src/PowerShellEditorServices/Services/TextDocument/RenameService.cs‎

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ ILanguageServerConfiguration config
5959
{
6060
RenameParams renameRequest = new()
6161
{
62-
NewName = "PREPARERENAMETEST", //A placeholder just to gather edits
62+
NewName = "PREPARE-RENAME-UNUSED", //A placeholder just to gather edits
6363
Position = request.Position,
6464
TextDocument = request.TextDocument
6565
};
@@ -88,7 +88,6 @@ ILanguageServerConfiguration config
8888
Ast? tokenToRename = FindRenamableSymbol(scriptFile, position);
8989
if (tokenToRename is null) { return null; }
9090

91-
// TODO: Potentially future cross-file support
9291
TextEdit[] changes = tokenToRename switch
9392
{
9493
FunctionDefinitionAst
@@ -194,28 +193,22 @@ private async Task<bool> AcceptRenameDisclaimer(bool acceptDisclaimerOption, Can
194193
if (DisclaimerDeclinedForSession) { throw new HandlerErrorException(disclaimerDeclinedMessage); }
195194
if (acceptDisclaimerOption || DisclaimerAcceptedForSession) { return true; }
196195

197-
// TODO: Localization
198196
const string renameDisclaimer = "PowerShell rename functionality is only supported in a limited set of circumstances. [Please review the notice](https://github.com/PowerShell/PowerShellEditorServices?tab=readme-ov-file#rename-disclaimer) and accept the limitations and risks.";
199197
const string acceptAnswer = "I Accept";
200-
// const string acceptWorkspaceAnswer = "I Accept [Workspace]";
201-
// const string acceptSessionAnswer = "I Accept [Session]";
202198
const string declineAnswer = "Decline";
203199

204-
// TODO: Unfortunately the LSP spec has no spec for the server to change a client setting, so
205-
// We have a suboptimal experience until we implement a custom feature for this.
206200
ShowMessageRequestParams reqParams = new()
207201
{
208202
Type = MessageType.Warning,
209203
Message = renameDisclaimer,
210204
Actions = new MessageActionItem[] {
211-
new MessageActionItem() { Title = acceptAnswer },
212-
new MessageActionItem() { Title = declineAnswer }
213-
// new MessageActionItem() { Title = acceptWorkspaceAnswer },
214-
// new MessageActionItem() { Title = acceptSessionAnswer },
205+
new() { Title = acceptAnswer },
206+
new() { Title = declineAnswer }
215207
}
216208
};
217209

218210
MessageActionItem? result = await lsp.SendRequest(reqParams, cancellationToken).ConfigureAwait(false);
211+
219212
// null happens if the user closes the dialog rather than making a selection.
220213
if (result is null || result.Title == declineAnswer)
221214
{
@@ -232,6 +225,7 @@ private async Task<bool> AcceptRenameDisclaimer(bool acceptDisclaimerOption, Can
232225
}
233226
if (result.Title == acceptAnswer)
234227
{
228+
// Unfortunately the LSP spec has no spec for the server to change a client setting, so we have a suboptimal experience to tell the user to change the setting rather than doing it for them without implementing custom client behavior.
235229
const string acceptDisclaimerNotice = "PowerShell rename functionality has been enabled for this session. To avoid this prompt in the future, set the powershell.rename.acceptDisclaimer to true in your settings.";
236230
ShowMessageParams msgParams = new()
237231
{
@@ -243,16 +237,6 @@ private async Task<bool> AcceptRenameDisclaimer(bool acceptDisclaimerOption, Can
243237
DisclaimerAcceptedForSession = true;
244238
return DisclaimerAcceptedForSession;
245239
}
246-
// if (result.Title == acceptWorkspaceAnswer)
247-
// {
248-
// // FIXME: Set the appropriate setting
249-
// return true;
250-
// }
251-
// if (result.Title == acceptSessionAnswer)
252-
// {
253-
// // FIXME: Set the appropriate setting
254-
// return true;
255-
// }
256240

257241
throw new InvalidOperationException("Unknown Disclaimer Response received. This is a bug and you should report it.");
258242
}
@@ -411,7 +395,6 @@ internal class RenameVariableVisitor(Ast target, string newName, bool skipVerify
411395
internal Ast? VariableDefinition;
412396

413397
// Validate and cleanup the newName definition. User may have left off the $
414-
// TODO: Full AST parsing to validate the name
415398
private readonly string NewName = newName.TrimStart('$').TrimStart('-');
416399

417400
// Wire up our visitor to the relevant AST types we are potentially renaming

0 commit comments

Comments
 (0)