mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-41976 Fix deleting stars from keywords and positional container
(cherry picked from commit 73e4d785ed2e4aa247a5a5dd0f158701bbbee196) IJ-MR-4706 GitOrigin-RevId: 02c17f0a492647083df9fb6af0213a17d0406c8a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3b99571638
commit
5db655539e
+7
-1
@@ -92,7 +92,13 @@ public class SpecifyTypeInPy3AnnotationsIntention extends TypeIntention {
|
||||
boolean createTemplate) {
|
||||
final PyExpression defaultParamValue = parameter.getDefaultValue();
|
||||
|
||||
final String paramName = StringUtil.notNullize(parameter.getName());
|
||||
String paramName = StringUtil.notNullize(parameter.getName());
|
||||
if (parameter.isPositionalContainer()) {
|
||||
paramName = "*" + paramName;
|
||||
}
|
||||
else if (parameter.isKeywordContainer()) {
|
||||
paramName = "**" + paramName;
|
||||
}
|
||||
final PyElementGenerator elementGenerator = PyElementGenerator.getInstance(project);
|
||||
|
||||
final String defaultParamText = defaultParamValue == null ? null : defaultParamValue.getText();
|
||||
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
def fo<caret>o(**x):
|
||||
pass
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
def foo(**x: object<caret>) -> object:
|
||||
pass
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
def fo<caret>o(*x, **y):
|
||||
pass
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
def foo(*x: object<caret>, **y: object) -> object:
|
||||
pass
|
||||
@@ -46,6 +46,16 @@ public class PyAnnotateTypesIntentionTest extends PyIntentionTestCase {
|
||||
doIntentionTest(PyPsiBundle.message("INTN.add.type.hints.for.function", "method"));
|
||||
}
|
||||
|
||||
// PY-41976
|
||||
public void testFunctionKeywordContainerParameter() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-41976
|
||||
public void testFunctionPositionalAndKeywordContainerParameter() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(PyPsiBundle.message("INTN.NAME.add.type.hints.for.function"), LanguageLevel.PYTHON34);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user