Home Download Buy Blog Forum Support

Autocomplete inside html tags

Autocomplete inside html tags

Postby JrnVdb on Mon May 05, 2014 3:49 pm

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

Example: <h1 th:text="Hello World by Thymeleaf">Hello World</h1>
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?

Code: Select all
{
        "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\"" }

        ]
}
JrnVdb
 
Posts: 6
Joined: Fri Jul 12, 2013 12:47 pm

Re: Autocomplete inside html tags

Postby tito on Fri May 09, 2014 3:09 am

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
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 851
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

Re: Autocomplete inside html tags

Postby JrnVdb on Fri May 09, 2014 1:10 pm

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

Feel free to fork and adapt to your needs (and/or make it better) :)
JrnVdb
 
Posts: 6
Joined: Fri Jul 12, 2013 12:47 pm

Re: Autocomplete inside html tags

Postby tito on Fri May 09, 2014 5:03 pm

Thanks would come handy at some point! :)
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 851
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay


Return to Technical Support

Who is online

Users browsing this forum: Google [Bot] and 28 guests