Esempio n. 1
0
 def get_tags():
     loaded = TagFile(tags_file, FILENAME)
     if lang:
         return loaded.get_tags_dict_by_suffix(
             suffix, filters=compile_filters(view))
     else:
         return loaded.get_tags_dict(*files,
                                     filters=compile_filters(view))
Esempio n. 2
0
 def on_query_completions(self, view, prefix, locations):
     if setting('autocomplete'):
         tags_path = find_tags_relative_to(view.file_name())
         if not tags_path or not os.path.exists(tags_path):  # check if a project is open and the .tags file exists
             return []
         results = []
         if sublime.platform() == 'windows':
             # Windows is lack of `grep' and `awk'
             tag_file = TagFile(tags_path, SYMBOL, MATCHES_STARTWITH)
             results = [(a, a) for a in tag_file.get_tags_dict(prefix[0])]
         else:
             # grep tags from project directory .tags file
             f = os.popen("grep -i '^%s' '%s' | awk '{ print $1 }'" % (prefix, tags_path))
             for i in f.readlines():
                 s = i.strip()
                 results.append((s, s))
         results = list(set(results))  # make unique
         results.sort()  # sort
         return results
Esempio n. 3
0
 def get_tags():
     loaded = TagFile(tags_file, FILENAME)
     if lang: return loaded.get_tags_dict_by_suffix(suffix, filters=compile_filters(view))
     else: return loaded.get_tags_dict(*files, filters=compile_filters(view))