UNPKG

3.9 kBJavaScriptView Raw
1"use strict";
2// *****************************************************************************
3// Copyright (C) 2019 Ericsson and others.
4//
5// This program and the accompanying materials are made available under the
6// terms of the Eclipse Public License v. 2.0 which is available at
7// http://www.eclipse.org/legal/epl-2.0.
8//
9// This Source Code may also be made available under the following Secondary
10// Licenses when the conditions for such availability set forth in the Eclipse
11// Public License v. 2.0 are satisfied: GNU General Public License, version 2
12// with the GNU Classpath Exception which is available at
13// https://www.gnu.org/software/classpath/license.html.
14//
15// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16// *****************************************************************************
17Object.defineProperty(exports, "__esModule", { value: true });
18exports.Severity = void 0;
19/*---------------------------------------------------------------------------------------------
20 * Copyright (c) Microsoft Corporation. All rights reserved.
21 * Licensed under the MIT License. See License.txt in the project root for license information.
22 *--------------------------------------------------------------------------------------------*/
23const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
24var Severity;
25(function (Severity) {
26 Severity[Severity["Ignore"] = 0] = "Ignore";
27 Severity[Severity["Error"] = 1] = "Error";
28 Severity[Severity["Warning"] = 2] = "Warning";
29 Severity[Severity["Info"] = 3] = "Info";
30 Severity[Severity["Log"] = 4] = "Log";
31})(Severity = exports.Severity || (exports.Severity = {}));
32(function (Severity) {
33 const error = 'Errors';
34 const warning = 'Warnings';
35 const info = 'Info';
36 const log = 'Log';
37 const ignore = 'All';
38 function fromValue(value) {
39 value = value && value.toLowerCase();
40 if (!value) {
41 return Severity.Ignore;
42 }
43 if (['error', 'errors'].indexOf(value) !== -1) {
44 return Severity.Error;
45 }
46 if (['warn', 'warning', 'warnings'].indexOf(value) !== -1) {
47 return Severity.Warning;
48 }
49 if (value === 'info') {
50 return Severity.Info;
51 }
52 if (value === 'log') {
53 return Severity.Log;
54 }
55 return Severity.Ignore;
56 }
57 Severity.fromValue = fromValue;
58 function toDiagnosticSeverity(value) {
59 switch (value) {
60 case Severity.Ignore:
61 return vscode_languageserver_protocol_1.DiagnosticSeverity.Hint;
62 case Severity.Info:
63 return vscode_languageserver_protocol_1.DiagnosticSeverity.Information;
64 case Severity.Log:
65 return vscode_languageserver_protocol_1.DiagnosticSeverity.Information;
66 case Severity.Warning:
67 return vscode_languageserver_protocol_1.DiagnosticSeverity.Warning;
68 case Severity.Error:
69 return vscode_languageserver_protocol_1.DiagnosticSeverity.Error;
70 default:
71 return vscode_languageserver_protocol_1.DiagnosticSeverity.Error;
72 }
73 }
74 Severity.toDiagnosticSeverity = toDiagnosticSeverity;
75 function toString(severity) {
76 switch (severity) {
77 case Severity.Error:
78 return error;
79 case Severity.Warning:
80 return warning;
81 case Severity.Info:
82 return info;
83 case Severity.Log:
84 return log;
85 default:
86 return ignore;
87 }
88 }
89 Severity.toString = toString;
90 function toArray() {
91 return [ignore, error, warning, info, log];
92 }
93 Severity.toArray = toArray;
94})(Severity = exports.Severity || (exports.Severity = {}));
95//# sourceMappingURL=severity.js.map
\No newline at end of file