Community
Participate
Working Groups
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.
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?
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.
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.