Hi,
I’m trying to add syntax highlight and autocomplete for a markup language which is an extension to HTML so basically it is HTML with a few extra tags.
I’ve created a .tmLanguage file which extends html
<dict>
<key>include</key>
<string>text.html.basic</string>
</dict>
And it seems to be working fine. Now i would like to add autocomplete for the extra tags as HTML has (html_completions.py) so i copied html_completions.py to my package/myml_completions.py
import sublime, sublime_plugin
import re
def match(rex, str):
m = rex.match(str)
if m:
return m.group(0)
else:
return None
# Provide completions that match just after typing an opening angle bracket
class TagCompletions(sublime_plugin.EventListener):
def on_query_completions(self, view, prefix, locations):
# Only trigger within MYML
if not view.match_selector(locations[0], "text.myml - source"):
return ]
pt = locations[0] - len(prefix) - 1
ch = view.substr(sublime.Region(pt, pt + 1))
if ch != '<':
return ]
return (
("myset\tTag", "myset name=\"$1\" value=\"$2\" />")
], sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS)
But it doesn’t seem to work. If i start typing <mys the autocomplete menu does not appear as it does when i edit HTML files and type <for
Any ideea how can i do this?