Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 426910

Summary: [outliner] Scroll and reveal should scroll to start of selection, not the end
Product: [ECD] Orion Reporter: Curtis Windatt <curtis.windatt.public>
Component: JS ToolsAssignee: Curtis Windatt <curtis.windatt.public>
Status: RESOLVED WONTFIX QA Contact:
Severity: minor    
Priority: P3 CC: Michael_Rennie
Version: 5.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Fix to select only the opening bracket none

Description Curtis Windatt CLA 2014-01-29 11:01:42 EST
1) Open a file with large closures (ex: occurrences.js in the js plug-in)
2) Ctrl-O to open the outliner
3) Click on a closure {...} entry
Result:
The closure is selected and the editor scrolls to the end of the selection.

When you click on a function or a closure, you expect to see the beginning of the selection, where is it defined.
Comment 1 Curtis Windatt CLA 2014-01-29 11:15:26 EST
I'm not seeing a way to accomplish this.  The selection service has no concept of whether to reveal or not, nevermind what to reveal.

We could work around this by just selecting the start of the closure.  We currently do this for named function declarations (just select the name).
Comment 2 Curtis Windatt CLA 2014-01-29 12:14:27 EST
Moving to JS Tools as we can simply consider changing the selection for closures.  We already select the identifier for functions and the return keyword.

I'll attach a patch which changes the selection to just the opening bracket.

Mike, let me know what you think.  The reveal is much better, but the selection looks odd and isn't always immediately noticeable.
Comment 3 Curtis Windatt CLA 2014-01-29 12:15:25 EST
Created attachment 239437 [details]
Fix to select only the opening bracket
Comment 4 Michael Rennie CLA 2014-01-30 10:20:04 EST
(In reply to Curtis Windatt from comment #3)
> Created attachment 239437 [details]
> Fix to select only the opening bracket

It is *much* better, especially in the Orion code where the first closure selects pretty much the whole file.

Like you mentioned though, it is hard to notice the one char selection. Perhaps you could select the entire statement the object 'belongs' to?

For example:

Foo.bar({...


});

would select 'Foo.bar({...'

Foo.bar(function({...


}));

would select 'function({...'

This should be pretty simple to do since we are currently on the parent node when we compute the signature / ranges in the outliner.
Comment 5 Michael Rennie CLA 2014-02-06 15:22:34 EST
(In reply to Michael Rennie from comment #4)

> This should be pretty simple to do since we are currently on the parent node
> when we compute the signature / ranges in the outliner.

I'm going to defer this until 6.0. Curtis and I chatted about it and tried selecting other items, but none of it felt quite right.
Comment 6 Curtis Windatt CLA 2014-07-31 15:37:11 EDT
Selecting the entire statement is possible if we have the parent.  However, we do not always have a parent node available.  Inconsistent ranges would be worse than selecting the whole closure so I'm marking this as WONTFIX.