Sublime Forum

[SOLVED]Autocomplete hide Snippet components

#1

I just found out that you can add snippets within the autocomplete (Awesome, btw). Unfortunately, in the autocomplete window, it displays the $0, $1, etc. Please hide this.

0 Likes

#2

You do that yourself in the tuple returned by on_query_completions. The first item in the tuple is what is displayed to the user, the second item is what is actually inserted. So for example from the code I wrote here

import sublime_plugin
import datetime
class DateCompleter(sublime_plugin.EventListener):
    def on_query_completions(self, view, prefix, locations):
        return 
            ("YYYY-MM-DD", str(datetime.date.today())),
            ("YYYY", str(datetime.date.today().year)),
            ("MM", "%2d" % datetime.date.today().month),
            ("DD", "%2d" % datetime.date.today().day)
        ]
0 Likes

#3

@quarnster,

Awesome! Thanks so much.

0 Likes