Created
September 9, 2020 13:37
-
-
Save rchl/f17695d67da31f80cdcea02557e6c8d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sublime | |
import sublime_plugin | |
class CompletionListener(sublime_plugin.ViewEventListener): | |
def on_query_completions(self, prefix, locations): | |
completion_list = sublime.CompletionList() | |
sublime.set_timeout_async(lambda: self._on_query_completions_async(completion_list, locations[0])) | |
return completion_list | |
def _on_query_completions_async(self, completion_list, location): | |
completions = [ | |
sublime.CompletionItem( | |
trigger='createEvent', | |
annotation=' createEvent(const EventCreateInfo &createInfo) const', | |
completion='createEvent(${1:const EventCreateInfo &createInfo})', | |
completion_format=sublime.COMPLETION_FORMAT_SNIPPET, | |
kind=(sublime.KIND_ID_FUNCTION, "m", "Method"), | |
details='' | |
), | |
sublime.CompletionItem( | |
trigger='createEventB', | |
annotation=' createEvent(const vk::EventCreateInfo *pCreateInfo, const vk::AllocationCallbacks *pAllocator, vk::Event *pEvent) const', | |
completion='createEvent(${1:const vk::EventCreateInfo *pCreateInfo}, ${2:const vk::AllocationCallbacks *pAllocator}, ${3:vk::Event *pEvent})', | |
completion_format=sublime.COMPLETION_FORMAT_SNIPPET, | |
kind=(sublime.KIND_ID_FUNCTION, "m", "Method"), | |
details='' | |
), | |
] | |
flags = 0 | |
flags |= sublime.INHIBIT_WORD_COMPLETIONS | |
flags |= sublime.INHIBIT_EXPLICIT_COMPLETIONS | |
flags |= sublime.INHIBIT_REORDER | |
flags |= sublime.DYNAMIC_COMPLETIONS | |
sublime.set_timeout(lambda: completion_list.set_completions(completions, flags=flags)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment