1.1 --- a/python.editor/src/org/netbeans/modules/python/editor/PythonSemanticHighlighter.java Tue Jun 23 01:41:09 2015 -0700
1.2 +++ b/python.editor/src/org/netbeans/modules/python/editor/PythonSemanticHighlighter.java Sat Jul 04 23:40:14 2015 +0200
1.3 @@ -153,6 +153,10 @@
1.4 OffsetRange range = PythonAstUtils.getNameRange(info, def);
1.5 highlights.put(range, ColoringAttributes.METHOD_SET);
1.6
1.7 + // vararg and kwarg from the function definition line must be handled here, since they
1.8 + // are passed to visit name unlike ordinary arguments.
1.9 + highlightVarargAndKwargs(def);
1.10 +
1.11 ScopeInfo oldScope = scope;
1.12 scope = symbolTable.getScopeInfo(def);
1.13 Object result = super.visitFunctionDef(def);
1.14 @@ -160,6 +164,20 @@
1.15 return result;
1.16 }
1.17
1.18 + private void highlightVarargAndKwargs(FunctionDef def) {
1.19 + Name vararg = def.getInternalArgs().getInternalVarargName();
1.20 + highlightName(vararg, ColoringAttributes.PARAMETER_SET);
1.21 + Name kwarg = def.getInternalArgs().getInternalKwargName();
1.22 + highlightName(kwarg, ColoringAttributes.PARAMETER_SET);
1.23 + }
1.24 +
1.25 + private void highlightName(Name name, EnumSet<ColoringAttributes> color) {
1.26 + if (name != null) {
1.27 + OffsetRange range = PythonAstUtils.getNameRange(info, name);
1.28 + highlights.put(range, color);
1.29 + }
1.30 + }
1.31 +
1.32 @Override
1.33 public Object visitName(Name node) throws Exception {
1.34 String name = node.getInternalId();