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

Diagnostic on `<server>` element in server.xml #246

Open cherylking opened 10 months ago

cherylking commented 10 months ago

Certain scenarios can cause the <server> element to have a diagnostic message (seen in VS Code, but probably affects all IDEs). The message basically states that the server schema cannot be loaded/found. Here are the steps to create and the explanation why it happens.

1) Open a project. Doesn't matter if it is maven/gradle, or whether it has been built previously or not. 2) Open the server.xml. There should be no diagnostics (if the project was configured correctly). 3) If the project was previously built, from the terminal, do a clean. 4) Make sure the pom.xml is either using openliberty-kernel or does not specify the runtimeArtifact. 4) From the Liberty Dashboard, select Start. 5) As the server is starting, red diagnostics will appear for some elements. 6) When the features get installed, the main <server> root element will have a diagnostic.

The reason this happens is that the installation of features causes the .libertyls directory to get deleted, and that dir has the generated xsd that is used to validate the server.xml file. After a bit of time passes, a new xsd gets generated with the newly updated Liberty runtime and the diagnostic goes away.

Not sure if there is a way for us to detect this and revert to the default schema temporarily, or if we should have a backup of the schema to use in this case until the new one gets generated?