Bug 40252

Summary: [navigation] Outline should highlight member on the current line
Product: [Eclipse Project] JDT Reporter: Nick Edgar <n.a.edgar>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, hudsonr
Version: 3.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Bug Depends on: 38510    
Bug Blocks:    

Description Nick Edgar CLA 2003-07-16 14:42:14 EDT
build I20030715

In the following class, position the caret in the field declarations, either at 
column 0 or after the ;.

public class Test {
	int i;
	char c;
	Object o;
}

The outline selects Test, not the field.
This is because the caret is outside the strict range of the field declarations.
However, my mental model as a user is that I'm more interested in the field 
than in the class (particularly since the text editor highlights the line for 
me).

Suggest trying to find a matching declaration on the same line as the caret 
before going to the outer declaration.
Comment 1 Dani Megert CLA 2003-07-21 06:34:02 EDT
Where is you mental model here:
char c;<cursor>char b;
?
There might also be spaces and newlines between char c; and char b; - should we
take the minimal distance? Let's say you have

import x.y.z;
<newline>
<caret>
<newline>
<newline>
plublic class Test

Would you expect that the import gets selected?
Comment 2 Nick Edgar CLA 2003-07-25 11:42:08 EDT
For multiple declarations on the same line, I think it could either look 
forward or backward.  That is, either extend the range of c to the start of b, 
or extend range of b to the end of c.  I think the "nearest" heuristic would be 
confusing.  

For package declarations, imports and secondary types, if you're within range 
of the declaraiton (or on the same line), then I think it should select the 
primary type.

Comment 3 Randy Hudson CLA 2003-12-29 15:00:27 EST
If you find the element at (offset-1), and it is contained by the element 
at 'offset', then the heuristic could favor the nested (i.e. smaller, more 
specific) element.  The mental model being that the user considers the caret 
to be between to locations, and not *on* a location.