mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
added return type annotation completion for method overriding
This commit is contained in:
committed by
Aleksei Kniazev
parent
ba9e513e96
commit
dff84e5cf5
+3
@@ -66,6 +66,9 @@ public class PySuperMethodCompletionContributor extends CompletionContributor {
|
||||
for (PyFunction superMethod : ancestor.getMethods()) {
|
||||
if (!seenNames.contains(superMethod.getName())) {
|
||||
String text = superMethod.getName() + superMethod.getParameterList().getText();
|
||||
if (languageLevel.isAtLeast(LanguageLevel.PYTHON35) && superMethod.getAnnotation() != null) {
|
||||
text += " " + superMethod.getAnnotation().getText();
|
||||
}
|
||||
LookupElementBuilder element = LookupElementBuilder.create(text);
|
||||
result.addElement(TailTypeDecorator.withTail(element, TailType.CASE_COLON));
|
||||
seenNames.add(superMethod.getName());
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
class Parent:
|
||||
def overridable_method(param: str) -> Dict[str, str]:
|
||||
pass
|
||||
|
||||
|
||||
class Child(Parent):
|
||||
def overridable_method(param: str) -> Dict[str, str]:
|
||||
@@ -0,0 +1,7 @@
|
||||
class Parent:
|
||||
def overridable_method(param: str) -> Dict[str, str]:
|
||||
pass
|
||||
|
||||
|
||||
class Child(Parent):
|
||||
def over<caret>
|
||||
@@ -314,6 +314,10 @@ public class PythonCompletionTest extends PyTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSuperMethodWithAnnotation() {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON35, this::doTest);
|
||||
}
|
||||
|
||||
public void testLocalVarInDictKey() { // PY-2558
|
||||
doTest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user