Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround vscode bug with returning defaultBehavior from prepareRename #70840

Merged
merged 2 commits into from
Nov 16, 2023

Conversation

dibarbet
Copy link
Member

@dibarbet dibarbet commented Nov 15, 2023

VSCode bug here - microsoft/vscode-languageserver-node#1363

Returning an explicit range instead of defaultBehavior works.

Resolves https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1916980

@dibarbet dibarbet requested a review from a team as a code owner November 15, 2023 19:37
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Nov 15, 2023
DefaultBehavior = true,
};
var text = await document.GetTextAsync(cancellationToken).ConfigureAwait(false);
return ProtocolConversions.TextSpanToRange(symbolicRenameInfo.TriggerToken.Span, text);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The range here is the initial range to replace - the client takes this range to prefill the rename dialog with the identifier to rename.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you test that this works properly with things like @foo and we don't get weirdness.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a test. This also appears to work better than before as well. For example, what happened before this change is
image

But now it looks like
image

@davidwengier
Copy link
Contributor

lol, so neither VS nor VS Code handle that response type? So glad we have a spec 😛

@dibarbet dibarbet merged commit 2e5af76 into dotnet:main Nov 16, 2023
19 of 24 checks passed
@dibarbet dibarbet deleted the fix_prepare_rename branch November 16, 2023 00:44
@ghost ghost added this to the Next milestone Nov 16, 2023
@RikkiGibson RikkiGibson modified the milestones: Next, 17.9 P2 Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants