mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Expect single scope as parameter to scope matcher
This commit is contained in:
@@ -18,24 +18,20 @@ segment
|
||||
|
||||
scope
|
||||
= first:segment others:("." segment)* {
|
||||
return function(scopes) {
|
||||
return function(scope) {
|
||||
var segments = [first];
|
||||
for (var i = 0; i < others.length; i++)
|
||||
segments.push(others[i][1]);
|
||||
for (var i = 0; i < scopes.length; i++) {
|
||||
var scopeSegments = scopes[i].split(".");
|
||||
if (scopeSegments.length < segments.length)
|
||||
continue;
|
||||
var allSegmentsMatch = true;
|
||||
for (var j = 0; j < segments.length; j++)
|
||||
if (!segments[j](scopeSegments[j])) {
|
||||
allSegmentsMatch = false;
|
||||
break;
|
||||
}
|
||||
if (allSegmentsMatch)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
var scopeSegments = scope.split(".");
|
||||
if (scopeSegments.length < segments.length)
|
||||
return false;
|
||||
|
||||
var allSegmentsMatch = true;
|
||||
for (var j = 0; j < segments.length; j++)
|
||||
if (!segments[j](scopeSegments[j]))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user