Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 339224 - [content assist] ',' does not jump to the next argument if linked position has no proposal
Summary: [content assist] ',' does not jump to the next argument if linked position ha...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: 3.8 M7   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-08 09:03 EST by Markus Keller CLA
Modified: 2012-03-16 10:45 EDT (History)
2 users (show)

See Also:


Attachments
fix (3.85 KB, patch)
2012-03-13 17:40 EDT, Markus Keller CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2011-03-08 09:03:07 EST
I20110307-2110, follow-up to bug 339221 and bug 337156

    void bar(int a, int b) {
    }

    void foo() {
        bar
    }

- have 'Fill method arguments' preference enabled and 'Insert best guessed arguments' selected
- use content assist to complete bar
=> gives "bar(0, 0)" with 2 linked positions but no proposals

- type ','
=> expected: should jump to second linked position
=> was: inserts ','

The problem is that ParameterGuesser#parameterProposals(*) only adds ',' as trigger character when there are actual proposals.

We need a new mechanism to configure jumping to the next position when no proposals list is up. See caller hierarchy of LinkedModeUI#next(). I guess the best solution is to add a "char[] fTriggerChars" to LinkedModeUI and let clients set trigger chars that are handled in LinkedModeUI.KeyListener#verifyKey(*) by invoking next() if the char is a trigger char.
Comment 1 Dani Megert CLA 2012-03-13 04:41:17 EDT
Markus, this needs to be fixed for M6 or deferred to the next release.
Comment 2 Markus Keller CLA 2012-03-13 17:39:58 EDT
Bug 339221 comment 2 shows that a static set of trigger characters is not enough, so there cannot be a generic solution with a "char[] fTriggerChars".

A way to fix this bug could be a new IExitPolicy result that would trigger a call to LinkedModeUI#next(). But there's an easier way without new API:
ParameterGuessingProposal's ExitPolicy can just transform the ',' into a '\t' when we want the special behavior.
Comment 3 Markus Keller CLA 2012-03-13 17:40:40 EDT
Created attachment 212603 [details]
fix
Comment 4 Dani Megert CLA 2012-03-14 09:29:36 EDT
(In reply to comment #2)
> Bug 339221 comment 2 shows that a static set of trigger characters is not
> enough, so there cannot be a generic solution with a "char[] fTriggerChars".
> 
> A way to fix this bug could be a new IExitPolicy result that would trigger a
> call to LinkedModeUI#next(). But there's an easier way without new API:
> ParameterGuessingProposal's ExitPolicy can just transform the ',' into a '\t'
> when we want the special behavior.

Looks good to me.