IntroductionScheme-complete provides a single function, scheme-smart-complete, which you can use for intelligent, context-sensitive completion for any Scheme implementation. |
||
|
The intelligent completion comes from the use of simple Type inference. In many cases this can drastically prune the list of possible completions. For example, given the text |
||
|
||
|
where the cursor is represented by ^, typing tab (or whatever you bind the completion function to) would know that in the default R5RS environment the only possible completion of a procedure returning a string and beginning with "n" is number->string and would complete that for you automatically. |
||
|
Given |
||
|
||
|
completing would fill in "len" as the only possible completion since a number is required as an argument to - and all the standard R5RS bindings are procedures and syntax. |
||
|
Relying on this completion for known type procedures is a handy way to avoid type errors, even before the compilation. In more general cases it's just nice to have basic pruning, such as not completing syntax in a non-operator position. |
||
|
Currently completion inside strings does filename completion, though this may be made for flexible in the future. For Chicken and Gauche, completing after "(use " will complete on all currently installed modules. |
||
InstallationTo use it just load this file and bind that function to a key in your preferred mode: |
||
|
||
|
Alternately, you may want to just bind TAB to the scheme-complete-or-indent function, which indents at the start of a line and otherwise performs the smart completion: |
||
|
||
|
If you use eldoc-mode (included in Emacs), you can also get live scheme documentation with: |
||
|
||
|
You can enable slightly smarter indentation with |
||
|
||
|
which basically ignores the scheme-indent-function property for locally overridden symbols (e.g. if you use the (let loop () ...) idiom it won't use the special loop indentation inside). |
||
|
There's a single custom variable, scheme-default-implementation, which you can use to specify your preferred implementation when we can't infer it from the source code. |
||
|
That's all there is to it. |
||
Download: |
||
History: |
||
|