def snip_instance_method(self, snippet): path = self.__get_snip_file_path(snippet.filename) snippet_value = SnippetHelper.replace_variable(snippet.value) snippet_trigger = SnippetHelper.remove_newline_and_tab(snippet.value) if snippet.tag: snippet_value = SnippetHelper.remove_parenthesis(snippet_value) with open(path, 'w') as f: f.write( SnippetHelper.format( snippet=snippet_value, trigger=snippet_trigger, lang=self.lang, desc=self.classname ) ) match_proc = re.compile(r"\bblock\b\s*\}") if match_proc.search(path): block_snippet = Snippet( self.__filename_proc_to_block(snippet.filename), snippet.type, self.__snip_proc_to_block(snippet.value), snippet.tag ) self.snip_instance_method(block_snippet) # re-invoke
def snip_instance_method_with_tag(self, snippet): path = self.__get_snip_file_path(filename) with open(path, 'w') as f: f.write( SnippetHelper.format( snippet=SnippetHelper.remove_parenthesis( SnippetHelper.replace_variable(snippet) ), trigger=SnippetHelper.remove_newline_and_tab(snippet), lang=self.lang, desc=self.classname ) )