forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrulesProvider.ts
More file actions
30 lines (25 loc) · 986 Bytes
/
Copy pathrulesProvider.ts
File metadata and controls
30 lines (25 loc) · 986 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/// <reference path="references.ts"/>
/* @internal */
namespace ts.formatting {
export class RulesProvider {
private globalRules: Rules;
private options: ts.FormatCodeSettings;
private rulesMap: RulesMap;
constructor() {
this.globalRules = new Rules();
const activeRules = this.globalRules.HighPriorityCommonRules.concat(this.globalRules.UserConfigurableRules).concat(this.globalRules.LowPriorityCommonRules);
this.rulesMap = RulesMap.create(activeRules);
}
public getRulesMap() {
return this.rulesMap;
}
public getFormatOptions(): Readonly<ts.FormatCodeSettings> {
return this.options;
}
public ensureUpToDate(options: ts.FormatCodeSettings) {
if (!this.options || !ts.compareDataObjects(this.options, options)) {
this.options = ts.clone(options);
}
}
}
}