Java Code Examples for org.eclipse.lsp4j.DiagnosticSeverity#Error
The following examples show how to use
org.eclipse.lsp4j.DiagnosticSeverity#Error .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XMLValidationSettings.java From lemminx with Eclipse Public License 2.0 | 6 votes |
/** * Returns the <code>noGrammar</code> severity according the given settings and * {@link DiagnosticSeverity#Hint} otherwise. * * @param settings the settings * @return the <code>noGrammar</code> severity according the given settings and * {@link DiagnosticSeverity#Hint} otherwise. */ public static DiagnosticSeverity getNoGrammarSeverity(ContentModelSettings settings) { DiagnosticSeverity defaultSeverity = DiagnosticSeverity.Hint; if (settings == null || settings.getValidation() == null) { return defaultSeverity; } XMLValidationSettings problems = settings.getValidation(); String noGrammar = problems.getNoGrammar(); if ("ignore".equalsIgnoreCase(noGrammar)) { // Ignore "noGrammar", return null. return null; } else if ("info".equalsIgnoreCase(noGrammar)) { return DiagnosticSeverity.Information; } else if ("warning".equalsIgnoreCase(noGrammar)) { return DiagnosticSeverity.Warning; } else if ("error".equalsIgnoreCase(noGrammar)) { return DiagnosticSeverity.Error; } return defaultSeverity; }
Example 2
Source File: AbstractLSPErrorReporter.java From lemminx with Eclipse Public License 2.0 | 5 votes |
/** * Returns the LSP diagnostic severity according the SAX severity. * * @param severity the SAX severity * @return the LSP diagnostic severity according the SAX severity. */ private static DiagnosticSeverity toLSPSeverity(int severity) { switch (severity) { case SEVERITY_WARNING: return DiagnosticSeverity.Warning; default: return DiagnosticSeverity.Error; } }
Example 3
Source File: RdfLintLanguageServer.java From rdflint with MIT License | 5 votes |
private DiagnosticSeverity convertLintProblemLevel2DiagnosticSeverity(ErrorLevel lv) { DiagnosticSeverity severity; switch (lv) { case ERROR: severity = DiagnosticSeverity.Error; break; case WARN: severity = DiagnosticSeverity.Warning; break; default: severity = DiagnosticSeverity.Information; } return severity; }
Example 4
Source File: DiagnosticIssueConverter.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** * Convert the {@link Severity} to a lsp {@link DiagnosticSeverity}. * * Defaults to severity {@link DiagnosticSeverity#Hint}. */ protected DiagnosticSeverity toSeverity(Severity severity) { switch (severity) { case ERROR: return DiagnosticSeverity.Error; case IGNORE: return DiagnosticSeverity.Hint; case INFO: return DiagnosticSeverity.Information; case WARNING: return DiagnosticSeverity.Warning; default: return DiagnosticSeverity.Hint; } }
Example 5
Source File: DdlTokenAnalyzer.java From syndesis with Apache License 2.0 | 5 votes |
public void addException(Token startToken, Token endToken, String errorMessage) { Position startPosition = new Position(startToken.beginLine, startToken.beginColumn); Position endPosition = new Position(endToken.endLine, endToken.endColumn + 1); DdlAnalyzerException exception = new DdlAnalyzerException(DiagnosticSeverity.Error, errorMessage, new Range(startPosition, endPosition)); // $NON-NLS-1$); this.addException(exception); }
Example 6
Source File: BaseDiagnosticsHandler.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
private static DiagnosticSeverity convertSeverity(IProblem problem) { if (problem.isError()) { return DiagnosticSeverity.Error; } if (problem.isWarning() && (problem.getID() != IProblem.Task)) { return DiagnosticSeverity.Warning; } return DiagnosticSeverity.Information; }
Example 7
Source File: WorkspaceDiagnosticsHandler.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
/** * @param attribute * @return */ private static DiagnosticSeverity convertSeverity(int severity) { if (severity == IMarker.SEVERITY_ERROR) { return DiagnosticSeverity.Error; } if (severity == IMarker.SEVERITY_WARNING) { return DiagnosticSeverity.Warning; } return DiagnosticSeverity.Information; }
Example 8
Source File: CodeActionHandler.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
public static IProblemLocationCore[] getProblemLocationCores(ICompilationUnit unit, List<Diagnostic> diagnostics) { IProblemLocationCore[] locations = new IProblemLocationCore[diagnostics.size()]; for (int i = 0; i < diagnostics.size(); i++) { Diagnostic diagnostic = diagnostics.get(i); int problemId = getProblemId(diagnostic); int start = DiagnosticsHelper.getStartOffset(unit, diagnostic.getRange()); int end = DiagnosticsHelper.getEndOffset(unit, diagnostic.getRange()); boolean isError = diagnostic.getSeverity() == DiagnosticSeverity.Error; locations[i] = new ProblemLocationCore(start, end - start, problemId, new String[0], isError, IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER); } return locations; }
Example 9
Source File: LanguageServerCompilerUtils.java From vscode-as3mxml with Apache License 2.0 | 5 votes |
/** * Converts a compiler problem to a language server severity. */ public static DiagnosticSeverity getDiagnosticSeverityFromCompilerProblem(ICompilerProblem problem) { if (problem instanceof SyntaxFallbackProblem) { return DiagnosticSeverity.Information; } if (problem instanceof UnusedImportProblem || problem instanceof DisabledConfigConditionBlockProblem) { return DiagnosticSeverity.Hint; } CompilerProblemCategorizer categorizer = new CompilerProblemCategorizer(null); CompilerProblemSeverity severity = categorizer.getProblemSeverity(problem); switch (severity) { case ERROR: { return DiagnosticSeverity.Error; } case WARNING: { return DiagnosticSeverity.Warning; } default: { return DiagnosticSeverity.Information; } } }
Example 10
Source File: LanguageServerImpl.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
/** * Convert the severity to a lsp {@link DiagnosticSeverity}. * * Defaults to severity {@link DiagnosticSeverity#Hint hint}. */ protected DiagnosticSeverity toDiagnosticSeverity(Severity severity) { switch (severity) { case ERROR: return DiagnosticSeverity.Error; case IGNORE: return DiagnosticSeverity.Hint; case INFO: return DiagnosticSeverity.Information; case WARNING: return DiagnosticSeverity.Warning; default: return DiagnosticSeverity.Hint; } }
Example 11
Source File: LSPDiagnosticsToMarkers.java From intellij-quarkus with Eclipse Public License 2.0 | 4 votes |
private int getLayer(DiagnosticSeverity severity) { return severity== DiagnosticSeverity.Error?HighlighterLayer.ERROR:HighlighterLayer.WARNING; }