Skip to content

Commit

Permalink
Multiple generation of the same tag fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
maciej-zuk committed Apr 27, 2015
1 parent 4baf1eb commit b3673a1
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tagify.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,20 @@ def run(self, quiet=False):
#process opened files
self.process_file_list([view.file_name() for view in self.window.views() if view.file_name()], ctags)

TagifyCommon.taglist = list(ctags.keys())
#make all found occurrences unique across opened files/folders, fix for https://github.com/taigh/sublime-tagify/issues/5
unique_ctags = {}
for tag, regions in ctags.items():
unique_regions = []
unique_path_lineno = set()
for region in regions:
path_lineno = (region['file'], region['line'])
if not path_lineno in unique_path_lineno:
unique_path_lineno.add(path_lineno)
unique_regions.append(region)
unique_ctags[tag] = unique_regions

TagifyCommon.taglist = list(unique_ctags.keys())
if not quiet:
summary = self.window.new_file()
summary.set_name("Tags summary")
summary.run_command("generate_summary", {"data": ctags})
summary.run_command("generate_summary", {"data": unique_ctags})

0 comments on commit b3673a1

Please sign in to comment.