Sublime Forum

Autocomplete inside html tags

#1

I’m trying to add autocomplete for the Thymeleaf natural templating (Java) language.

Example:

Hello World


When I enter ‘th’ I would like to get an autocomplete for: th:text="$0"

What I did: Add Thymeleaf.sublime-completions file and add {“selector”: “text.html”, “characters”: “th”} to my auto_complete_triggers User setting.

The completion is working but NOT when I’m inside a HTML tag. Does someone know how I can add completion inside HTML tags?

{
        "scope": "text.html - source - meta.tag, punctuation.definition.tag.begin",
        // "scope": "text.html meta.tag",

        "completions":
        
                { "trigger": "th:if", "contents": "th:if=\"$0\"" },
                { "trigger": "th:else", "contents": "th:else=\"$0\"" }

        ]
}
0 Likes

#2

I tried hard, because I also want to add some custom, no idea how to get it just with that file. It seems we need to use on_query_completions

0 Likes

#3

I created a small plugin that makes it possible: github.com/JeroenVdb/sublime-thymeleaf

Feel free to fork and adapt to your needs (and/or make it better) :smile:

0 Likes

#4

Thanks would come handy at some point! :smile:

0 Likes