OpenLiberty / liberty-language-server

The Liberty Config Language Server provides language server features for Liberty server configuration files through any of the supported client IDEs.
Eclipse Public License 2.0
5 stars 11 forks source link

[properties] Specify a severity for diagnostics related to a properties file. #260

Closed turkeylurkey closed 7 months ago

turkeylurkey commented 8 months ago

The LSP says:

 * The diagnostic's severity. Can be omitted. If omitted it is up to the
 * client to interpret diagnostics as error, warning, info or hint.

In VS Code it is treated as an error and we see:

image

In a future version of IntelliJ it may be treated as INFO and so there will be no underline, just hover text:

image

It may be a good idea to specify Error or Warning to take control of the user experience and not leave it to the client.

angelozerr commented 8 months ago

LSP4IJ should set ERROR instead of INFO when severity doesn't exist to align with the vscode behavior https://github.com/redhat-developer/lsp4ij/blob/1213d4b8bc4b4a2aaf7603a9d507c91712165ed1/src/main/java/com/redhat/devtools/lsp4ij/operations/diagnostics/SeverityMapping.java#L41

Please create a PR for that

cherylking commented 7 months ago

@turkeylurkey So would we use this constructor for the Diagnostic instead? And if so, what would we provide for the source parameter?

public Diagnostic([Range](https://javadoc.io/static/org.eclipse.lsp4j/org.eclipse.lsp4j/0.8.1/org/eclipse/lsp4j/Range.html) range,
                  java.lang.String message,
                  [DiagnosticSeverity](https://javadoc.io/static/org.eclipse.lsp4j/org.eclipse.lsp4j/0.8.1/org/eclipse/lsp4j/DiagnosticSeverity.html) severity,
                  java.lang.String source)
turkeylurkey commented 7 months ago

The source is "A human-readable string describing the source of this diagnostic, e.g. 'typescript' or 'super lint'." so it could be "Liberty Language Server" or some variation.

[Something more user focused would be "Liberty Analyzer" or "Liberty lint" or "Liberty Configurator."]