From e529d1e345d0d80da353104330dfb25f6d956e26 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 1 Jul 2015 16:46:09 -0500 Subject: [PATCH] Request contents of buffer when first-mate tags are in a corrupt state --- src/tokenized-buffer.coffee | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/tokenized-buffer.coffee b/src/tokenized-buffer.coffee index 4f4c48ed1..b662de08a 100644 --- a/src/tokenized-buffer.coffee +++ b/src/tokenized-buffer.coffee @@ -391,10 +391,16 @@ class TokenizedBuffer extends Model expectedScope = tag + 1 poppedScope = scopes.pop() unless poppedScope is 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 = new Error("Encountered an invalid scope end id. Popped #{poppedScope}, expected to pop #{expectedScope}.") error.metadata = { grammarScopeName: @grammar.scopeName } + path = require 'path' + error.privateMetadataDescription = "The contents of `#{path.basename(@buffer.getPath())}`" + error.privateMetadata = { + filePath: @buffer.getPath() + fileContents: @buffer.getText() + } throw error scopes