diff --git a/python/src/com/jetbrains/python/highlighting/PythonColorsPage.java b/python/src/com/jetbrains/python/highlighting/PythonColorsPage.java index e9cb43405ea1..145327078729 100644 --- a/python/src/com/jetbrains/python/highlighting/PythonColorsPage.java +++ b/python/src/com/jetbrains/python/highlighting/PythonColorsPage.java @@ -118,7 +118,7 @@ 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"+ + " f(s[0].lower())\n"+ "\n"+ "class Foo:\n"+ " tags: List[str]\n" + @@ -130,7 +130,7 @@ public class PythonColorsPage implements ColorSettingsPage, InspectionColorSetti " def makeSense(self, whatever):\n"+ " self.sense = whatever\n"+ "\n"+ - "x = len('abc')\n"+ + "x = len('abc')\n"+ "print(f.__doc__)" ; } diff --git a/python/src/com/jetbrains/python/validation/HighlightingAnnotator.java b/python/src/com/jetbrains/python/validation/HighlightingAnnotator.java index 1dadf823d2ca..15159326d0ac 100644 --- a/python/src/com/jetbrains/python/validation/HighlightingAnnotator.java +++ b/python/src/com/jetbrains/python/validation/HighlightingAnnotator.java @@ -22,6 +22,7 @@ import com.intellij.psi.util.PsiTreeUtil; import com.jetbrains.python.PyTokenTypes; import com.jetbrains.python.highlighting.PyHighlighter; import com.jetbrains.python.psi.*; +import com.jetbrains.python.psi.impl.PyBuiltinCache; import static com.jetbrains.python.psi.PyUtil.as; @@ -65,6 +66,9 @@ public class HighlightingAnnotator extends PyAnnotator { public void visitPyCallExpression(PyCallExpression node) { final PyReferenceExpression callee = as(node.getCallee(), PyReferenceExpression.class); if (callee != null) { + if (!callee.isQualified() && PyBuiltinCache.isInBuiltins(callee)) { + return; + } final ASTNode functionName = callee.getNameElement(); if (functionName != null) { final TextAttributesKey attrKey = callee.isQualified() ? PyHighlighter.PY_METHOD_CALL : PyHighlighter.PY_FUNCTION_CALL; diff --git a/python/testData/highlighting/builtins.py b/python/testData/highlighting/builtins.py index c1a20fae3f83..36aa74f6fe8c 100644 --- a/python/testData/highlighting/builtins.py +++ b/python/testData/highlighting/builtins.py @@ -5,7 +5,7 @@ # predefined decl: green bold # predefined usage: yellow bold -len("") +len("") len = [] # redefine len # no highlight diff --git a/python/testData/highlighting/functionCalls.py b/python/testData/highlighting/functionCalls.py index cbb67c136f29..cc50758754fe 100644 --- a/python/testData/highlighting/functionCalls.py +++ b/python/testData/highlighting/functionCalls.py @@ -2,4 +2,4 @@ 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/testData/highlighting/parametersWithAnnotationsAndDefaults.py b/python/testData/highlighting/parametersWithAnnotationsAndDefaults.py index a2541d38ef7a..fbbeed0f8571 100644 --- a/python/testData/highlighting/parametersWithAnnotationsAndDefaults.py +++ b/python/testData/highlighting/parametersWithAnnotationsAndDefaults.py @@ -1,2 +1,2 @@ def f(p1: int, p2: int = 42): - print(p1, p2) \ No newline at end of file + print(p1, p2) \ No newline at end of file