Skip to content

Instantly share code, notes, and snippets.

@jfcherng
Last active August 10, 2021 05:19
Show Gist options
  • Save jfcherng/17f04a8b749911197a36307341323e7d to your computer and use it in GitHub Desktop.
Save jfcherng/17f04a8b749911197a36307341323e7d to your computer and use it in GitHub Desktop.
Sublime Text 4 demo: CompletionItem (Min ST version: 4073)
import sublime
import sublime_plugin
# @see https://discordapp.com/channels/280102180189634562/280157067396775936/697124502244687984
class CompletionItemDemoListener(sublime_plugin.EventListener):
def on_query_completions(self, view, prefix, locations):
return (
[
sublime.CompletionItem(
trigger="tmartin",
annotation="My annotation",
completion="My completion",
completion_format=sublime.COMPLETION_FORMAT_TEXT,
kind=(sublime.KIND_ID_AMBIGUOUS, "♫", "My kind"),
details="<i>This</i> <u>is</u> <b>details</b>...",
),
],
sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS,
)
{
// "scope": "text.plain",
"completions":
[
{
"trigger": "tmartin",
"contents": "My completion",
"annotation": "My annotation",
"kind": ["ambiguous", "♫", "My kind"],
"details": "<i>This</i> <u>is</u> <b>details</b>...",
},
],
}
@jfcherng
Copy link
Author

jfcherng commented Apr 9, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment