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

Fix renames for edited companion objects and case class apply/c… #1169

Merged
merged 2 commits into from Dec 13, 2019

Conversation

@tgodzik
Copy link
Collaborator

tgodzik commented Dec 8, 2019

Fix renames for edited companion objects
Previously, when renaming in a workspace with edited files with macro annotated classes some symbols would not be renamed properly. Now, we make sure that token distance is taken into account in those files.

Fix renaming copy/apply occurrence
Previously, all copy/apply occurences for case classes would be renamed to the new class name. Now, we do not rename those symbols and additionally textDocument/references don't return them.

@@ -113,24 +113,6 @@ final class ReferenceProvider(
info.symbol.owner,
Descriptor.Type(info.displayName)
)
// Returns true if `info` is a synthetic `copy` or `apply` of the occurrence class symbol.
def isCopyOrApplyMethod(info: SymbolInformation): Boolean =

This comment has been minimized.

Copy link
@tgodzik

tgodzik Dec 8, 2019

Author Collaborator

@olafurpg I removed it since it didn't seem intuitive to find apply/copy for case class symbols. I can change that to be behind a flag - I am not sure what was the motivations for adding them to references in the first place 🤔

This comment has been minimized.

Copy link
@olafurpg

olafurpg Dec 8, 2019

Member

The motivation was mostly for testing purposes, to preserve a bijection between definition/references.

I’m fine with removing this behavior but it may require adjustments in ReferenceLspSuite

This comment has been minimized.

Copy link
@tgodzik

tgodzik Dec 8, 2019

Author Collaborator

Fixed the tests in ReferenceLspSuite, should be alright.

@tgodzik tgodzik requested a review from olafurpg Dec 8, 2019
@tgodzik tgodzik force-pushed the tgodzik:fix-companions branch from 318d1fc to 8a61dfd Dec 8, 2019
@tgodzik tgodzik force-pushed the tgodzik:fix-companions branch from 8a61dfd to 3e4987d Dec 10, 2019
Copy link
Member

olafurpg left a comment

LGTM 👍

@olafurpg olafurpg changed the title Fix renames for edited companion objects and case class apply/copy Fix renames for edited companion objects and case class apply/c… Dec 13, 2019
@olafurpg olafurpg merged commit 2475a95 into scalameta:master Dec 13, 2019
11 checks passed
11 checks passed
ubuntu-latest unit tests
Details
windows-latest unit tests
Details
macOS-latest unit tests
Details
Sbt integration
Details
Maven integration
Details
Gradle integration
Details
Mill integration
Details
Pants integration
Details
LSP integration tests
Details
Scala cross tests
Details
Scalafmt/Scalafix/Docs
Details
@tgodzik tgodzik deleted the tgodzik:fix-companions branch Dec 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.