From 6c210e26fed3b9a612104218b7b73e451bb12c27 Mon Sep 17 00:00:00 2001 From: "rygwdn@gmail.com" <> Date: Mon, 28 Feb 2011 23:31:32 -0400 Subject: [PATCH] fixes bug #720611 by keeping track of which filetypes have been tried. --- plugin/UltiSnips/__init__.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/plugin/UltiSnips/__init__.py b/plugin/UltiSnips/__init__.py index 9709a90..699a59a 100644 --- a/plugin/UltiSnips/__init__.py +++ b/plugin/UltiSnips/__init__.py @@ -1010,7 +1010,7 @@ class SnippetManager(object): if p not in self._snippets: self._load_snippets_for(p) - def _find_snippets(self, ft, trigger, potentially = False): + def _find_snippets(self, ft, trigger, potentially = False, seen=None): """ Find snippets matching trigger @@ -1024,9 +1024,17 @@ class SnippetManager(object): if not snips: return [] - parent_results = reduce( lambda a,b: a+b, - [ self._find_snippets(p, trigger, potentially) - for p in snips.extends ], []) + if not seen: + seen = [] + seen.append(ft) + + parent_results = [] + + for p in snips.extends: + if p not in seen: + seen.append(p) + parent_results += self._find_snippets(p, trigger, + potentially, seen) return parent_results + snips.get_matching_snippets( trigger, potentially)