If you want to enter it manually, just press Ctrl + Down or Ctrl + Up. All text between the current cursor position and the last whitespace character (i.e. spaces, tabs, ...) in the current line is then taken as the word completion base. Now, CoCoA checks its wordlist for any words starting with the word completion base. It then displays the first available completion (if you pressed Ctrl + Down), the last available completion (if you pressed Ctrl + Up) or nothing (if there is no completion available).
If you want to enter it automatically whenever you type more than 3 non-whitespace characters check the entry Autocompleting in the Settings menu or press Ctrl + Insert to toggle autocompletion mode. The entry AC in the status bar indicates whether autocompletion mode is active or not.
After you entered word completion mode you have the following options:
Word completion mode is configurable, i. e. apart from the system wordlist you can create
and load your own wordlists. For this, go to the Settings menu and select Word
completion. This will open the following dialog:
In the current version of CoCoA, wordfiles have the format
Define WriteWordList(PackageName, PackageAlias, FileName) D := OpenOFile(FileName); Functions := Functions(PackageName); For I := 1 To Len(Functions) Do S := Sprint(Functions[I]) + '('; EndPos := Min([I | I In 1..Len(S) And S[I] = '(']); FunctionName := Sum(First(S, EndPos - 1)); If PackageAlias <> '' Then Print PackageAlias, '.' On D; EndIf; Println FunctionName On D; EndFor; EndDefine;For example, you can use
WriteWordList('$cocoa/io', 'IO', 'iopkg_wordlist.txt');to write the names of all functions contained in the IO package to the file iopkg_wordlist.txt which can then be used directly by CoCoA Word Completion. Of course the package must be loaded into CoCoA beforehand.
|Down||-||X||-||Enter word completion mode manually and show the first possible completion.|
|Up||-||X||-||Enter word completion mode manually and show the last possible completion.|
|Down||-||-||-||When in word completion mode, this will show the next possible completion.|
|Up||-||-||-||When in word completion mode, this will show the previous possible completion.|
|Right||-||-||-||When in word completion mode, this will exit word completion mode accepting the last completion shown.|
|Left||-||-||-||When in word completion mode, this will exit word completion mode accepting the last completion shown. Furthermore, this will append () to the completed word. This is very useful for completions that represent function names.|
|Insert||-||X||-||Activates/Deactivates autocompletion mode. The current status is shown in the status bar (AC).|
|-||-||-||When in word completion mode, this will exit word completion mode rejecting the completion. You can also exit word completion mode by resuming normal typing.|