Summary: | [assist] IOB during content assist in scrapbook | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Darin Wright <darin.eclipse> | ||||
Component: | Core | Assignee: | David Audel <david_audel> | ||||
Status: | VERIFIED FIXED | QA Contact: | |||||
Severity: | normal | ||||||
Priority: | P3 | CC: | daniel_megert, eclipse, frederic_fusier | ||||
Version: | 3.2 | ||||||
Target Milestone: | 3.3 M2 | ||||||
Hardware: | PC | ||||||
OS: | All | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
Darin Wright
2006-08-08 13:38:04 EDT
Problem does not occur in 3.2.1, may be a text issue. Looks like the fix to bug 67328 may have caused this problem? As well, there may be an issue in ContextInformationPopup.createContextFrame(...). In the case of the snippet editor, (offset - beginOffset) is negative, which results in the following line setting visibleOffset to a large number (since subtracting a negative number actually adds it). int visibleOffset= fContentAssistSubjectControlAdapter.getWidgetSelectionRange().x - (offset - beginOffset); Moving to text for comment/investigation. Hm, the problems seems to be that the completion proposal created by core has wrong offsets: in the given example, the proposal states a completion offset of 155, but a replaceStart and replaceEnd of 24. Apparently, the completion offset was not stripped of any additional context added by the evalutation context. (In reply to comment #1) > Problem does not occur in 3.2.1, may be a text issue. Context information for parameterized types has newly been introduced for 3.3 M1. Therefore, this was not previously an issue. However, invoking content assist in the following snippet (| == caret) will fail in 3.2 and 20060807: new java.util.ArrayList().contains(|) Moving to jdt-core for comments. As David is in vacation, I'm afraid it will be too late for 3.3 M1. I'll try to investigate a little bit and let you know... Unfortunately the changes is not really easy => reset bug's target Simple test case to highlight this issue (completion is done at |): public class Test { void foo() { new java.util.ArrayList| } } proposal is ArrayList<E> - java.util select it and hit enter complete to new java.util.ArrayList<E>: OK public class Test { void foo() { new java.util.ArrayList<| } } proposal is ArrayList<E> - java.util select it and hit enter: nothing is inserted In the latter case, proposal completionName has no chars and selectionRange is empty... Behavior described in comment 6 are the expected behavior. When 'ArrayList<' is completed the ArrayList type is a proposal and nothing is inserted. The exception occurs only in scrapbook page. The offset of the code snippet isn't correct in EvaluationContext#complete. Created attachment 49329 [details]
Proposed fix
Released for 3.3 M2. Test added CompletionTests_1_5#testEC001() Verified for 3.3 M2 using build I20060918-0010. Note that you need to have preference "Insert single proposition automatically" set to get this exception. Otherwise, proposal is made correctly and exception occurs in log while inserting it... |