mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 06:50:54 +07:00
[kotlin] disable inplace rename if name is invalid in the context language
^KTIJ-28346 fixed GitOrigin-RevId: 8c12ad354c842b1cf9939614ebee4eac056b01fd
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d47a8e432e
commit
ca10f3c066
@@ -1,7 +1,7 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.lang.java;
|
||||
|
||||
import com.intellij.lang.refactoring.RefactoringSupportProvider;
|
||||
import com.intellij.lang.LanguageNamesValidation;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.javadoc.PsiDocComment;
|
||||
import com.intellij.psi.search.LocalSearchScope;
|
||||
@@ -58,6 +58,14 @@ public class JavaRefactoringSupportProvider extends JavaBaseRefactoringSupportPr
|
||||
|
||||
@Override
|
||||
public boolean isMemberInplaceRenameAvailable(@NotNull PsiElement elementToRename, @Nullable PsiElement context) {
|
||||
if (context != null && context.getLanguage() != elementToRename.getLanguage() &&
|
||||
elementToRename instanceof PsiNamedElement namedElement) {
|
||||
String name = namedElement.getName();
|
||||
if (name != null && !LanguageNamesValidation.isIdentifier(context.getLanguage(), name)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return elementToRename instanceof PsiMember || elementToRename instanceof PsiJavaModule || isCanonicalConstructorParameter(elementToRename);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user