Problem statement: If a user sets his cursor to a variable, object, parameter or method, Eclipse highlights all occurences in the editor. Unfortunately, other users cannot see these highlights, which the first user tends to be unaware of and may start talking about the occurences without his/her partner(s) begin able to follow.
Idea: It would be desiderable that all other users in the session could see this occurences marked by that first user.
Considerations:
- There should be no interference between remote and local highlights.
- If two or even more developers simultaneously set their cursor on a variable, those highlights could get confusing. To the very least, each highlight should be traceable to the user from whom it originated, e.g. by coloring it accordingly. Overall, this needs to be tried out practically -- maybe this feature should be limited to the follow mode?
- Eclipse allows to toggle the local feature ("Toggle Mark Occurences", ALT+SHIFT+O). Maybe there should be second toggle button for these remote highlights?
Depending on the entity to highlight this can get very messy. You also have to take into account, that there might be code already highlighted.
We(agsedo team) work on this ticket.
The eclipse method which highlight the occurences is selectAndReveal() in the AbstractTextEditor.class (package org.eclipse.ui.texteditor; in org.eclipse.workbench.texteditor). The problem here is to understand all calls and Models of this "Annotation", how we can change the color and how the highlighting doesnt disappear after another user highlights occurences.
Diff:
Diff:
Diff:
We have got two ideas so far.
In fu_berlin.inf.dpp.editor.internal.LocationAnnotationManager.setSelection we added the following lines:
Option 1:
Option 2:
Both Options lead to the following result:
If the cursor is set to a variable in the remote editor and all the variables occurences are marked, the local editor will mark the variable too. As soon as the local curser is set to an other variable though, the mark of the variable will disappear and the new one will be marked.
We haven't found an option to change the color yet or to solve that problem.
I think here or in the following called methods, it is defenitely the right place to trigger the "mark all occurences of a variable" part, I am just not sure whether this is the right way to solve it.
Last edit: Michaela B 2016-08-24
Patch under review: http://saros-build.imp.fu-berlin.de/gerrit/#/c/3116/