Bug 40252 - [navigation] Outline should highlight member on the current line
Summary: [navigation] Outline should highlight member on the current line
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 38510
Blocks:
  Show dependency tree
 
Reported: 2003-07-16 14:42 EDT by Nick Edgar CLA
Modified: 2003-12-29 15:00 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.