Java Code Examples for org.eclipse.lsp4j.DiagnosticSeverity#Hint

The following examples show how to use org.eclipse.lsp4j.DiagnosticSeverity#Hint . 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 vote down vote up
/**
 * 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: DiagnosticIssueConverter.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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 3
Source File: LanguageServerCompilerUtils.java    From vscode-as3mxml with Apache License 2.0 5 votes vote down vote up
/**
 * 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 4
Source File: LanguageServerImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * 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 5
Source File: LSPDiagnosticsToMarkers.java    From intellij-quarkus with Eclipse Public License 2.0 4 votes vote down vote up
private EffectType getEffectType(DiagnosticSeverity severity) {
    return severity== DiagnosticSeverity.Hint?EffectType.BOLD_DOTTED_LINE:EffectType.WAVE_UNDERSCORE;
}