Merge pull request #16575 from atom/ns-null-guard-scope-prefix

Null guard auto-prefixing of `.` to scopes for backward compatibility
This commit is contained in:
Nathan Sobo 2018-01-16 12:10:26 -07:00 committed by GitHub
commit 9807e56154
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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