Hi there -
I seem to be missing something - I’ve created an autocomplete plugin that works, but doesn’t show the popup with the list of choices - only works to tab through the possibilities.
Is there a tutorial somewhere? Am I missing a setting? I started with the Google autocomplete example, and man, everything looks the same.
Here’s the code:
[code] import sublime_plugin, sublime, re
class LangCompletions(sublime_plugin.EventListener):
def on_query_completions(self, view, prefix, locations):
pt = locations[0] - len(prefix) - 2
ch = view.substr(sublime.Region(pt, pt + 2))
if ch != '##':
return ]
pattern = re.compile( 'LG\_.' )
if re.match( pattern, prefix ):
handle = file( 'text-file-with-LG_-stuff.txt', 'rb')
pattern = re.compile( prefix )
results = ]
for line in handle.readlines():
match = re.match( pattern, line )
if match:
langkey = line.split( '=' )
value = langkey[0] + '##'
display = '##' + value
results.append( ( display, value ) )
results.sort()
return results
return 0
[/code]
Anything missing?