How to use the vscode-languageserver.DiagnosticSeverity.Information function in vscode-languageserver

To help you get started, we’ve selected a few vscode-languageserver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jonnyboyC / kos-language-server / server / src / config / models / lintRules.ts View on Github external
flattened.push(lintRule);
  return { flat: flattened, tree: lintRule };
}

/**
 * Settable severity
 */
export type SettableSeverity = 'error' | 'warning' | 'info' | 'hint' | 'off';

/**
 * Map from settable severity to diagnostic severity
 */
export const severityMapper = new Map([
  ['error', DiagnosticSeverity.Error],
  ['warning', DiagnosticSeverity.Warning],
  ['info', DiagnosticSeverity.Information],
  ['hint', DiagnosticSeverity.Hint],
]);

/**
 * Lint rules in data form
 */
const lintTemplates: LintRule = {
  rule: 'all',
  level: 'warning',
  diagnostics: [],
  owned: [
    {
      rule: 'scanning',
      level: 'error',
      diagnostics: [DIAGNOSTICS.SCANNER_ERROR],
      owned: [],
github ics-creative / project-japanese-proofreading / src / server.ts View on Github external
function toDiagnosticSeverity(severity) {
  switch (severity) {
    case 0:
      return DiagnosticSeverity.Information;
    case 1:
      return DiagnosticSeverity.Warning;
    case 2:
      return DiagnosticSeverity.Error;
  }
  return DiagnosticSeverity.Information;
}
github forcedotcom / lightning-language-server / packages / lwc-language-server / src / template / linter.ts View on Github external
import { DiagnosticLevel } from '@lwc/errors';
import templateCompiler from '@lwc/template-compiler';
import { TextDocument, Diagnostic, DiagnosticSeverity, Range } from 'vscode-languageserver';
import { DIAGNOSTIC_SOURCE } from '../constants';

const LEVEL_MAPPING: Map = new Map([
    [DiagnosticLevel.Log, DiagnosticSeverity.Information],
    [DiagnosticLevel.Warning, DiagnosticSeverity.Warning],
    [DiagnosticLevel.Error, DiagnosticSeverity.Error],
    [DiagnosticLevel.Fatal, DiagnosticSeverity.Error],
]);

export default function lint(document: TextDocument): Diagnostic[] {
    const source = document.getText();
    const { warnings } = templateCompiler(source, {});

    return warnings.map(warning => {
        const { start = 0, length = 0 } = warning.location || { start: 0, length: 0 };

        return {
            range: toRange(document, start, length),
            message: warning.message,
            severity: LEVEL_MAPPING.get(warning.level),
github juanfranblanco / vscode-solidity / src / solErrorsToDiagnostics.ts View on Github external
export function getDiagnosticSeverity(severity: string): DiagnosticSeverity {
        switch (severity) {
            case 'error':
                return DiagnosticSeverity.Error;
            case 'warning':
                return DiagnosticSeverity.Warning;
            case 'info':
                return DiagnosticSeverity.Information;
            default:
                return DiagnosticSeverity.Error;
        }
    }
github webhintio / hint / packages / extension-vscode / src / utils / problems.ts View on Github external
const webhintToDiagnosticServerity = (severity: Severity): DiagnosticSeverity => {
    switch (severity) {
        case 4:
            return DiagnosticSeverity.Error;
        case 3:
            return DiagnosticSeverity.Warning;
        case 2:
            return DiagnosticSeverity.Hint;
        case 1:
            return DiagnosticSeverity.Information;
        default:
            return DiagnosticSeverity.Information;
    }
};
github jonnyboyC / kos-language-server / server / src / services / analysisService.ts View on Github external
private loadError(range: Range, path: string) {
    return createDiagnostic(
      range,
      `Unable to load script at ${path}`,
      DiagnosticSeverity.Information,
      DIAGNOSTICS.LOAD_ERROR,
    );
  }
github joshuaskelly / vscode-quakec / server / src / language.ts View on Github external
public getDiagnostics(request: TextDocument): Diagnostic[] {
        let program: Program = this.getProgram(request.uri);

        if (!program) {
            return [];
        }

        let diagnostics: Diagnostic[] = [];
        let errors: Error[] = program.getErrors();

        for (let error of errors) {
            let severity: DiagnosticSeverity = [
                null,
                DiagnosticSeverity.Error,
                DiagnosticSeverity.Warning,
                DiagnosticSeverity.Information,
                DiagnosticSeverity.Hint
            ][error.severity];

            let diagnostic: Diagnostic = {
                range: error.range,
                severity: severity,
                message: error.message
            };

            diagnostics.push(diagnostic);
        }

        return diagnostics;
    }
github mrmlnc / vscode-doiuse / src / server.ts View on Github external
function makeDiagnostic(problem): Diagnostic {
	const source = problem.usage.source;
	const message: string = problem.message.replace(/<input>:\d*:\d*:\s/, '');

	const severityLevel = {
		Error: DiagnosticSeverity.Error,
		Information: DiagnosticSeverity.Information,
		Warning: DiagnosticSeverity.Warning
	};

	return {
		severity: severityLevel[editorSettings.messageLevel],
		message,
		range: {
			start: {
				line: source.start.line - 1,
				character: source.start.column - 1
			},
			end: {
				line: source.end.line - 1,
				character: source.end.column
			}
		},
github Polymer / tools / packages / editor-service / src / language-server / converter.ts View on Github external
convertSeverity(severity: Severity): DiagnosticSeverity {
    switch (severity) {
      case Severity.ERROR:
        return DiagnosticSeverity.Error;
      case Severity.WARNING:
        return DiagnosticSeverity.Warning;
      case Severity.INFO:
        return DiagnosticSeverity.Information;
      default:
        throw new Error(
            `This should never happen. Got a severity of ${severity}`);
    }
  }