vazexqi / CodingSpectator

Watches and analyzes code edits in the Eclipse IDE non-invasively
http://codingspectator.cs.illinois.edu
Other
20 stars 14 forks source link

Selection information captured through quick-assist is wrong #195

Closed vazexqi closed 13 years ago

vazexqi commented 13 years ago
class C1 {
    public static void main(String[] args) {
        int i = 0;
        System.out.println(i);
    }
}

Move the cursor to the position just before variable 'i' in the System.out.println line. Eclipse captures the following information erroneously (all are related to one another):

  1. selection-text (i=0 but should be the empty string since nothing was selected by the user)
  2. selection (would capture the position of i=0)
  3. selection-in-code-snippet (would capture the position of i=0 in the code snippet)
vazexqi commented 13 years ago

This is probably because of how the QuickAssist processes the reference. We suspect that when we invoke it, it tries to resolve the binding for the variable and passes that instead to InlineTempRefactoring. Either variable (i=0 or i in the System.out.println) is a valid argument to the InlineTempRefactoring so it would work. But the selection does not faithfully reflect what the user has selected.

reprogrammer commented 13 years ago

Eclipse doesn't capture the selection information correctly as reported in a comment of issue #146 . However, CodingSpectator now captures the selection information correctly perhaps since we switched to ITypeRoot from the global store (see issue #220).