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

Rename import alias #1813

Merged
merged 1 commit into from
Aug 25, 2015
Merged

Conversation

auduchinok
Copy link
Contributor

No description provided.

@ignatov
Copy link
Contributor

ignatov commented Aug 20, 2015

Please squash all your commit into one.

@ignatov ignatov added this to the 1.0.0 milestone Aug 20, 2015
@ignatov ignatov self-assigned this Aug 20, 2015
@auduchinok
Copy link
Contributor Author

I've done some resolve fixes and squashed everything into a single commit.

@ignatov ignatov assigned zolotov and unassigned ignatov Aug 24, 2015
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class GoRenameImportSpecProcessor extends RenamePsiElementProcessor {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why're you need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To handle a dot import, couldn't find other way to prevent it from starting renaming and getting exception in MemberInplaceRenamer.
A possible solution is to resolve a dot symbol itself to the import path directory but I don't like the idea and seems like it will lead to another overriding named element logic for import specs.

Copy link
Contributor

Choose a reason for hiding this comment

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

A possible solution is to resolve a dot symbol itself to the import path directory but I don't like the idea and seems like it will lead to another overriding named element logic for import specs.

Yep, it sounds not good. But renaming directory staying on dot is quite strange too. Maybe just restrict renaming of dot? Is this true that if this method returns null then rename refactoring is considered as impossible?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

substituteElementToRename doc says:

@return the element to rename, or null if the rename refactoring should be canceled.

It may show a popup when user tries to rename a dot and return null if you agree with such logic.

Copy link
Contributor

Choose a reason for hiding this comment

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

I thinks it's good

@auduchinok
Copy link
Contributor Author

Added dot renaming case test.

@auduchinok
Copy link
Contributor Author

Added popup for dot import case, squashed into single commit.

@auduchinok auduchinok force-pushed the rename_alias branch 3 times, most recently from ba123af to 4bc2b52 Compare August 25, 2015 13:49
zolotov added a commit that referenced this pull request Aug 25, 2015
@zolotov zolotov merged commit 37b4b37 into go-lang-plugin-org:master Aug 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants