OpenLiberty / liberty-tools-intellij

IntelliJ IDEA extension for Liberty
https://plugins.jetbrains.com/plugin/14856-open-liberty-tools
Eclipse Public License 2.0
12 stars 25 forks source link

hover on text: NONE did not trigger a pop-up window #945

Open anusreelakshmi934 opened 1 month ago

anusreelakshmi934 commented 1 month ago

While running the LTI build in windows we are coming across this issue. In GradleSingleModLSTest > testDiagnosticInServerEnv() FAILED java.lang.RuntimeException: Hover on text: NONE did not trigger a pop-up window to open Caused by: com.intellij.remoterobot.utils.WaitForConditionTimeoutException: Exceeded timeout (PT5S) for condition function (Failed to find 'Container' by '//div[@class='HeavyWeightWindow']//div[@class='JEditorPane']' in 5s) Its not getting the required text while hovering.

Attaching the build that ran - https://github.com/anusreelakshmi934/liberty-tools-intellij/actions/runs/10714632594/job/29708636124#step:10:901

image
turkeylurkey commented 1 month ago

Similar to the Mac issue #972

vaisakhkannan commented 3 weeks ago

As part of the Windows test failures, the testDiagnosticInServerEnv() method is consistently failing in our current main code. In most builds, this is the only test that fails.

As a workaround, I tried different scenarios to check if the tests would pass:

  1. Updated the value from "NONE" to "none". Out of 10 builds, builds 1, 2, 7, and 8 were successful. Build 3: 12 failures without the hover issue. Builds 4 and 9: 1 failure due to the hover issue. Build 5: 19 failures without the hover issue. Build 6: 10 failures without the hover issue. Build 10: 1 failure (without the hover issue) – MavenSingleModNLTRestProjectTest > initializationError FAILED. Summary: Only 2 builds failed due to the hover issue in server.env. Reference: https://github.com/vaisakhkannan/liberty-tools-intellij/actions/runs/10989098813

  2. Tried closing and reopening server.env after inserting the invalid value "NONE". Out of 10 builds: Builds 1, 3, 4, 6, 7, 9, and 10 passed. Build 2: 1 failure – testStartWithParamsActionUsingPopUpMenu() FAILED (no hover issue). Build 8: 2 failures – testInsertLibertyConfigIntoServerEnv() FAILED, testMPQuickFixInJavaFile() FAILED. Build 5: In progress. Summary: There is no hover issue in server.env on the diagnostic. Reference: https://github.com/vaisakhkannan/liberty-tools-intellij/actions/runs/10989156096

  3. Added a delay after inserting the invalid value "NONE" before checking the hover in the diagnostic. Build 1: 1 failure due to the hover issue on server.env. Build 2: 1 failure – testDiagnosticInServerXML() FAILED (no issue with server.env). Build 3: 16 failures, including the hover issue on server.env. Builds 4, 5, 6, 7, 8, 9, and 10 passed. Summary: 2 builds failed due to the hover issue on server.env in the diagnostic. Reference: https://github.com/vaisakhkannan/liberty-tools-intellij/actions/runs/10992249909

vaisakhkannan commented 3 weeks ago

Based on the investigation of this test failure, I tried using different LSP4IJ versions: 0.5.0, 0.4.0, and 0.3.0.

LSP4IJ version - 0.5.0 - Test 1 -> https://github.com/vaisakhkannan/liberty-tools-intellij/actions/runs/11015844048 Build 1,2,4,5,6,8,10 - only 1 failure this issue Build 3 - 15 failures including this issue Build 7 - 14 failures including this issue Build 9 - 2 failures including this issue and other issue GradleSingleModJakartaLSTest > testInsertJakartaCodeSnippetIntoJavaPart() FAILED

LSP4IJ version - 0.5.0 -> Test 2- > https://github.com/vaisakhkannan/liberty-tools-intellij/actions/runs/11015896141

Build 2-4,6-10 -> only 1 failure this issue Build 1 -> 19 failures including this issue Build 5 - 8 failures including this issue Build 6 - Failed in step Build Liberty-tools-Intellij

LSP4IJ version - 0.4.0 - Test -1 - https://github.com/vaisakhkannan/liberty-tools-intellij/actions/runs/11015859969

Build 2-10 - only 1 failure this issue Build 1 - 4 failures including this issue

LSP4IJ version - 0.3.0- Test 1- https://github.com/vaisakhkannan/liberty-tools-intellij/actions/runs/11015890720

Build 2,3,5,6,7,9,10 - Build Success Build 1 - 7 failures without this issue Build 4 - 3 failures without this issue Build 8 - 7 Failures without this issue

0.3.0- Test 2 - https://github.com/vaisakhkannan/liberty-tools-intellij/actions/runs/11015947142

Build 1,2,3,4,7,8,9 - Build Success Build 5 - 19 failures without this issue Build 6 - 12 failures without this issue Build -10 - 3 failures without this issue

