AutoComplete.pb --> AutoComplete_AddFromSorted()
For empty Prefix$, RadixEnumerateAll needs to be called.
Code: Select all
Procedure AutoComplete_AddFromSorted(*Parser.ParserData, Prefix$, *Ignore.SourceItem, SingleModuleOnly)
If *Parser\SortedValid
For Type = 0 To #ITEM_LastSorted
If AutocompleteOptions(Type) And Type <> #ITEM_Constant ; constants are separate
If Type = #ITEM_DeclareModule
; module names are indexed in the main module
; do not show modules if a prefix:: is provided before the word
If SingleModuleOnly = 0
RadixEnumeratePrefix(*Parser\MainModule\Indexed[Type], Prefix$, *AutoCompleteItems())
ForEach *AutoCompleteItems()
If *AutoCompleteItems() <> *Ignore
AutoComplete_AddItem(*AutoCompleteItems())
EndIf
Next *AutoCompleteItems()
EndIf
Else
; other stuff
ForEach AutoCompleteModules()
If Prefix$ <> ""
RadixEnumeratePrefix(*Parser\Modules(UCase(AutoCompleteModules()))\Indexed[Type], Prefix$, *AutoCompleteItems())
Else
RadixEnumerateAll(*Parser\Modules(UCase(AutoCompleteModules()))\Indexed[Type], *AutoCompleteItems())
EndIf
ForEach *AutoCompleteItems()
If *AutoCompleteItems() <> *Ignore
AutoComplete_AddItem(*AutoCompleteItems())
EndIf
Next *AutoCompleteItems()
Next AutoCompleteModules()
EndIf
EndIf
Next Type
EndIf
EndProcedure