alienhard / SublimeAllAutocomplete

Extend Sublime autocompletion to find matches in all open files of the current window
918 stars 110 forks source link

Forgets variable from current tab in favor of variable.onObject from another (coffee/html) #48

Closed aurimus closed 7 years ago

aurimus commented 8 years ago

This is really strange bug, and requires a bit strange sequence to reproduce. And probably it's a conflict with some other plugin, but here it is:

If you have 2 files: one_file_with.html and another_one_with.coffee script

in html file put: stc.someVar in coffee file: @somevar

now when you are in coffee file and type @som you only get suggestion for stc.someVar and not @someVar ... I got really annoyed by this because it would not suggest a variable from current file.

SublimeText3 on Ubuntu 16.04

canoeberry commented 7 years ago

I am not the author of this plugin, but I encountered this issue while trying to rewrite the all autocomplete plugin myself. The cause of this weirdness is the syntax definition of coffee script (I am using Better Coffeescript plugin, are you?).

I wrote my own plugin which uses view.find_all instead of view.extract_completions. View.extract_completions relies on the syntax definition, but if a single word is tokenized into two words as a result of the syntax implementation, you will get unexpected behavior (like words missing or the last character of a word missing ...).

My implementation does not suffer from this problem, but it also has its own problem that I actually didn't notice until reading your issue. For example, '@' is not considered part of a word, so if you type '@' no completions will show up, but if you type '@s' then 'someVar' will show up as a completion. I wonder if I can determine the set of word characters for a given syntax. Probably not ...

Anyway, I hope this explains what you seem to be seeing.

alienhard commented 7 years ago

@canoeberry thanks for the explanation!