From 08b96cbdb25d46df4833fe87cc99ebf10d771eb8 Mon Sep 17 00:00:00 2001 From: Stanislav Seletskiy Date: Wed, 21 Oct 2015 14:22:05 +0600 Subject: [PATCH] print erroneous snippet location --- pythonx/UltiSnips/snippet/definition/_base.py | 2 ++ test/test_ParseSnippets.py | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/pythonx/UltiSnips/snippet/definition/_base.py b/pythonx/UltiSnips/snippet/definition/_base.py index a974334..77c1f63 100644 --- a/pythonx/UltiSnips/snippet/definition/_base.py +++ b/pythonx/UltiSnips/snippet/definition/_base.py @@ -121,12 +121,14 @@ class SnippetDefinition(object): exec(code, {'snip': snip}) except Exception as e: e.snippet_info = textwrap.dedent(""" + Defined in: {} Trigger: {} Description: {} Context: {} Pre-expand: {} Post-expand: {} """).format( + self._location, self._trigger, self._description, self._context_code if self._context_code else '', diff --git a/test/test_ParseSnippets.py b/test/test_ParseSnippets.py index 1b2b327..f9b4d3b 100644 --- a/test/test_ParseSnippets.py +++ b/test/test_ParseSnippets.py @@ -304,3 +304,13 @@ class ParseSnippets_PrintErroneousSnippetPostAction(_VimTest): keys = 'test' + EX wanted = keys expected_error = "Post-expand: asd" + +class ParseSnippets_PrintErroneousSnippetLocation(_VimTest): + files = { 'us/all.snippets': r""" + post_expand "asd()" + snippet test + endsnippet + """} + keys = 'test' + EX + wanted = keys + expected_error = "Defined in: .*/all.snippets"