Hello.
I’ve created a JavaScript completions list and I’m fairly happy with it so far. I eventually worked out how to persuade it to ignore string, comment and constant scope, and to also display after a dot ‘.’ .
What I would like to do is persuade it that after entering ‘document.’ it should only show document members. Currently it seems to treat the dot as a terminating character, and so shows my full list of completions. Is there a way to do this by amending the completions scope statement, or by adding something to the JavaScript.tmLanguage file?
Alternatively, I’m considering creating a js_completions.py file. I am a programmer - but not in Python. So I would appreciate some guidance as to how I could modify the following to check the word that appears before the ‘.’ (assuming there is one…) ?
[code]class TagCompletions(sublime_plugin.EventListener):
def on_query_completions(self, view, prefix, locations):
# Only trigger within HTML
if not view.match_selector(locations[0],
“text.html - source”):
return ]
pt = locations[0] - len(prefix) - 1
ch = view.substr(sublime.Region(pt, pt + 1))
# I'll change the following to .
if ch != '<':
return ][/code]