Summary : I observed that there is no issue in the server.env files for version 0.3.0 (for all builds), but I found that the 'diagnostic not appearing' error leads to the 'hover not present' error in the server.env files for versions 0.4.0 and 0.5.0 (for all builds). Aparna also confirmed that the same issue is present in version 0.6.0 as well

vaisakhkannan commented 3 weeks ago

As a workaround for this issue, the team has agreed to try closing and reopening server.env after inserting the invalid value 'NONE'. We need to ensure that the underlying issue is resolved in the future, and the workaround should be removed.

angelozerr commented 3 weeks ago

I cannot reproduce it. I have created a bootstrap.properties like this:

WLP_LOGGING_CONSOLE_LOGLEVEL=AUDIT
WLP_LOGGING_CONSOLE_FORMAT=NONE

I have stopped the LS, open the file, close the file, open again and disagnostics appears every time.

Could you explain in detail the usecase?

If you enable LSP console, and you have the problem do you see some publishDiagnostics like this?

[Trace - 13:18:53] Received notification 'textDocument/publishDiagnostics'
Params: {
  "uri": "file:///C:/Users/azerr/untitled/server.env",
  "diagnostics": [
    {
      "range": {
        "start": {
          "line": 1,
          "character": 27
        },
        "end": {
          "line": 1,
          "character": 31
        }
      },
      "message": "The value `NONE` is not valid for the variable `WLP_LOGGING_CONSOLE_FORMAT`."
    }
  ]
}
vaisakhkannan commented 3 weeks ago

Hi @angelozerr ,We are mainly encountering the issue in GHA builds, particularly in Windows builds, where it occurs consistently. It also happens in builds for other operating systems, but less frequently and intermittently. We were able to reproduce the issue locally on Windows machines, though it was intermittent there as well. The problem primarily occurs in GHA builds.

For reference https://github.com/vaisakhkannan/liberty-tools-intellij/actions/runs/11015896141

But with the version 0.3.0 , there is no issue with server.env- > https://github.com/vaisakhkannan/liberty-tools-intellij/actions/runs/11015890720

aparnamichael commented 2 weeks ago

This failure started after updating the LSP4IJ version to 0.4.0. I ran GHA builds with different nightly build versions after 0.3.0 release. From this version of LSP4IJ nightly build, server.env diagnostic test is consistently failing 0.4.0-20240814-141029 in windows.

Test : GradleSingleModLSTest > testDiagnosticInServerEnv() java.lang.RuntimeException: Hover on text: NONE did not trigger a pop-up window to open

LTI build with LSP4IJ version 0.4.0-20240814-141029(Aug 14) - https://github.com/aparnamichael/liberty-tools-intellij/actions/runs/11123067607

LTI build with LSP4IJ version 0.4.0-20240813-173701(Aug 13) - https://github.com/aparnamichael/liberty-tools-intellij/actions/runs/11123925619

LTI build with LSP4IJ version[0.4.0-20240815-013110(Aug 15) - https://github.com/aparnamichael/liberty-tools-intellij/actions/runs/11124525639

aparnamichael commented 1 week ago

In windows, I am able to reproduce this issue in my local machine. Attaching video for the reference.

https://github.com/user-attachments/assets/e1940e20-5a57-4d47-9f78-132ecb3b16cb

aparnamichael commented 1 week ago

I am getting this hover issue in Mac as well. These are the steps.

  1. Add a empty line in server env.
  2. Then add a variable and set the value to "NONE" check for hover.
  3. The hover won't show and in the console I can see the message as "".

image

[Trace - 18:12:16] Sending request 'textDocument/hover - (5)'. Params: { "textDocument": { "uri": "file:///Users/aparnacmichael/Documents/app-name-fvt/src/main/liberty/config/server.env" }, "position": { "line": 1, "character": 31 } }

[Trace - 18:12:16] Received response 'textDocument/hover - (5)' in 1ms. Result: { "contents": { "kind": "plaintext", "value": "" } }

After trying multiple times, now I am not getting hover, even though there is no empty line.

image

angelozerr commented 1 week ago

It seems that popup error that you expect is an error. If it that you need to see publishDiagnostics and not textDocument/hoverwhich returns the documentation to show, not the error.

aparnamichael commented 1 week ago

I have raised a separate issue (https://github.com/OpenLiberty/liberty-tools-intellij/issues/1017) to track the problem with the publishDiagnostics when an extra empty newline is added before the variable.

The Windows GHA failures are not related to the empty newline issue. This needs further investigation. This failure has been consistently occurring since the LSP4IJ build. - 0.4.0-20240814-141029

aparnamichael commented 1 day ago

I created a fork of the lsp4ij repository and set up a branch (https://github.com/aparnamichael/lsp4ij/tree/lsp4ij-test), where I reverted a commit from August 14. After running an LTI build with these changes, the GHA UI test consistently succeeded.

LTI build ran using the LSP4IJ from https://github.com/aparnamichael/lsp4ij/tree/lsp4ij-test -> https://github.com/aparnamichael/liberty-tools-intellij/actions/runs/11346287359/job/31555011172

Added an issue in redhat repo https://github.com/redhat-developer/lsp4ij/issues/577