mirror of
https://github.com/alibaba/p3c.git
synced 2025-10-15 15:40:26 +00:00
IDEA插件 函数定义中参数的命名可以检测到非驼峰并高亮,但不能快捷修改。
This commit is contained in:
@@ -27,6 +27,7 @@ import com.intellij.psi.PsiFile
|
|||||||
import com.intellij.psi.PsiIdentifier
|
import com.intellij.psi.PsiIdentifier
|
||||||
import com.intellij.psi.PsiLocalVariable
|
import com.intellij.psi.PsiLocalVariable
|
||||||
import com.intellij.psi.PsiMember
|
import com.intellij.psi.PsiMember
|
||||||
|
import com.intellij.psi.PsiParameter
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -48,7 +49,9 @@ interface AliQuickFix : LocalQuickFix {
|
|||||||
|
|
||||||
fun doQuickFix(newIdentifier: String, project: Project, psiIdentifier: PsiIdentifier) {
|
fun doQuickFix(newIdentifier: String, project: Project, psiIdentifier: PsiIdentifier) {
|
||||||
val offset = psiIdentifier.textOffset
|
val offset = psiIdentifier.textOffset
|
||||||
if (psiIdentifier.parent !is PsiMember && psiIdentifier.parent !is PsiLocalVariable) {
|
val cannotFix = psiIdentifier.parent !is PsiMember
|
||||||
|
&& !(psiIdentifier.parent is PsiLocalVariable || psiIdentifier.parent is PsiParameter)
|
||||||
|
if (cannotFix) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user