Moving SnippetCompletionItem to language/completion

Andreas Pakulat apaku at gmx.de
Sun Sep 13 21:21:51 UTC 2009


On 13.09.09 21:56:43, David Nolden wrote:
> Am Sonntag 13 September 2009 21:04:04 schrieb Milian Wolff:
> > Would it be OK to move the SnippetCompletionItem + the SelectionJumper to
> > language/completion?
> > 
> > I'd like to reuse that code in PHP and I think others could leverage it as
> > well. Especially the SelectionJumper should/could be used in quite a few
> >  more places.
> > 
> > Try it out, create a snippet and put this into it:
> > 
> > for ( int i = 0; i < $max$; ++i ) {
> >   $//code$
> > }
> > 
> > When you execute it, the following text will be inserted / completed:
> > 
> > for ( int i = 0; i < max; ++i ) {
> >   //code
> > }
> > 
> > max and //code have a colored background. max is preselected, typing will
> > replace its contents. use Alt Left/Right for navigation. Esc will close the
> > selection jumper.
> > 
> > I think nearly _every_ code completion item would benefit from the
> >  selection jumper:
> > 
> > function completion for example:
> > ~~
> > void someFunc(type1 arg1, typ2 arg2);
> > // completion could e.g. lead to:
> > someFunc($type1 arg1$, $type2 arg2$)$$
> > ~~
> > 
> > I'd appreciate reviews. Also I think it should be somehow made clearer that
> >  a selection jumper is running - ideas?
> Sounds very good. I have no time for review, but some more ideas:
> - The selection-jumper could be indicated by blinking the current range, 
> similar to a cursor (Should be fairly easy using dynamic smart-range 
> attributes)
> - ALT+left and ALT+right are a bit non-standard for input controls, better 
> would be "TAB" and "shift+TAB"

This would interfere with indentation, so I'm not sure how easily thats
doable. Personally I find alt-left/right ok.

> - Ideally it should be possible to jump from one range to the next using just 
> the normal left/right cursor navigation (For example, one could just listen 
> the text-editor whether the cursor leaves the range, and if yes, jump it to 
> the next one)

That would make even more sense than tab or alt+cursor.

Andreas 

-- 
You will always get the greatest recognition for the job you least like.




More information about the KDevelop-devel mailing list