emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Completions in Semantic


From: Eric M. Ludlam
Subject: Re: Completions in Semantic
Date: Mon, 19 Oct 2009 18:17:08 -0400

On Mon, 2009-10-19 at 16:06 -0400, Stefan Monnier wrote:
> >> You mean like lisp-complete-symbol but modal?
> 
> > Yes, that's what I meant, but in light of your simplified description, I
> > suppose it doesn't matter much.  If there was a single function like
> > 'completing-read' that took arguments to control what proposed text
> > after the cursor was, I suppose it wouldn't matter what happened
> > underneath.  I used overlays and overlay keymaps.
> 
> > You could try semantic-complete-analyze-inline on something that needs
> > completing to see the effect I was going for.  It should work for Lisp
> > or C code.
> 
> > I would expect designing such a thing would be challenging since the
> > rules for what is before the cursor is a bit vague and language
> > specific, so it might belong in a tool like Semantic.
> 
> We have `symbol-complete' although I'm not very happy about its API.
> But something along thses lines would be good.  When I rewrite the
> minibuffer completion code I tried to make it possible to use it in
> non-minibuffer contexts, so for example lisp-complete-symbol nowadays
> uses minibuffer-complete internally.

I was unaware of that, but it sounds useful.

> I also intend to consolidate the comint completion this way, tho it's
> more difficult because its current UI is slightly different.  Part of
> the difficulty is how to determine when the "completion is done" so as
> to know when to pop-down the *Completions* buffer (if any).  Maybe the
> best option is to pop-down *Completions* eagerly ("all the time").

For my completion engine, I used an overlay to wrap the text being
completed.  As soon as the cursor leaves the overlay, or if the user
types a character that doesn't belong in the symbol such as SPC, ., or
other punctuation, then it exists.  The post-command-hook is a bit
complex during the semantic inline completion.  Perhaps that style of
interface could be used, if not directly.

I was going for something where the completion part could activate at
idle time without interfering with regular editing commands.  ie, if the
user was typing away or using point motion, nothing would change, but if
they saw the decoration indicating active completion, they would know
that TAB was special.

A side effect is that a *completions* buffer is not always desired, so
there are some experiments on completion showing that might not need a
buffer, such as the tooltip, or ghost-text.  These options have varying
success in this task.

The semantic complete code for inline stuff uses the same completion and
display engines as the minibuffer or inline prompts, so you can mix and
match the pieces.  Hopefully an official API can do something similar,
so you can complete in the minibuffer or inline with the same functions.

Eric




reply via email to

[Prev in Thread] Current Thread [Next in Thread]