Skip to content

Commit 3b9ef4e

Browse files
committed
Changes from CR feedback
1 parent dcab328 commit 3b9ef4e

File tree

4 files changed

+134
-146
lines changed

4 files changed

+134
-146
lines changed

src/services/formatting/ruleOperationContext.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,19 @@
44
namespace ts.formatting {
55

66
export class RuleOperationContext {
7-
constructor(private optionName: string, private checkApplyRuleOperation: { (optionName: string, options: FormatCodeSettings): boolean }, private customContextChecks: { (context: FormattingContext): boolean; }[]) {
8-
}
9-
10-
static Any: RuleOperationContext = new RuleOperationContext(undefined, undefined, []);
7+
private customContextChecks: { (context: FormattingContext): boolean; }[];
118

12-
static Create1(...funcs: { (context: FormattingContext): boolean; }[]) {
13-
return new RuleOperationContext(undefined, undefined, funcs);
14-
}
15-
static Create2(optionName: string, checkApplyRuleOperation: { (optionName: string, options: FormatCodeSettings): boolean }, ...funcs: { (context: FormattingContext): boolean; }[]) {
16-
return new RuleOperationContext(optionName, checkApplyRuleOperation, funcs);
9+
constructor(...funcs: { (context: FormattingContext): boolean; }[]) {
10+
this.customContextChecks = funcs;
1711
}
1812

13+
static Any: RuleOperationContext = new RuleOperationContext();
14+
1915
public IsAny(): boolean {
2016
return this === RuleOperationContext.Any;
2117
}
2218

2319
public InContext(context: FormattingContext): boolean {
24-
if (this.checkApplyRuleOperation && !this.checkApplyRuleOperation(this.optionName, context.options)) {
25-
return false;
26-
}
27-
2820
if (this.IsAny()) {
2921
return true;
3022
}

0 commit comments

Comments
 (0)