From 8ea36a6ac523927b59ef4da08c80ba2aa378bcbe Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 1 Jul 2015 13:59:47 -0500 Subject: [PATCH] In invalid scope exception: include grammar metadata, ask for details --- src/tokenized-buffer.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tokenized-buffer.coffee b/src/tokenized-buffer.coffee index e44183489..4f4c48ed1 100644 --- a/src/tokenized-buffer.coffee +++ b/src/tokenized-buffer.coffee @@ -391,7 +391,11 @@ class TokenizedBuffer extends Model expectedScope = tag + 1 poppedScope = scopes.pop() unless poppedScope is expectedScope - throw new Error("Encountered an invalid scope end id. Popped #{poppedScope}, expected to pop #{expectedScope}.") + error = new Error("Encountered an invalid scope end id. Popped #{poppedScope}, expected to pop #{expectedScope}.\nPlease report the grammar and contents of this file so we can fix this.") + error.metadata = { + grammarScopeName: @grammar.scopeName + } + throw error scopes indentLevelForRow: (bufferRow) ->