def launch(self, text_before, visual_content, parent, start, end): indent = self._INDENT.match(text_before).group(0) lines = (self._v + "\n").splitlines() ind_util = IndentUtil() # Replace leading tabs in the snippet definition via proper indenting v = [] for line_num, line in enumerate(lines): if "t" in self._opts: tabs = 0 else: tabs = len(self._TABS.match(line).group(0)) line_ind = ind_util.ntabs_to_proper_indent(tabs) if line_num != 0: line_ind = indent + line_ind v.append(line_ind + line[tabs:]) v = '\n'.join(v) si = SnippetInstance(self, parent, indent, v, start, end, visual_content, last_re = self._last_re, globals = self._globals) return si
def launch(self, text_before, visual_content, parent, start, end): indent = self._INDENT.match(text_before).group(0) lines = (self._v + "\n").splitlines() ind_util = IndentUtil() # Replace leading tabs in the snippet definition via proper indenting v = [] for line_num, line in enumerate(lines): if "t" in self._opts: tabs = 0 else: tabs = len(self._TABS.match(line).group(0)) line_ind = ind_util.ntabs_to_proper_indent(tabs) if line_num != 0: line_ind = indent + line_ind v.append(line_ind + line[tabs:]) v = '\n'.join(v) si = SnippetInstance(self, parent, indent, v, start, end, visual_content, last_re=self._last_re, globals=self._globals) return si