Skip to content

Commit

Permalink
группы и и директивы
Browse files Browse the repository at this point in the history
  • Loading branch information
lintest committed Feb 27, 2023
1 parent 5846856 commit 5215433
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
3 changes: 3 additions & 0 deletions src/languages/turbo-gherkin/folding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ export function getCodeFolding(
for (let j = i + 1; j <= lineCount; j++) {
const next = model.getLineToken(j);
if (next.token == VAToken.Section) break;
if (next.token == VAToken.DirectIf) break;
if (next.token == VAToken.DirectElse) break;
if (next.token == VAToken.DirectEndif) break;
if (next.token == VAToken.Empty) continue;
if (next.token == VAToken.Comment) { k = j; continue; }
if (next.token == VAToken.Multiline) { k = j; continue; }
Expand Down
19 changes: 9 additions & 10 deletions src/languages/turbo-gherkin/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,35 +63,34 @@ export function getModelTokens(
token = VAToken.Comment;
}
}
let indent: number;
let indent = 0;
switch (token) {
case VAToken.DirectIf:
directIndent += 1000;
indent = directIndent - 1;
tokens.push({ token, indent });
break;
case VAToken.DirectElse:
indent = directIndent - 1;
tokens.push({ token, indent });
if (directIndent > 0) {
indent = directIndent - 1;
}
break;
case VAToken.DirectEndif:
directIndent -= 1000;
indent = directIndent - 1;
tokens.push({ token, indent });
if (directIndent > 0) {
directIndent -= 1000;
indent = directIndent - 1;
}
break;
case VAToken.Operator:
case VAToken.Asterisk:
indent = 0;
if (matcher.isSection(text)) token = VAToken.Section;
else indent = directIndent + getIndent(text, tabSize);
tokens.push({ token, indent });
break;
default: {
indent = directIndent + getIndent(text, tabSize);
tokens.push({ token, indent });
break;
}
}
tokens.push({ token, indent });
}
return tokens;
}
Expand Down
8 changes: 5 additions & 3 deletions src/languages/turbo-gherkin/syntax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ export function checkSyntax(
}
}
groups.forEach(e => {
for (let i = e.lineNumber + 1; i <= e.folding; ++i) if (steps[i]) {
decorations.push(groupDecoration(e.lineNumber, "vanessa-style-bold"));
break;
for (let i = e.lineNumber + 1; i <= e.folding; ++i) {
if (steps[i]) {
decorations.push(groupDecoration(e.lineNumber, "vanessa-style-bold"));
break;
}
}
});
return { decorations, problems, images };
Expand Down

0 comments on commit 5215433

Please sign in to comment.