| Summary: | [templates] Code assist not narrowing on templates | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | John Arthorne <john.arthorne> |
| Component: | Text | Assignee: | Tom Hofmann <eclipse> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | Darin_Swanson, jpshack |
| Version: | 3.0 | ||
| Target Milestone: | 3.1 M2 | ||
| Hardware: | PC | ||
| OS: | Windows 2000 | ||
| Whiteboard: | |||
Please investigate. I checked and the same bug is in integration build 0813. Bug still occurs in 20040120 Template completion are managed by JDT/UI Move to JDT/UI The closer only looks at the code completions and ignores templates. *** Bug 55357 has been marked as a duplicate of this bug. *** The problem is that the display string of a template proposals does not necessarily match the start of the text that would be inserted by applying the template. I believe however we could take the template name (the first part of the display string, before the dash) and match it with the current document content to see whether the template proposal is still valid. Added some code to TemplateProposal to allow validation. However, it relies on the context to report the correct offsets for the replacement region, which DocumentTemplateContext does not currently do. It would need to either use a position based approach tracking the content being replaced by applying the template, or use a parsing approach (see JavaContext) to figure out the relevant content. Of course, this is something anyone can do in their respective contexts... Leaving this open since we should eventually integrate this into DocumentTemplateContext. changed the validation code again: now, validate and apply take into account the current offset. This will fix the most annoying problems with validation. Templates will still not support overwriting mode like java templates. reducing priority since most of this is fixed. Added a position based constructor to DocumentTemplateContext. The caller is responsible for (un-)registering the Position with the document, as the context itself does not have the lifecycle for this. fixed > 20040819 |
Build: I20030820 1) Start with: class A { public void foo() { sys } } 2) With the cursor after "sys", invoke code assist. Note that the templates "sysout", "syserr", etc are in the list. 3) Now type the letter "o". The list disappears, although "sysout" is still a valid match. Expect: it will fill in "sysout" since it's the only valid match 4) Delete the letter "o" and invoke code assist again. 5) Type the letter "t". The list narrows to exclude "sysout". 6) With code-assist still up, hit backspace. Now you have "sys" again, but it no longer recommends "sysout" as a possible completion.