GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Fix #2297: guard PrepareRenameHandler against null rename capability by manderse21 · Pull Request #2299 · PowerShell/PowerShellEditorServices ConversationDrafted PR -- PSES PrepareRename/Rename null RenameCapability guard (#2297)Status: PR-READY, NOT SUBMITTED. The fix branch is pushed to Mike's fork:
Opening the PR (fork branch -> upstream PR titlePR body (draft)Summary
The rename provider is new in FixGuard both handlers with a property pattern, so an absent capability is treated as // before public RenameRegistrationOptions GetRegistrationOptions(RenameCapability capability, ClientCapabilities clientCapabilities) => capability.PrepareSupport ? new() { PrepareProvider = true } : new(); // after public RenameRegistrationOptions GetRegistrationOptions(RenameCapability capability, ClientCapabilities clientCapabilities) => capability is { PrepareSupport: true } ? new() { PrepareProvider = true } : new(); TestsAdds a regression test to each handler's test class asserting Validation (performed locally before submission)
Closes #2297.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsThe rename provider added in v4.6.0 (#2292) reads capability.PrepareSupport in GetRegistrationOptions on both PrepareRenameHandler and RenameHandler. The LSP framework passes a null RenameCapability when the client's initialize omits textDocument.rename, so the dereference throws a NullReferenceException during capability registration. The exception leaves the initialize request unanswered and the handshake hangs for any client that legitimately omits the optional rename capability. Guard both handlers with a property pattern (capability is { PrepareSupport: true }) so an absent capability is treated as no prepare support rather than dereferenced. Add regression tests asserting GetRegistrationOptions tolerates a null capability.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pull request overviewNote Copilot was unable to run its full agentic suite in this review. Adds a regression guard for omitted Changes:
Reviewed changesCopilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Comment on lines
+116
to
+124
Collaborator
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reviewers
Copilot code review
Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Uh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. PrepareRename throws NullReferenceException when an LSP client omits therename capability (v4.6.0)
Uh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |