atishay / vscode-allautocomplete

Autocomplete from open files for VSCode
MIT License
105 stars 25 forks source link

Don't show duplicates that AllAutoComplete has found #22

Open jackfranklin opened 6 years ago

jackfranklin commented 6 years ago

Hey,

Firstly, thank you for the great work on this plugin! It's improved my workflow a lot :)

I was wondering if it's possible to not include additions from AllAutoComplete in the case that they are duplicates?

e.g, often I'll have a variable, say foo, that is in two files, a.js and b.js. If I'm in a.js, the autocomplete will find foo twice:

This leads to foo being in the autocomplete menu twice. Is there anyway that AllAutoComplete can check if foo is present, before adding it to the autocomplete menu?

Thanks!

atishay commented 6 years ago

VS Code does not have an API to determine the rest of items shown. I can try to be smarter by ignoring words in the current file but that would most likely start ignoring stuff that we do not want ignore like strings. Leaving it open to see if the language server can help (maybe ask for language specific words from the server and ignore them).

jota0222 commented 1 year ago

Hi @atishay, I would also thank you for the excellent extension!

I just gave a brief look to the code and I wondering if you can't simply add a kind of global variable with the list of word you add to the trie and compare them before to be added with trie.add(), or something like that.