def on_query_completions(self, prefix, locations):
if self.view.match_selector(locations[0], NO_COMPLETION_SCOPES):
return (
[],
sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS
)
if not self.initialized:
self.initialize()
if self.enabled:
reuse_completion = self.is_same_completion(prefix, locations)
if self.state == CompletionState.IDLE:
if not reuse_completion:
self.last_prefix = prefix
self.last_location = locations[0]
self.do_request(prefix, locations)
self.completions = []
elif self.state in (CompletionState.REQUESTING, CompletionState.CANCELLING):
self.next_request = (prefix, locations)
self.state = CompletionState.CANCELLING
elif self.state == CompletionState.APPLYING:
self.state = CompletionState.IDLE
return (
self.completions,
0 if not settings.only_show_lsp_completions
else sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS
)
评论列表
文章目录