mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Don't highlight first argument as 'self' if it is *args or **kwargs (PY-6108)
This commit is contained in:
@@ -35,14 +35,19 @@ public class HighlightingAnnotator extends PyAnnotator {
|
||||
}
|
||||
|
||||
private static boolean isSelf(PyParameter node, PyFunction function) {
|
||||
boolean isSelf = false;
|
||||
final PyNamedParameter named = node.getAsNamed();
|
||||
if (named != null) {
|
||||
if (named.isPositionalContainer() || named.isKeywordContainer()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
final int index = ArrayUtil.find(function.getParameterList().getParameters(), node);
|
||||
if (function.getContainingClass() != null && index == 0) {
|
||||
final PyFunction.Modifier modifier = function.getModifier();
|
||||
if (modifier != PyFunction.Modifier.CLASSMETHOD && modifier != PyFunction.Modifier.STATICMETHOD) {
|
||||
isSelf = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return isSelf;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user