-
-
Notifications
You must be signed in to change notification settings - Fork 96
Expand file tree
/
Copy pathNormalizedIDE.ts
More file actions
76 lines (69 loc) · 2.35 KB
/
Copy pathNormalizedIDE.ts
File metadata and controls
76 lines (69 loc) · 2.35 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import type { GeneralizedRange } from "../../types/GeneralizedRange";
import type { TextEditor } from "../../types/TextEditor";
import type FakeConfiguration from "../fake/FakeConfiguration";
import type FakeKeyValueStore from "../fake/FakeKeyValueStore";
import type { FakeIDE } from "../fake/FakeIDE";
import { PassthroughIDE } from "../PassthroughIDE";
import type { FlashDescriptor } from "../types/FlashDescriptor";
import type { IDE } from "../types/ide.types";
import type { QuickPickOptions } from "../types/QuickPickOptions";
export class NormalizedIDE extends PassthroughIDE {
configuration: FakeConfiguration;
keyValueStore: FakeKeyValueStore;
constructor(
original: IDE,
public fakeIde: FakeIDE,
private isSilent: boolean,
) {
super(original);
this.messages = isSilent ? fakeIde.messages : original.messages;
this.configuration = fakeIde.configuration;
this.keyValueStore = fakeIde.keyValueStore;
this.initializeConfiguration();
}
private initializeConfiguration() {
this.configuration.mockConfigurationScope(
{ languageId: "css" },
{ wordSeparators: ["_", "-"] },
true,
);
this.configuration.mockConfigurationScope(
{ languageId: "scss" },
{ wordSeparators: ["_", "-"] },
true,
);
this.configuration.mockConfigurationScope(
{ languageId: "shellscript" },
{ wordSeparators: ["_", "-"] },
true,
);
this.configuration.mockConfiguration("experimental", {
hatStability: this.configuration.getOwnConfiguration(
"experimental.hatStability",
),
keyboardTargetFollowsSelection: false,
});
}
flashRanges(flashDescriptors: FlashDescriptor[]): Promise<void> {
return this.isSilent
? this.fakeIde.flashRanges(flashDescriptors)
: super.flashRanges(flashDescriptors);
}
setHighlightRanges(
highlightId: string | undefined,
editor: TextEditor,
ranges: GeneralizedRange[],
): Promise<void> {
return this.isSilent
? this.fakeIde.setHighlightRanges(highlightId, editor, ranges)
: super.setHighlightRanges(highlightId, editor, ranges);
}
public async showQuickPick(
_items: readonly string[],
_options?: QuickPickOptions,
): Promise<string | undefined> {
return this.isSilent
? this.fakeIde.showQuickPick(_items, _options)
: super.showQuickPick(_items, _options);
}
}