From 318b781d40d68cc2de67a9b37b560d7c2fe84386 Mon Sep 17 00:00:00 2001 From: David van Gemeren Date: Wed, 19 Dec 2018 21:06:50 +0100 Subject: [PATCH] Accept multiple markdown scope names I made a mistake in #177. For whatever reason, I wrote a quick patch in my browser, and obviously, this code would never yield anything useful, _because it is just silly javascript_. The discussion in #185 made me verify my patch. This new patch should actually do something, while I have to admit that I've only verified it via Chrome's console. My test below seems valid enough. ```js const markdownGrammars = ['source.gfm', 'text.md'] let grammarScopeName = 'text.md' markdownGrammars.includes(grammarScopeName) // true grammarScopeName = 'source.js' markdownGrammars.includes(grammarScopeName) // false ``` --- lib/whitespace.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/whitespace.js b/lib/whitespace.js index bfbe9ce..fb35530 100644 --- a/lib/whitespace.js +++ b/lib/whitespace.js @@ -148,8 +148,9 @@ module.exports = class Whitespace { scope: scopeDescriptor }) + const markdownGrammars = ['source.gfm', 'text.md'] const keepMarkdownLineBreakWhitespace = - grammarScopeName === ('source.gfm' || 'text.md') && + markdownGrammars.includes(grammarScopeName) && atom.config.get('whitespace.keepMarkdownLineBreakWhitespace') buffer.transact(() => {