From: Lluís <xscript@gmx.net>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: eric@siege-engine.com, emacs-devel@gnu.org
Subject: Re: Completions in Semantic
Date: Sun, 01 Nov 2009 17:01:41 +0100 [thread overview]
Message-ID: <868weq8c9m.wl%lluis@fulla.xlab.taz> (raw)
In-Reply-To: <jwveiok8lla.fsf-monnier+emacs@gnu.org>
On Sat, 31 Oct 2009 16:18:17 -0400, Stefan Monnier wrote:
[...]
> > * Completion candidates
> > ** Information Contains whatever information the system could gather
> > about the symbol. When programming with semantic activated, this could
> > be the semantic tag structure.
>
> If you don't know what that info is going to be, then it is useless in
> the generic API since anybody using the generic API will expect to work
> for any kind of candidate and so can't use this value since it has no
> idea what it might be.
I was thinking on a scenario where each completion source provides its own
implementation of "Actions", and "Information" is thus not publicly visible
but for the "Actions".
> > ** Actions
> > Various actions that can be applied on a candidate.
> > This is basically the interface to view the candidate information.
>
> In the generic completion code, we currently have 4 actions:
> test-completion, try-completion, all-completions, and the new
> completion-boundaries (which in the case of function-name completion is
> always trivial).
>
> For reasons of backward compatibility, it's difficult to add new actions
> in the generic code (the new completion-boundaries is the first time we
> add an action since ... before 1993), but one could easily imagine
> adding actions for specific kinds of completions, which could then only
> be used for completion tables that support those extra actions.
So, any higher-level code could attach new actions as it sees fits. That's
just what I was thinking about.
> > **** get-return
> > Return type of the candidate (only meaningful on programming candidates)
> > **** get-arguments
> > Arguments of the candidate (idem)
>
[...]
> All this to say: if you conflate "get-return" and "get-arguments"
> together, you'll get a system that will fit many more languages.
You're right, this might be reduced to something like:
- get-signature
- get-definition
The difference is that the first provides just a type signature, while the
latter provides the whole definition (including the symbol name). But still
it should be selectable whether you want argument names or just types.
On the other hand, if the implementation of all the actions is provided by
each completion source, the "get-*" actions simply are internal
source-specific helpers, and thus out of the question.
[...]
> > *** insert-*
> > Insert "something" at point (cannot think of use-cases where insertion takes
> > place in other places other than point).
>
> I think side-effects have no business being here. Let the client code
> do the insertion, and limit the candidate object to returning the
> info necessary to figure out what to insert.
I completely agree, but like show, this was more on the conceptual level
where you can show and/or insert a specific candidate.
> > * UI
> > ** Types
> > The completion-ui package has implementations for some (if not all) of them.
> > The UI
> > *** buffer
> > Is the current *Completions* buffer.
> > *** minibuffer
> > The completion system used by, e.g., predictive-mode.
> > *** overlay
> > That's the one I prefer, see company-mode as an example.
> > *** others
> > There are many others, like menus, etc.
>
> Or icomplete-mode, yes. These seem to only affect
> minibuffer-completion-help (the standard function that displays the list
> of possible completions, usually in *Completions*). When I use
> completion, I generally try to avoid getting to that point, tho.
Sorry, I don't understand what you mean here.
> This points to a more important aspect: when is this list displayed,
> when is it updated, and when is it brought down. For each kind of
> completion-list, those choices are not always the same
> (e.g. icomplete-mode brings is up right away and updates it after each
> keystroke, whereas what you call "buffer" only brings it up on a few
> specific operations and only updates it on those same operations).
> This behavior-variation depending on the display-style is something that
> makes it trickier to write the generic code.
Ok, I might say something totally stupid, but you just need to map the UI
actions to specific keys, which can be selected by the user. And on the
case of "continuous completion" the specific UI catches all keystrokes to
issue the refresh action (the obvious option is to remap all keys, but I
don't know how is this really implemented).
> > *** start
> > Start the completion process. E.g.:
> > (show current-ui get-return get-name get-arguments)
> > would show the full signature of a function.
>
> I don't understand it: when I start completion, I don't have any
> function chosen yet (that's the whole reason for me to try to complete
> it, usually), so there's no signature to show yet.
Sorry, this was not detailed enough. What I meant is that you somehow tell
the framework that each candidate must be shown as:
return name arguments
> > *** focus
> > Let's the user "highlight" an entry of the possible candidates. It's the
> > good old next/prev in an overlay UI.
> > Focusing an element can trigger other actions. This will mainly be
> > (show <where> ...)
> > The <where> could be any of minibuffer, another buffer, tooltip, etc.
>
> Oh, so "show" is not a method that returns a string, it's a method that
> has some side-effect that hopefully "shows" the candidate? That makes
> more sense now.
Yes, that's the idea I tried to express.
> > *** completion-map
> > Extra actions the user can trigger through keyboard when the completion UI
> > is "active".
> > E.g., i can focus to an interesting symbol and trigger
> > (show some-buffer get-long-help)
>
> That might be tricky to support in a generic way, since depending on the
> UI, it's not necessarily clear where the completion-map should be active
> and with which other keybindings it might collide.
As I see it, there are two types of interfaces:
- in-buffer: this includes overlays, menus, etc.
- in another buffer: the minibuffer is just a specific case of using
another buffer for the completion UI.
In the first case, once started, the user is interacting directly with the
UI: moving focus, triggering "extra actions", etc. This UI can, in turn,
modify the underlying buffer (partial completions, the user who keeps
writing, etc.).
On the second case, the user can indirectly interact with the UI through
its current buffer (e.g., accept completion, stop completion, partial
completion, etc.), or either switch to the completion buffer and trigger
the rest of actions (e.g., move to a specific candidate and trigger the
"show extended help" action).
What I see more problematic is that some actions simply have no meaning in
some specific candidate sources. E.g., yasnippet has no use for a "extended
help" action. But at least, we can always ignore the action if the
source/backend of a specific candidate provides no implementation for it.
Read you,
Lluis
--
"And it's much the same thing with knowledge, for whenever you learn
something new, the whole world becomes that much richer."
-- The Princess of Pure Reason, as told by Norton Juster in The Phantom
Tollbooth
next prev parent reply other threads:[~2009-11-01 16:01 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-18 23:00 Completions in Semantic Chong Yidong
2009-10-18 23:55 ` Miles Bader
2009-10-19 3:50 ` Eric M. Ludlam
2009-10-19 13:48 ` Stefan Monnier
2009-10-19 16:26 ` Eric M. Ludlam
2009-10-19 18:29 ` Stefan Monnier
2009-10-19 19:33 ` Eric M. Ludlam
2009-10-19 20:06 ` Stefan Monnier
2009-10-19 22:17 ` Eric M. Ludlam
2009-10-20 0:07 ` Lennart Borgman
2009-10-30 21:17 ` Toby Cubitt
2009-10-30 21:37 ` Lennart Borgman
2009-10-20 0:14 ` Stefan Monnier
2009-10-20 20:20 ` Eric M. Ludlam
2009-10-21 10:58 ` Lluis
2009-10-21 12:35 ` Eric M. Ludlam
2009-10-21 13:28 ` Lluis
2009-10-21 17:35 ` Eric M. Ludlam
2009-10-22 20:12 ` Stefan Monnier
2009-10-27 21:21 ` Lluis
2009-10-28 0:56 ` Stefan Monnier
2009-10-28 2:25 ` Eric M. Ludlam
2009-10-28 3:23 ` Stefan Monnier
2009-10-29 14:38 ` Lluis
2009-10-31 20:18 ` Stefan Monnier
2009-11-01 16:01 ` Lluís [this message]
2009-11-02 6:12 ` Stefan Monnier
2009-11-02 12:13 ` Eric M. Ludlam
2009-10-22 20:00 ` Stefan Monnier
2009-10-19 23:52 ` Eric M. Ludlam
2009-10-21 14:07 ` Chong Yidong
2009-10-21 16:10 ` Eric M. Ludlam
2009-10-23 1:01 ` Chong Yidong
2009-10-23 1:28 ` Eric M. Ludlam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=868weq8c9m.wl%lluis@fulla.xlab.taz \
--to=xscript@gmx.net \
--cc=emacs-devel@gnu.org \
--cc=eric@siege-engine.com \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).