Null guard auto-prefixing of '.' to scopes for backward compatibility

In some cases, packages such as atom-beautify manually construct scope
descriptors with an empty scopes array.
This commit is contained in:
Nathan Sobo
2018-01-16 11:30:27 -06:00
parent 7f408e7791
commit d93565423a

View File

@@ -41,7 +41,7 @@ class ScopeDescriptor
getScopeChain: ->
# For backward compatibility, prefix TextMate-style scope names with
# leading dots (e.g. 'source.js' -> '.source.js').
if @scopes[0].includes('.')
if @scopes[0]?.includes('.')
result = ''
for scope, i in @scopes
result += ' ' if i > 0