From d4d1e8696248878c1c11095f91c605f0554cd2b9 Mon Sep 17 00:00:00 2001 From: Aaron Schrab Date: Sat, 24 Nov 2012 13:03:28 -0500 Subject: [PATCH] Make Snippet object available to SnippetInstance When a Snippet object creates a SnippetInstance it should pass itself as an argument, so that the instance can later get additional information about the snippet. --- plugin/UltiSnips/__init__.py | 2 +- plugin/UltiSnips/text_objects/_snippet_instance.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin/UltiSnips/__init__.py b/plugin/UltiSnips/__init__.py index 53a3b5f..f8642a7 100644 --- a/plugin/UltiSnips/__init__.py +++ b/plugin/UltiSnips/__init__.py @@ -416,7 +416,7 @@ class Snippet(object): v.append(line_ind + line[tabs:]) v = '\n'.join(v) - si = SnippetInstance(parent, indent, v, start, end, visual_content, + si = SnippetInstance(self, parent, indent, v, start, end, visual_content, last_re = self._last_re, globals = self._globals) return si diff --git a/plugin/UltiSnips/text_objects/_snippet_instance.py b/plugin/UltiSnips/text_objects/_snippet_instance.py index 4cb2158..81c5609 100755 --- a/plugin/UltiSnips/text_objects/_snippet_instance.py +++ b/plugin/UltiSnips/text_objects/_snippet_instance.py @@ -15,12 +15,12 @@ class SnippetInstance(EditableTextObject): also a TextObject because it has a start an end """ - def __init__(self, parent, indent, initial_text, start, end, visual_content, last_re, globals): + def __init__(self, snippet, parent, indent, initial_text, start, end, visual_content, last_re, globals): if start is None: start = Position(0,0) if end is None: end = Position(0,0) - + self.snippet = snippet self._cts = 0 self.locals = {"match" : last_re}