diff --git a/python/src/com/jetbrains/python/highlighting/PyHighlighter.java b/python/src/com/jetbrains/python/highlighting/PyHighlighter.java
index 4983d6daac5a..95051458c9a3 100644
--- a/python/src/com/jetbrains/python/highlighting/PyHighlighter.java
+++ b/python/src/com/jetbrains/python/highlighting/PyHighlighter.java
@@ -110,6 +110,7 @@ public class PyHighlighter extends SyntaxHighlighterBase {
public static final TextAttributesKey PY_KEYWORD_ARGUMENT = TextAttributesKey.createTextAttributesKey("PY.KEYWORD_ARGUMENT", PARAMETER);
public static final TextAttributesKey PY_FUNCTION_CALL = TextAttributesKey.createTextAttributesKey("PY.FUNCTION_CALL", FUNCTION_CALL);
+ public static final TextAttributesKey PY_METHOD_CALL = TextAttributesKey.createTextAttributesKey("PY.METHOD_CALL", PY_FUNCTION_CALL);
public static final TextAttributesKey PY_VALID_STRING_ESCAPE = TextAttributesKey.createTextAttributesKey("PY.VALID_STRING_ESCAPE", VALID_STRING_ESCAPE);
diff --git a/python/src/com/jetbrains/python/highlighting/PythonColorsPage.java b/python/src/com/jetbrains/python/highlighting/PythonColorsPage.java
index fc144b431f75..598203eba353 100644
--- a/python/src/com/jetbrains/python/highlighting/PythonColorsPage.java
+++ b/python/src/com/jetbrains/python/highlighting/PythonColorsPage.java
@@ -61,6 +61,7 @@ public class PythonColorsPage implements ColorSettingsPage, InspectionColorSetti
new AttributesDescriptor("'self' parameter", PyHighlighter.PY_SELF_PARAMETER),
new AttributesDescriptor("Keyword argument", PyHighlighter.PY_KEYWORD_ARGUMENT),
new AttributesDescriptor("Function call", PyHighlighter.PY_FUNCTION_CALL),
+ new AttributesDescriptor("Method call", PyHighlighter.PY_METHOD_CALL),
new AttributesDescriptor("Valid escape sequence", PyHighlighter.PY_VALID_STRING_ESCAPE),
new AttributesDescriptor("Invalid escape sequence", PyHighlighter.PY_INVALID_STRING_ESCAPE),
};
@@ -78,6 +79,7 @@ public class PythonColorsPage implements ColorSettingsPage, InspectionColorSetti
.put("param", PyHighlighter.PY_PARAMETER)
.put("kwarg", PyHighlighter.PY_KEYWORD_ARGUMENT)
.put("call", PyHighlighter.PY_FUNCTION_CALL)
+ .put("mcall", PyHighlighter.PY_METHOD_CALL)
.build();
@NotNull
@@ -114,13 +116,13 @@ public class PythonColorsPage implements ColorSettingsPage, InspectionColorSetti
" \"\"\" Syntax Highlighting Demo\n" +
" @param x Parameter\"\"\"\n" +
" s = (\"Test\", 2+3, {'a': 'b'}, x) # Comment\n" +
- " print s[0].lower()\n"+
+ " print s[0].lower()\n"+
"\n"+
"class Foo:\n"+
" def __init__(self):\n" +
" byte_string = 'newline:\\n also newline:\\x0a'\n" +
" text_string = u\"Cyrillic \u042f is \\u042f. Oops: \\u042g\"\n"+
- " self.makeSense(whatever=1)\n" +
+ " self.makeSense(whatever=1)\n" +
" \n" +
" def makeSense(self, whatever):\n"+
" self.sense = whatever\n"+
diff --git a/python/src/com/jetbrains/python/validation/HighlightingAnnotator.java b/python/src/com/jetbrains/python/validation/HighlightingAnnotator.java
index 127ea30be15f..fcc8810eb89f 100644
--- a/python/src/com/jetbrains/python/validation/HighlightingAnnotator.java
+++ b/python/src/com/jetbrains/python/validation/HighlightingAnnotator.java
@@ -17,6 +17,8 @@ package com.jetbrains.python.validation;
import com.intellij.lang.ASTNode;
import com.intellij.lang.annotation.Annotation;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.psi.PsiElement;
import com.intellij.psi.util.PsiTreeUtil;
import com.jetbrains.python.highlighting.PyHighlighter;
@@ -68,8 +70,10 @@ public class HighlightingAnnotator extends PyAnnotator {
if (callee != null) {
final ASTNode functionName = callee.getNameElement();
if (functionName != null) {
- final Annotation annotation = getHolder().createInfoAnnotation(functionName, null);
- annotation.setTextAttributes(PyHighlighter.PY_FUNCTION_CALL);
+ final TextAttributesKey attrKey = callee.isQualified() ? PyHighlighter.PY_METHOD_CALL : PyHighlighter.PY_FUNCTION_CALL;
+ final String message = ApplicationManager.getApplication().isUnitTestMode() ? attrKey.getExternalName() : null;
+ final Annotation annotation = getHolder().createInfoAnnotation(functionName, message);
+ annotation.setTextAttributes(attrKey);
}
}
}
diff --git a/python/testData/highlighting/functionCalls.py b/python/testData/highlighting/functionCalls.py
index ceb746c205c4..c5e823546f55 100644
--- a/python/testData/highlighting/functionCalls.py
+++ b/python/testData/highlighting/functionCalls.py
@@ -1,5 +1,5 @@
-func()
-mod.Class.method()
-chained().calls()
+func()
+mod.Class.method()
+chained().calls().sample()
(foo or bar)()
-len(xs)
\ No newline at end of file
+len(xs)
\ No newline at end of file
diff --git a/python/testSrc/com/jetbrains/python/PythonHighlightingTest.java b/python/testSrc/com/jetbrains/python/PythonHighlightingTest.java
index 7999acae050d..a707a71ae6ad 100644
--- a/python/testSrc/com/jetbrains/python/PythonHighlightingTest.java
+++ b/python/testSrc/com/jetbrains/python/PythonHighlightingTest.java
@@ -367,8 +367,10 @@ public class PythonHighlightingTest extends PyTestCase {
// PY-11418
public void testFunctionCalls() {
final EditorColorsScheme scheme = createTemporaryColorScheme();
- final TextAttributesKey callKey = TextAttributesKey.find("PY.FUNCTION_CALL");
- scheme.setAttributes(callKey, new TextAttributes(Color.green, Color.black, Color.white, EffectType.BOXED, Font.BOLD));
+ final TextAttributesKey funcCallKey = TextAttributesKey.find("PY.FUNCTION_CALL");
+ scheme.setAttributes(funcCallKey, new TextAttributes(Color.green, Color.black, Color.white, EffectType.BOXED, Font.BOLD));
+ final TextAttributesKey methodCallKey = TextAttributesKey.find("PY.METHOD_CALL");
+ scheme.setAttributes(methodCallKey, new TextAttributes(Color.red, Color.black, Color.white, EffectType.BOXED, Font.BOLD));
final TextAttributesKey builtinKey = TextAttributesKey.find("PY.BUILTIN_NAME");
scheme.setAttributes(builtinKey, new TextAttributes(Color.blue, Color.black, Color.white, EffectType.BOXED, Font.BOLD));
doTest();