1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | Object.defineProperty(exports, "__esModule", { value: true });
|
18 | exports.Severity = void 0;
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
|
24 | const nls_1 = require("./nls");
|
25 | var Severity;
|
26 | (function (Severity) {
|
27 | Severity[Severity["Ignore"] = 0] = "Ignore";
|
28 | Severity[Severity["Error"] = 1] = "Error";
|
29 | Severity[Severity["Warning"] = 2] = "Warning";
|
30 | Severity[Severity["Info"] = 3] = "Info";
|
31 | Severity[Severity["Log"] = 4] = "Log";
|
32 | })(Severity = exports.Severity || (exports.Severity = {}));
|
33 | const error = 'Errors';
|
34 | const warning = 'Warnings';
|
35 | const info = 'Info';
|
36 | const log = 'Log';
|
37 | const ignore = 'All';
|
38 | (function (Severity) {
|
39 | function fromValue(value) {
|
40 | value = value && value.toLowerCase();
|
41 | if (!value) {
|
42 | return Severity.Ignore;
|
43 | }
|
44 | if (['error', 'errors'].indexOf(value) !== -1) {
|
45 | return Severity.Error;
|
46 | }
|
47 | if (['warn', 'warning', 'warnings'].indexOf(value) !== -1) {
|
48 | return Severity.Warning;
|
49 | }
|
50 | if (value === 'info') {
|
51 | return Severity.Info;
|
52 | }
|
53 | if (value === 'log') {
|
54 | return Severity.Log;
|
55 | }
|
56 | return Severity.Ignore;
|
57 | }
|
58 | Severity.fromValue = fromValue;
|
59 | function toDiagnosticSeverity(value) {
|
60 | switch (value) {
|
61 | case Severity.Ignore:
|
62 | return vscode_languageserver_protocol_1.DiagnosticSeverity.Hint;
|
63 | case Severity.Info:
|
64 | return vscode_languageserver_protocol_1.DiagnosticSeverity.Information;
|
65 | case Severity.Log:
|
66 | return vscode_languageserver_protocol_1.DiagnosticSeverity.Information;
|
67 | case Severity.Warning:
|
68 | return vscode_languageserver_protocol_1.DiagnosticSeverity.Warning;
|
69 | case Severity.Error:
|
70 | return vscode_languageserver_protocol_1.DiagnosticSeverity.Error;
|
71 | default:
|
72 | return vscode_languageserver_protocol_1.DiagnosticSeverity.Error;
|
73 | }
|
74 | }
|
75 | Severity.toDiagnosticSeverity = toDiagnosticSeverity;
|
76 | function toString(severity) {
|
77 | switch (severity) {
|
78 | case Severity.Error:
|
79 | return error;
|
80 | case Severity.Warning:
|
81 | return warning;
|
82 | case Severity.Info:
|
83 | return info;
|
84 | case Severity.Log:
|
85 | return log;
|
86 | default:
|
87 | return ignore;
|
88 | }
|
89 | }
|
90 | Severity.toString = toString;
|
91 | function toLocaleString(severity) {
|
92 | if (severity === Severity.Error || severity === error) {
|
93 | return nls_1.nls.localize('theia/core/severity/errors', 'Errors');
|
94 | }
|
95 | else if (severity === Severity.Warning || severity === warning) {
|
96 | return nls_1.nls.localize('theia/core/severity/warnings', 'Warnings');
|
97 | }
|
98 | else if (severity === Severity.Info || severity === info) {
|
99 | return nls_1.nls.localizeByDefault('Info');
|
100 | }
|
101 | else if (severity === Severity.Log || severity === log) {
|
102 | return nls_1.nls.localize('theia/core/severity/log', 'Log');
|
103 | }
|
104 | else {
|
105 | return nls_1.nls.localizeByDefault('All');
|
106 | }
|
107 | }
|
108 | Severity.toLocaleString = toLocaleString;
|
109 | function toArray() {
|
110 | return [ignore, error, warning, info, log];
|
111 | }
|
112 | Severity.toArray = toArray;
|
113 | })(Severity = exports.Severity || (exports.Severity = {}));
|
114 |
|
\ | No newline at end of file |