mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-183578 Next method action navigates on a type parameter of a method
This commit is contained in:
+2
-14
@@ -1,17 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
package com.intellij.codeInsight.navigation;
|
||||
|
||||
@@ -33,7 +21,7 @@ public class JavaMethodNavigationOffsetProvider implements MethodNavigationOffse
|
||||
}
|
||||
|
||||
private static boolean shouldStopAt(PsiElement e) {
|
||||
if (e instanceof PsiMethod || e instanceof PsiClass) return true;
|
||||
if (e instanceof PsiMethod || e instanceof PsiClass && !(e instanceof PsiTypeParameter)) return true;
|
||||
if (e instanceof PsiField) return Registry.is("ide.structural.navigation.visit.fields");
|
||||
return e instanceof PsiJavaToken && e.getParent() instanceof PsiClass && e.textMatches("}");
|
||||
}
|
||||
|
||||
+18
-1
@@ -1,4 +1,6 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
package com.intellij.java.codeInsight.navigation
|
||||
|
||||
import com.intellij.codeInsight.navigation.MethodUpDownUtil
|
||||
@@ -27,4 +29,19 @@ class Foo {
|
||||
assert file.text.indexOf('Local') in offsets
|
||||
assert file.text.indexOf('localMethod') in offsets
|
||||
}
|
||||
|
||||
void "test type parameters are not included"() {
|
||||
def file = myFixture.configureByText('a.java', '''
|
||||
class Foo {
|
||||
<T> void m1(T t) {}
|
||||
}
|
||||
''')
|
||||
def offsets = MethodUpDownUtil.getNavigationOffsets(file, 0)
|
||||
String typeParameterText = "<T>"
|
||||
def start = file.text.indexOf(typeParameterText)
|
||||
def end = start + typeParameterText.length()
|
||||
for (int offset : offsets) {
|
||||
assert offset < start || offset > end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user