print erroneous snippet location

This commit is contained in:
Stanislav Seletskiy 2015-10-21 14:22:05 +06:00
parent 698f2d4910
commit 08b96cbdb2
2 changed files with 12 additions and 0 deletions

View File

@ -121,12 +121,14 @@ class SnippetDefinition(object):
exec(code, {'snip': snip}) exec(code, {'snip': snip})
except Exception as e: except Exception as e:
e.snippet_info = textwrap.dedent(""" e.snippet_info = textwrap.dedent("""
Defined in: {}
Trigger: {} Trigger: {}
Description: {} Description: {}
Context: {} Context: {}
Pre-expand: {} Pre-expand: {}
Post-expand: {} Post-expand: {}
""").format( """).format(
self._location,
self._trigger, self._trigger,
self._description, self._description,
self._context_code if self._context_code else '<none>', self._context_code if self._context_code else '<none>',

View File

@ -304,3 +304,13 @@ class ParseSnippets_PrintErroneousSnippetPostAction(_VimTest):
keys = 'test' + EX keys = 'test' + EX
wanted = keys wanted = keys
expected_error = "Post-expand: asd" 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"