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

setExternalLibertyInstallation flag getting set wrong due to path mismatch #261

Closed scottkurz closed 7 months ago

scottkurz commented 8 months ago

In io.openliberty.tools.langserver.lemminx.util.LibertyUtils.getLibertyRuntimeInfo(LibertyWorkspace) in version 2.1.1 we go through this path:

                    if (!libertyRuntimeInfo.getRuntimeLocation().startsWith(libertyWorkspace.getWorkspaceStringWithTrailingSlash())) {
                        libertyWorkspace.setExternalLibertyInstallation(true);
                    } else {
                        libertyWorkspace.setExternalLibertyInstallation(false);
                    }

In my case, on Windows, the libertyRuntimeInfo.getRuntimeLocation() returns: C:\guide-getting-started\finish\target\liberty\wlp while the libertyWorkspace.getWorkspaceStringWithTrailingSlash() returns file:/C:/guide-getting-started/finish/.

So clearly the intent was that the "startsWith" check would be 'true' so we'd go down the 'else' path and do libertyWorkspace.setExternalLibertyInstallation(false);, however the check is failing and so we're setting it to 'true'.

It doesn't seem like we're doing anything with this 'setExternalLibertyInstallation' flag at the moment, just noting in case we do.

cherylking commented 7 months ago

I think this isExternalLibertyInstallation boolean can be removed. As you said, nothing is using it. Now that we get the installation directory from the liberty-plugin-config.xml file, whether the installation is local or external to the workspace is irrelevant.