Last active
August 10, 2021 05:19
-
-
Save jfcherng/17f04a8b749911197a36307341323e7d to your computer and use it in GitHub Desktop.
Sublime Text 4 demo: CompletionItem (Min ST version: 4073)
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 | |
# @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, | |
) |
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
{ | |
// "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>...", | |
}, | |
], | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Both of the above examples result in
See Also