Bug 272628 - [preferences][syntax coloring] Syntax coloring needs new analysis and elements
Summary: [preferences][syntax coloring] Syntax coloring needs new analysis and elements
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.4.2   Edit
Hardware: All All
: P5 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-17 00:13 EDT by Karsten Wutzke CLA
Modified: 2009-04-17 04:09 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Karsten Wutzke CLA 2009-04-17 00:13:37 EDT
Build ID: M20090211-1700

Steps To Reproduce:
1. Hit the preferences window Window -> Preferences
2. Hit Java -> Editor -> Syntax Coloring.

I have three (two?) things here:

1. In the preview window the example class name is called "ClassName", a bit to the right the implemented interface is named "Interface". This should be "InterfaceName". It also confuses you at first because "interface" is a reserved Java keyword.

2. Expand the "Java" tree node to the right in the box. I would like to see if the method parameter types can be set as an independent option, too. Search for "Parameter variables" an toggle the Enable checkbox to see where I am in the preview code. The "Parameter type" (class name) should be configurable as well.

Maybe these are just missing in the "Classes" configuration element. As you toggle it, you'll see that they don't change when toggled. Same holds true for the <E> generic after the ClassName and for the local non-static field, which aren't changed when toggled. As the Parameter type is a class here as well it could also be added to the "Classes" element to resolve the problem. (?)

BTW: "Type arguments" affects the interface's generic <String> but not the class' <E> generic. This strangely gets changed by the "Type variables" element, which is meant for local variable types only. -> did anyone mix the "Type variables" and "Type arguments" elements by mistake (for the <> generics only)?

More information:
The syntax coloring analysis isn't complete IMHO. In the box to the right (expanded Java tree node), the elements follow no real rule, only halfway. The elements for static fields, non-static fields, local variables, parameters, and methods should follow a structure. They usually have a type, a name, and references/invocations.

With static fields you should have the choice of

1. "Static field names" (currently called "Static fields")
2. "Static field types" (currently set via the general "Classes" or "Interfaces" element)
3. "Static field references" (missing)

With non-static fields you should have the choice of

1. "Field names" (currently called "Fields")
2. "Field types" (currently set via the "Type variables" element)
3. "Field references" (missing)

With local variables you should have the choice of

1. "Local variable names" (missing)
2. "Local variable types" (currently set via the "Local variable declarations" element)
3. "Local variable references" (the only correctly named element thus far)

With (method) parameters you should have the choice of

1. "Parameter names" (currently set via the "Parameter variables" element)
2. "Parameter types" (currently set via the general "Classes" or "Interfaces" element)
3. "Parameter references" (missing)

With methods you should have the choice of

1. "Method names" (currently set via the general "Methods" element)
2. "Method (return) types" (currently set via the general "Classes" or "Interfaces" element)
3. "Method invocations" (currently set via the general "Methods" element)

I might expand the list more, but you get the idea.

Some more notes:

1. I'm basically against using "... declaration" for naming elements. A declaration usually consists of two things: a type and a name. Thus, declaration is not a good term for single elements. Instead of "name" the technically more accurate term is "identifier" (though I find "name" easier to understand).

2. The syntax coloring example code snippet lacks some elements to demonstrate everything. For example, there should be a local variable with a class type. Furthermore, I'd like to see references to static fields, non-static fields, local variables, and parameters.

I know that the whole topic is pretty complicated as elements usually collide with each other, like autoboxing, because every static field, non-static field, parameter, and local variable can be used to auto(un)box, too. How this is handled is up to you. My input is a head start into the problem.
Comment 1 Dani Megert CLA 2009-04-17 04:06:48 EDT
Fixed item 1.