Skip to content

Commit eb07fc7

Browse files
committed
Syntax: Add exit condition when determining test extends
Fixes #248.
1 parent 6214c53 commit eb07fc7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

plugins_/syntaxtest_dev.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,15 +381,19 @@ def determine_test_extends(self, lines, line, start_col):
381381
view.scope_name(pos)
382382
for pos in range(line.begin() + col_start, line.begin() + col_end)
383383
}
384-
base_scope = path.commonprefix(list(scopes))
384+
base_scope = path.commonprefix(list(scopes)).strip()
385+
l.debug("Original base scope: %r", base_scope)
385386

386387
length = 0
387388
for pos in range(line.begin() + col_end - 1, line.end() + 1):
388389
scope = view.scope_name(pos)
389390
if scope.startswith(base_scope):
390391
scopes.add(scope)
391392
length += 1
393+
else:
394+
break
392395

396+
l.debug("Total scopes covered: %r", scopes)
393397
return length, scopes
394398

395399

0 commit comments

Comments
 (0)