-
Notifications
You must be signed in to change notification settings - Fork 571
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
Add Inplace Variable Introduce refactoring #1772
Add Inplace Variable Introduce refactoring #1772
Conversation
} | ||
else if (expressions.size() == 1) { | ||
GoExpression expression = ContainerUtil.getFirstItem(expressions); | ||
if (expression == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any chance to have a list of null values here?
30b9eb8
to
a4380fb
Compare
if (!CommonRefactoringUtil.checkReadOnlyStatus(file)) return; | ||
if (editor.getSettings().isVariableInplaceRenameEnabled()) { | ||
final TemplateState templateState = TemplateManagerImpl.getTemplateState(editor); | ||
if (templateState != null && !templateState.isFinished()) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add tooltip
selection-tests are needed return PsiTreeUtil.findElementOfClassAtRange(operation.getFile(), selectionModel.getSelectionStart(), selectionModel.getSelectionEnd(),
GoExpression.class); |
if (element instanceof PsiWhiteSpace || (parenthesesParent != null && parenthesesParent.getRparen() == element)) { | ||
element = file.findElementAt(offset - 1); | ||
} | ||
return element instanceof GoExpression ? (GoExpression)element : PsiTreeUtil.getParentOfType(element, GoExpression.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getNonStrictParentOfType
Cannot perform refactoring: package main
func main() {
println(3<caret>)
} |
Wrong result package main
func main() {
i := test()
}
func test() int {
} |
return true; | ||
} | ||
|
||
private static PsiElement findAnchor(@NotNull List<PsiElement> occurrences) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optimize with PsiTreeUtil.findCommonParent(occurrences)
5d1bb5a
to
f339631
Compare
eb2eba3
to
729aa51
Compare
Refactor and fix Fix test Annotate Introduce Operation
729aa51
to
bc4e128
Compare
…ctoring Add Inplace Variable Introduce refactoring
Needs adding tests and probably introduce using dialog.