forked from irinazheltisheva/vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproblems.ts
More file actions
50 lines (39 loc) · 1.66 KB
/
problems.ts
File metadata and controls
50 lines (39 loc) · 1.66 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
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Code } from './code';
export const enum ProblemSeverity {
WARNING = 0,
ERROR = 1
}
export class Problems {
static PROBLEMS_VIEW_SELECTOR = '.panel .markers-panel';
constructor(private code: Code) { }
public async showProblemsView(): Promise<any> {
await this.toggleProblemsView();
await this.waitForProblemsView();
}
public async hideProblemsView(): Promise<any> {
await this.toggleProblemsView();
await this.code.waitForElement(Problems.PROBLEMS_VIEW_SELECTOR, el => !el);
}
private async toggleProblemsView(): Promise<void> {
if (process.platform === 'darwin') {
await this.code.dispatchKeybinding('cmd+shift+m');
} else {
await this.code.dispatchKeybinding('ctrl+shift+m');
}
}
public async waitForProblemsView(): Promise<void> {
await this.code.waitForElement(Problems.PROBLEMS_VIEW_SELECTOR);
}
public static getSelectorInProblemsView(problemType: ProblemSeverity): string {
let selector = problemType === ProblemSeverity.WARNING ? 'codicon-warning' : 'codicon-error';
return `div[id="workbench.panel.markers"] .monaco-tl-contents .marker-icon.${selector}`;
}
public static getSelectorInEditor(problemType: ProblemSeverity): string {
let selector = problemType === ProblemSeverity.WARNING ? 'squiggly-warning' : 'squiggly-error';
return `.view-overlays .cdr.${selector}`;
}
}