I am trying to make a plugin that will remove duplicate / or specific words from showing on the auto-complete popup. For example var_dump
like in the image below, should not appear.
So I created the following script. But don’t understand how to replace the region / rebuild the index / or what is needed to remove/hide that word.
import sublime
import sublime_plugin
import re
class TestPlugin(sublime_plugin.EventListener):
def on_query_completions(self, view, prefix, locations):
remove_duplicates = ['var_dump']
region = sublime.Region(0, view.size())
visible_region = view.visible_region()
content = view.substr(region)
for duplicate in remove_duplicates:
content = re.sub(duplicate+"(\(.*?\);)", '', content)
print(content)
#view.replace(self, visible_region, content)
#view.erase(self.edit, sublime.Region(0, view.size()))
#regions = view.get_regions()
#print(regions)