Opened 12 years ago

Last modified 11 years ago

#165 new enhancement

Symbol Completion Improvements

Reported by: alms Owned by: gb
Priority: minor Milestone:
Component: IDE Version:
Keywords: Cc: gz@…

Description

Some improvements to symbol completion suggested by Hamilton or inspired by his suggestions in e-mail of 10/31/07.

  • Symbol completion should be context sensitive. The simplest piece of this is having it understand packages, i.e. only suggest completions that are accessible in the current package, or at least prioritize them. (I guess it could also suggest completions from other packages but prepend the package prefix.)
  • History. Recently chosen completions and recently typed symbols should be prioritized.
  • Fancier context sensitivity could take into account arbitrarily complex things about the current editing context, e.g. if you type "(setf (slot-" and then ask for completions, "slot-value" makes sense as a completion, while "slot-missing" probably doesn't.
  • If you pause when typing, a menu of possible completions pops up at the insertion point. Scroll up and down (using arrow keys, or some other defined keystrokes) and then accept the completion you want with some other keystroke. To do Hamilton one better, make the menu translucent so it doesn't obscure you code. So as you're typing, when you slow down translucent completions appear as overlays in the editor window. In that case, you wouldn't even necessarily need to wait for much of a pause (maybe make the pause length a preference). ("Menu" maybe the wrong term for this UI element. I'm thinking of something very unobtrusive, like a tooltip.)

Change History (4)

comment:1 Changed 12 years ago by joswig

What is are the completion commands? Asking Hemlock's Apropos does not find it.

foo:a -> complete only external symbols foo::a -> complete all internal symbols in package foo foo::a -> with modifier, complete all internal symbols in package foo, including inherited a -> complete in current package a -> with modifier complete in all packages :foo -> complete only keywords d-b -> complete substrings, here to DESTRUCTURING-BIND (make-instance 'a -> complete only class names (let ((foo 'bar)) (baz f -> complete with higher preference for context (in-package "F -> complete package names (f -> complete functions, macros, special forms, ... also insert the arglist, not just the symbol.

Apple also has a system-wide completion: option-escape . See their visual interface.

Xcode has a little transparent box with a list of completions. For each completion the category (class, function, ...) is shown as a small icon and you can see the return type. You can change the sort order of the list with a small button: best guess, alphabetically.

Also checkout the research assistant floating window: http://www.macresearch.org/files/Xcode_IB_Intro/019.jpg

comment:2 Changed 12 years ago by gz

  • Cc gz@… added

Symbol completion is invoked by meta-/ or meta-` or m-x Expand Dynamic Abbreviation, as of changeset r7540.

I guess one more useful enhancement would be to include the word "completion" in the command name...

comment:3 Changed 12 years ago by joswig

Just trying out meta-/ Clozure CL crashed. Can't reproduce that though. Can we get Clozure CL more robust against these kinds of problems - like catching the exception and providing a restart?

How does completion in the Hemlock command line work? Is there one?

Other completions:

/Us -> should do pathname completion ~/f -> should do pathname completion ./f -> should do pathname completion ../f -> should do pathname completion

comment:4 in reply to: ↑ description Changed 11 years ago by alexander

Replying to alms:

you can find MCL versions doing most of this. Some of the code has already been ported to CCL (>= 1.2):

  • Symbol completion should be context sensitive. The simplest piece of this is having it understand packages, i.e. only suggest completions that are accessible in the current package, or at least prioritize them. (I guess it could also suggest completions from other packages but prepend the package prefix.)

done: search cascades from local package to other packages, exported first then internal.

  • History. Recently chosen completions and recently typed symbols should be prioritized.

suggest preference. Recently typed symbols, e.g. local variables are mostly limited to their lexical scope which can be somewhat correlated to recency but then I would want them to be forgotten once I leave that lexical scope, e.g., when finishing function containing them.

  • Fancier context sensitivity could take into account arbitrarily complex things about the current editing context, e.g. if you type "(setf (slot-" and then ask for completions, "slot-value" makes sense as a completion, while "slot-missing" probably doesn't.

That would be cool. Not sure more many similar cases there would be.

  • If you pause when typing, a menu of possible completions pops up at the insertion point. Scroll up and down (using arrow keys, or some other defined keystrokes) and then accept the completion you want with some other keystroke. To do Hamilton one better, make the menu translucent so it doesn't obscure you code. So as you're typing, when you slow down translucent completions appear as overlays in the editor window. In that case, you wouldn't even necessarily need to wait for much of a pause (maybe make the pause length a preference). ("Menu" maybe the wrong term for this UI element. I'm thinking of something very unobtrusive, like a tooltip.)

done: we have a version for CCL 1.2 (anticipatory symbol completion) including transparency using transparent windows, pause length is a preference, no menu but partial completion (using ...) and other features.

suggested action: explore http://www.agentsheets.com/lisp/Clozure_CL/ consider integration

Note: See TracTickets for help on using tickets.