I think this might be bad and I should feel bad.
But could someone tell me if this is crazy for a completions plugin?
Specifically the part where I add “<” (less than sign) into the array using for item in html.
[pre=#141414] if ch != ‘<’:
html = ((list(item)-2],"<" + list(item)1]) for item in html])[/pre]
I’m just covering my bases since a lot of folks are using this plugin I’d hate to have to revert these changes later.
Here is the plugin example:
[pre=#141414]class HtmlTagCompletions(sublime_plugin.EventListener):
def on_query_completions(self, view, prefix, locations):
-
#** restrict scope somewhere here*
-
#** array list tags etc...* html = ("FOOTER\tTag", "FOOTER>$1</FOOTER>"), ("HEADER\tTag", "HEADER>$1</HEADER>"), ("NAV\tTag", "NAV>$1</NAV>"), ("SECTION\tTag", "SECTION>$1</SECTION>"), ("VIDEO\tTag", "VIDEO>$1</VIDEO>") ] pt = locations0] - len(prefix) - 1 ch = view.substr(sublime.Region(pt, pt + 1)) if ch != '<': html = ((list(item)-2],"<" + list(item)1]) for item in html]) return html, sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS[/pre]
Thanks in advance!