redhat-developer / lsp4ij

LSP Client for IntelliJ
Eclipse Public License 2.0
48 stars 9 forks source link

Quick fix missing from MicroProfile and Jakarta diagnostic #294

Open turkeylurkey opened 1 month ago

turkeylurkey commented 1 month ago

Intermittently quick fixes are missing. This often causes failures in Liberty automated UI testing.

image image

Here is a test case used for the MicroProfile diagnostic.

package io.openliberty.mp.sample.health;

import org.eclipse.microprofile.health.HealthCheck;
import org.eclipse.microprofile.health.HealthCheckResponse;
import org.eclipse.microprofile.health.Liveness;

import javax.enterprise.context.ApplicationScoped;

//@Liveness
@ApplicationScoped
public class ServiceLiveHealthCheck implements HealthCheck {

    @Override
    public HealthCheckResponse call() {

        return HealthCheckResponse.named(ServiceLiveHealthCheck.class.getSimpleName()).withData("live", true).up().build();

    }
}

It is important to note that these results were achieved using the April 1 version of this repository. If there were changes to the creation of diagnostics or quick fixes since then we'll need to test them out.

The language server messages and the IntelliJ logs will be appended below.

turkeylurkey commented 1 month ago

[Trace - 17:53:38] Received response 'textDocument/inlayHint - (135)' in 1ms.
No result returned.

[Trace - 17:53:38] Received request 'microprofile/java/diagnostics - (137)'
Params: {
  "uris": [
    "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/health/ServiceLiveHealthCheck.java"
  ],
  "documentFormat": 2,
  "settings": {}
}

[Trace - 17:53:38] Received request 'microprofile/java/diagnostics - (138)'
Params: {
  "uris": [
    "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/system/SystemResource2.java"
  ],
  "documentFormat": 2,
  "settings": {}
}

[Trace - 17:53:38] Sending response 'microprofile/java/diagnostics - (138)'. Processing request took 1ms
Result: [
  {
    "uri": "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/system/SystemResource2.java",
    "diagnostics": []
  }
]

[Trace - 17:53:38] Sending response 'microprofile/java/diagnostics - (137)'. Processing request took 1ms
Result: [
  {
    "uri": "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/health/ServiceLiveHealthCheck.java",
    "diagnostics": [
      {
        "range": {
          "start": {
            "line": 10,
            "character": 13
          },
          "end": {
            "line": 10,
            "character": 35
          }
        },
        "severity": 2,
        "code": "HealthAnnotationMissing",
        "source": "microprofile-health",
        "message": "The class `io.openliberty.mp.sample.health.ServiceLiveHealthCheck` implementing the HealthCheck interface should use the @Liveness, @Readiness, or @Health annotation."
      }
    ]
  }
]

[Trace - 17:53:38] Received notification 'textDocument/publishDiagnostics'
Params: {
  "uri": "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/system/SystemResource2.java",
  "diagnostics": []
}

[Trace - 17:53:38] Received notification 'textDocument/publishDiagnostics'
Params: {
  "uri": "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/health/ServiceLiveHealthCheck.java",
  "diagnostics": [
    {
      "range": {
        "start": {
          "line": 10,
          "character": 13
        },
        "end": {
          "line": 10,
          "character": 35
        }
      },
      "severity": 2,
      "code": "HealthAnnotationMissing",
      "source": "microprofile-health",
      "message": "The class `io.openliberty.mp.sample.health.ServiceLiveHealthCheck` implementing the HealthCheck interface should use the @Liveness, @Readiness, or @Health annotation."
    }
  ]
}

[Trace - 17:53:38] Sending request 'textDocument/codeAction - (136)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/health/ServiceLiveHealthCheck.java"
  },
  "range": {
    "start": {
      "line": 10,
      "character": 13
    },
    "end": {
      "line": 10,
      "character": 35
    }
  },
  "context": {
    "diagnostics": [
      {
        "range": {
          "start": {
            "line": 10,
            "character": 13
          },
          "end": {
            "line": 10,
            "character": 35
          }
        },
        "severity": 2,
        "code": "HealthAnnotationMissing",
        "source": "microprofile-health",
        "message": "The class `io.openliberty.mp.sample.health.ServiceLiveHealthCheck` implementing the HealthCheck interface should use the @Liveness, @Readiness, or @Health annotation."
      }
    ],
    "triggerKind": 2
  }
}

[Trace - 17:53:38] Received request 'microprofile/java/codeAction - (139)'
Params: {
  "resourceOperationSupported": false,
  "commandConfigurationUpdateSupported": false,
  "resolveSupported": true,
  "textDocument": {
    "uri": "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/health/ServiceLiveHealthCheck.java"
  },
  "range": {
    "start": {
      "line": 10,
      "character": 13
    },
    "end": {
      "line": 10,
      "character": 35
    }
  },
  "context": {
    "diagnostics": [
      {
        "range": {
          "start": {
            "line": 10,
            "character": 13
          },
          "end": {
            "line": 10,
            "character": 35
          }
        },
        "severity": 2,
        "code": "HealthAnnotationMissing",
        "source": "microprofile-health",
        "message": "The class `io.openliberty.mp.sample.health.ServiceLiveHealthCheck` implementing the HealthCheck interface should use the @Liveness, @Readiness, or @Health annotation."
      }
    ],
    "triggerKind": 2
  }
}

[Trace - 17:53:38] Sending response 'microprofile/java/codeAction - (139)'. Processing request took 11ms
Result: [
  {
    "title": "Insert @Health",
    "kind": "quickfix",
    "diagnostics": [
      {
        "range": {
          "start": {
            "line": 10,
            "character": 13
          },
          "end": {
            "line": 10,
            "character": 35
          }
        },
        "severity": 2,
        "code": "HealthAnnotationMissing",
        "source": "microprofile-health",
        "message": "The class `io.openliberty.mp.sample.health.ServiceLiveHealthCheck` implementing the HealthCheck interface should use the @Liveness, @Readiness, or @Health annotation."
      }
    ],
    "data": {
      "participantId": "io.openliberty.tools.intellij.lsp4mp4ij.psi.internal.health.java.HealthAnnotationMissingQuickFix",
      "documentUri": "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/health/ServiceLiveHealthCheck.java",
      "range": {
        "start": {
          "line": 10,
          "character": 13
        },
        "end": {
          "line": 10,
          "character": 35
        }
      },
      "extendedData": {
        "annotation": [
          "org.eclipse.microprofile.health.Health"
        ]
      },
      "resourceOperationSupported": false,
      "commandConfigurationUpdateSupported": false,
      "id": "InsertMissingHealthAnnotation"
    }
  },
  {
    "title": "Insert @Liveness",
    "kind": "quickfix",
    "diagnostics": [
      {
        "range": {
          "start": {
            "line": 10,
            "character": 13
          },
          "end": {
            "line": 10,
            "character": 35
          }
        },
        "severity": 2,
        "code": "HealthAnnotationMissing",
        "source": "microprofile-health",
        "message": "The class `io.openliberty.mp.sample.health.ServiceLiveHealthCheck` implementing the HealthCheck interface should use the @Liveness, @Readiness, or @Health annotation."
      }
    ],
    "data": {
      "participantId": "io.openliberty.tools.intellij.lsp4mp4ij.psi.internal.health.java.HealthAnnotationMissingQuickFix",
      "documentUri": "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/health/ServiceLiveHealthCheck.java",
      "range": {
        "start": {
          "line": 10,
          "character": 13
        },
        "end": {
          "line": 10,
          "character": 35
        }
      },
      "extendedData": {
        "annotation": [
          "org.eclipse.microprofile.health.Liveness"
        ]
      },
      "resourceOperationSupported": false,
      "commandConfigurationUpdateSupported": false,
      "id": "InsertMissingHealthAnnotation"
    }
  },
  {
    "title": "Insert @Readiness",
    "kind": "quickfix",
    "diagnostics": [
      {
        "range": {
          "start": {
            "line": 10,
            "character": 13
          },
          "end": {
            "line": 10,
            "character": 35
          }
        },
        "severity": 2,
        "code": "HealthAnnotationMissing",
        "source": "microprofile-health",
        "message": "The class `io.openliberty.mp.sample.health.ServiceLiveHealthCheck` implementing the HealthCheck interface should use the @Liveness, @Readiness, or @Health annotation."
      }
    ],
    "data": {
      "participantId": "io.openliberty.tools.intellij.lsp4mp4ij.psi.internal.health.java.HealthAnnotationMissingQuickFix",
      "documentUri": "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/health/ServiceLiveHealthCheck.java",
      "range": {
        "start": {
          "line": 10,
          "character": 13
        },
        "end": {
          "line": 10,
          "character": 35
        }
      },
      "extendedData": {
        "annotation": [
          "org.eclipse.microprofile.health.Readiness"
        ]
      },
      "resourceOperationSupported": false,
      "commandConfigurationUpdateSupported": false,
      "id": "InsertMissingHealthAnnotation"
    }
  },
  {
    "title": "Generate OpenAPI Annotations for \u0027ServiceLiveHealthCheck\u0027",
    "kind": "source",
    "data": {
      "participantId": "io.openliberty.tools.intellij.lsp4mp4ij.psi.internal.openapi.java.MicroProfileGenerateOpenAPIOperation",
      "documentUri": "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/health/ServiceLiveHealthCheck.java",
      "range": {
        "start": {
          "line": 10,
          "character": 13
        },
        "end": {
          "line": 10,
          "character": 35
        }
      },
      "extendedData": {
        "type": "io.openliberty.mp.sample.health.ServiceLiveHealthCheck"
      },
      "resourceOperationSupported": false,
      "commandConfigurationUpdateSupported": false,
      "id": "GenerateOpenApiAnnotations"
    }
  }
]

[Trace - 17:53:38] Received response 'textDocument/codeAction - (136)' in 23ms.
Result: [
  {
    "title": "Insert @Health",
    "kind": "quickfix",
    "diagnostics": [
      {
        "range": {
          "start": {
            "line": 10,
            "character": 13
          },
          "end": {
            "line": 10,
            "character": 35
          }
        },
        "severity": 2,
        "code": "HealthAnnotationMissing",
        "source": "microprofile-health",
        "message": "The class `io.openliberty.mp.sample.health.ServiceLiveHealthCheck` implementing the HealthCheck interface should use the @Liveness, @Readiness, or @Health annotation."
      }
    ],
    "data": {
      "participantId": "io.openliberty.tools.intellij.lsp4mp4ij.psi.internal.health.java.HealthAnnotationMissingQuickFix",
      "documentUri": "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/health/ServiceLiveHealthCheck.java",
      "range": {
        "start": {
          "line": 10,
          "character": 13
        },
        "end": {
          "line": 10,
          "character": 35
        }
      },
      "extendedData": {
        "annotation": [
          "org.eclipse.microprofile.health.Health"
        ]
      },
      "resourceOperationSupported": false,
      "commandConfigurationUpdateSupported": false,
      "id": "InsertMissingHealthAnnotation"
    }
  },
  {
    "title": "Insert @Liveness",
    "kind": "quickfix",
    "diagnostics": [
      {
        "range": {
          "start": {
            "line": 10,
            "character": 13
          },
          "end": {
            "line": 10,
            "character": 35
          }
        },
        "severity": 2,
        "code": "HealthAnnotationMissing",
        "source": "microprofile-health",
        "message": "The class `io.openliberty.mp.sample.health.ServiceLiveHealthCheck` implementing the HealthCheck interface should use the @Liveness, @Readiness, or @Health annotation."
      }
    ],
    "data": {
      "participantId": "io.openliberty.tools.intellij.lsp4mp4ij.psi.internal.health.java.HealthAnnotationMissingQuickFix",
      "documentUri": "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/health/ServiceLiveHealthCheck.java",
      "range": {
        "start": {
          "line": 10,
          "character": 13
        },
        "end": {
          "line": 10,
          "character": 35
        }
      },
      "extendedData": {
        "annotation": [
          "org.eclipse.microprofile.health.Liveness"
        ]
      },
      "resourceOperationSupported": false,
      "commandConfigurationUpdateSupported": false,
      "id": "InsertMissingHealthAnnotation"
    }
  },
  {
    "title": "Insert @Readiness",
    "kind": "quickfix",
    "diagnostics": [
      {
        "range": {
          "start": {
            "line": 10,
            "character": 13
          },
          "end": {
            "line": 10,
            "character": 35
          }
        },
        "severity": 2,
        "code": "HealthAnnotationMissing",
        "source": "microprofile-health",
        "message": "The class `io.openliberty.mp.sample.health.ServiceLiveHealthCheck` implementing the HealthCheck interface should use the @Liveness, @Readiness, or @Health annotation."
      }
    ],
    "data": {
      "participantId": "io.openliberty.tools.intellij.lsp4mp4ij.psi.internal.health.java.HealthAnnotationMissingQuickFix",
      "documentUri": "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/health/ServiceLiveHealthCheck.java",
      "range": {
        "start": {
          "line": 10,
          "character": 13
        },
        "end": {
          "line": 10,
          "character": 35
        }
      },
      "extendedData": {
        "annotation": [
          "org.eclipse.microprofile.health.Readiness"
        ]
      },
      "resourceOperationSupported": false,
      "commandConfigurationUpdateSupported": false,
      "id": "InsertMissingHealthAnnotation"
    }
  },
  {
    "title": "Generate OpenAPI Annotations for \u0027ServiceLiveHealthCheck\u0027",
    "kind": "source",
    "data": {
      "participantId": "io.openliberty.tools.intellij.lsp4mp4ij.psi.internal.openapi.java.MicroProfileGenerateOpenAPIOperation",
      "documentUri": "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/health/ServiceLiveHealthCheck.java",
      "range": {
        "start": {
          "line": 10,
          "character": 13
        },
        "end": {
          "line": 10,
          "character": 35
        }
      },
      "extendedData": {
        "type": "io.openliberty.mp.sample.health.ServiceLiveHealthCheck"
      },
      "resourceOperationSupported": false,
      "commandConfigurationUpdateSupported": false,
      "id": "GenerateOpenApiAnnotations"
    }
  }
]

[Trace - 17:53:38] Sending notification 'microprofile/propertiesChanged'
Params: {
  "type": [
    1,
    1
  ],
  "projectURIs": [
    "sampleGradleMPLSApp.main"
  ]
}

[Trace - 17:53:38] Received request 'microprofile/java/diagnostics - (140)'
Params: {
  "uris": [
    "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/system/SystemResource2.java",
    "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/health/ServiceLiveHealthCheck.java"
  ],
  "documentFormat": 2,
  "settings": {}
}

[Trace - 17:53:38] Sending response 'microprofile/java/diagnostics - (140)'. Processing request took 1ms
Result: [
  {
    "uri": "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/system/SystemResource2.java",
    "diagnostics": []
  },
  {
    "uri": "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/health/ServiceLiveHealthCheck.java",
    "diagnostics": [
      {
        "range": {
          "start": {
            "line": 10,
            "character": 13
          },
          "end": {
            "line": 10,
            "character": 35
          }
        },
        "severity": 2,
        "code": "HealthAnnotationMissing",
        "source": "microprofile-health",
        "message": "The class `io.openliberty.mp.sample.health.ServiceLiveHealthCheck` implementing the HealthCheck interface should use the @Liveness, @Readiness, or @Health annotation."
      }
    ]
  }
]

[Trace - 17:53:38] Received notification 'textDocument/publishDiagnostics'
Params: {
  "uri": "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/system/SystemResource2.java",
  "diagnostics": []
}

[Trace - 17:53:38] Received notification 'textDocument/publishDiagnostics'
Params: {
  "uri": "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/health/ServiceLiveHealthCheck.java",
  "diagnostics": [
    {
      "range": {
        "start": {
          "line": 10,
          "character": 13
        },
        "end": {
          "line": 10,
          "character": 35
        }
      },
      "severity": 2,
      "code": "HealthAnnotationMissing",
      "source": "microprofile-health",
      "message": "The class `io.openliberty.mp.sample.health.ServiceLiveHealthCheck` implementing the HealthCheck interface should use the @Liveness, @Readiness, or @Health annotation."
    }
  ]
}

[Trace - 17:53:53] Sending request 'textDocument/codeAction - (139)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/health/ServiceLiveHealthCheck.java"
  },
  "range": {
    "start": {
      "line": 10,
      "character": 13
    },
    "end": {
      "line": 10,
      "character": 35
    }
  },
  "context": {
    "diagnostics": [
      {
        "range": {
          "start": {
            "line": 10,
            "character": 13
          },
          "end": {
            "line": 10,
            "character": 35
          }
        },
        "severity": 2,
        "code": "HealthAnnotationMissing",
        "source": "microprofile-health",
        "message": "The class `io.openliberty.mp.sample.health.ServiceLiveHealthCheck` implementing the HealthCheck interface should use the @Liveness, @Readiness, or @Health annotation."
      }
    ],
    "triggerKind": 2
  }
}

[Trace - 17:53:53] Sending request 'textDocument/codeAction - (138)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/health/ServiceLiveHealthCheck.java"
  },
  "range": {
    "start": {
      "line": 10,
      "character": 13
    },
    "end": {
      "line": 10,
      "character": 35
    }
  },
  "context": {
    "diagnostics": [
      {
        "range": {
          "start": {
            "line": 10,
            "character": 13
          },
          "end": {
            "line": 10,
            "character": 35
          }
        },
        "severity": 2,
        "code": "HealthAnnotationMissing",
        "source": "microprofile-health",
        "message": "The class `io.openliberty.mp.sample.health.ServiceLiveHealthCheck` implementing the HealthCheck interface should use the @Liveness, @Readiness, or @Health annotation."
      }
    ],
    "triggerKind": 2
  }
}

[Trace - 17:53:53] Sending request 'textDocument/codeAction - (137)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/health/ServiceLiveHealthCheck.java"
  },
  "range": {
    "start": {
      "line": 10,
      "character": 13
    },
    "end": {
      "line": 10,
      "character": 35
    }
  },
  "context": {
    "diagnostics": [
      {
        "range": {
          "start": {
            "line": 10,
            "character": 13
          },
          "end": {
            "line": 10,
            "character": 35
          }
        },
        "severity": 2,
        "code": "HealthAnnotationMissing",
        "source": "microprofile-health",
        "message": "The class `io.openliberty.mp.sample.health.ServiceLiveHealthCheck` implementing the HealthCheck interface should use the @Liveness, @Readiness, or @Health annotation."
      }
    ],
    "triggerKind": 2
  }
}

[Trace - 17:53:53] Received request 'microprofile/java/projectLabels - (142)'
Params: {
  "uri": "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/health/ServiceLiveHealthCheck.java",
  "types": [
    "jakarta.ws.rs.GET",
    "org.eclipse.microprofile.rest.client.inject.RegisterRestClient",
    "org.eclipse.microprofile.metrics.annotation.Metric",
    "org.eclipse.microprofile.metrics.annotation.Counted",
    "org.eclipse.microprofile.metrics.annotation.Gauge",
    "org.eclipse.microprofile.metrics.annotation.ConcurrentGauge",
    "org.eclipse.microprofile.metrics.annotation.Metered",
    "org.eclipse.microprofile.metrics.annotation.Timed",
    "org.eclipse.microprofile.metrics.annotation.SimplyTimed",
    "org.eclipse.microprofile.metrics.annotation.RegistryType",
    "org.eclipse.microprofile.openapi.annotations.Operation",
    "org.eclipse.microprofile.openapi.annotations.media.Content",
    "org.eclipse.microprofile.openapi.annotations.media.Schema",
    "org.eclipse.microprofile.openapi.annotations.parameters.Parameters",
    "org.eclipse.microprofile.openapi.annotations.parameters.Parameter",
    "org.eclipse.microprofile.openapi.annotations.responses.APIResponses",
    "org.eclipse.microprofile.openapi.annotations.responses.APIResponse",
    "org.eclipse.microprofile.faulttolerance.Timeout",
    "org.eclipse.microprofile.faulttolerance.Retry",
    "org.eclipse.microprofile.faulttolerance.Fallback",
    "org.eclipse.microprofile.faulttolerance.CircuitBreaker",
    "org.eclipse.microprofile.faulttolerance.Bulkhead",
    "org.eclipse.microprofile.health.Readiness",
    "org.eclipse.microprofile.health.Liveness",
    "javax.ws.rs.GET"
  ]
}

[Trace - 17:53:53] Received request 'microprofile/java/projectLabels - (143)'
Params: {
  "uri": "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/health/ServiceLiveHealthCheck.java",
  "types": [
    "jakarta.ws.rs.GET",
    "org.eclipse.microprofile.rest.client.inject.RegisterRestClient",
    "org.eclipse.microprofile.metrics.annotation.Metric",
    "org.eclipse.microprofile.metrics.annotation.Counted",
    "org.eclipse.microprofile.metrics.annotation.Gauge",
    "org.eclipse.microprofile.metrics.annotation.ConcurrentGauge",
    "org.eclipse.microprofile.metrics.annotation.Metered",
    "org.eclipse.microprofile.metrics.annotation.Timed",
    "org.eclipse.microprofile.metrics.annotation.SimplyTimed",
    "org.eclipse.microprofile.metrics.annotation.RegistryType",
    "org.eclipse.microprofile.openapi.annotations.Operation",
    "org.eclipse.microprofile.openapi.annotations.media.Content",
    "org.eclipse.microprofile.openapi.annotations.media.Schema",
    "org.eclipse.microprofile.openapi.annotations.parameters.Parameters",
    "org.eclipse.microprofile.openapi.annotations.parameters.Parameter",
    "org.eclipse.microprofile.openapi.annotations.responses.APIResponses",
    "org.eclipse.microprofile.openapi.annotations.responses.APIResponse",
    "org.eclipse.microprofile.faulttolerance.Timeout",
    "org.eclipse.microprofile.faulttolerance.Retry",
    "org.eclipse.microprofile.faulttolerance.Fallback",
    "org.eclipse.microprofile.faulttolerance.CircuitBreaker",
    "org.eclipse.microprofile.faulttolerance.Bulkhead",
    "org.eclipse.microprofile.health.Readiness",
    "org.eclipse.microprofile.health.Liveness",
    "javax.ws.rs.GET"
  ]
}

[Trace - 17:53:53] Received request 'microprofile/java/projectLabels - (141)'
Params: {
  "uri": "file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/health/ServiceLiveHealthCheck.java",
  "types": [
    "jakarta.ws.rs.GET",
    "org.eclipse.microprofile.rest.client.inject.RegisterRestClient",
    "org.eclipse.microprofile.metrics.annotation.Metric",
    "org.eclipse.microprofile.metrics.annotation.Counted",
    "org.eclipse.microprofile.metrics.annotation.Gauge",
    "org.eclipse.microprofile.metrics.annotation.ConcurrentGauge",
    "org.eclipse.microprofile.metrics.annotation.Metered",
    "org.eclipse.microprofile.metrics.annotation.Timed",
    "org.eclipse.microprofile.metrics.annotation.SimplyTimed",
    "org.eclipse.microprofile.metrics.annotation.RegistryType",
    "org.eclipse.microprofile.openapi.annotations.Operation",
    "org.eclipse.microprofile.openapi.annotations.media.Content",
    "org.eclipse.microprofile.openapi.annotations.media.Schema",
    "org.eclipse.microprofile.openapi.annotations.parameters.Parameters",
    "org.eclipse.microprofile.openapi.annotations.parameters.Parameter",
    "org.eclipse.microprofile.openapi.annotations.responses.APIResponses",
    "org.eclipse.microprofile.openapi.annotations.responses.APIResponse",
    "org.eclipse.microprofile.faulttolerance.Timeout",
    "org.eclipse.microprofile.faulttolerance.Retry",
    "org.eclipse.microprofile.faulttolerance.Fallback",
    "org.eclipse.microprofile.faulttolerance.CircuitBreaker",
    "org.eclipse.microprofile.faulttolerance.Bulkhead",
    "org.eclipse.microprofile.health.Readiness",
    "org.eclipse.microprofile.health.Liveness",
    "javax.ws.rs.GET"
  ]
}

[Trace - 17:53:53] Received response 'textDocument/codeAction - (139)' in 1ms.
Result: []

[Trace - 17:53:53] Received response 'textDocument/codeAction - (137)' in 1ms.
Result: []

[Trace - 17:53:53] Received response 'textDocument/codeAction - (138)' in 1ms.
Result: []

[Trace - 17:53:53] Sending response 'microprofile/java/projectLabels - (142)'. Processing request took 0ms
No result returned.

[Trace - 17:53:53] Sending response 'microprofile/java/projectLabels - (141)'. Processing request took 1ms
No result returned.

[Trace - 17:53:53] Sending response 'microprofile/java/projectLabels - (143)'. Processing request took 4ms
Result: {
  "uri": "sampleGradleMPLSApp.main",
  "name": "sampleGradleMPLSApp.main",
  "labels": [
    "jakarta",
    "microprofile",
    "gradle",
    "jakarta.ws.rs.GET",
    "org.eclipse.microprofile.rest.client.inject.RegisterRestClient",
    "org.eclipse.microprofile.metrics.annotation.Metric",
    "org.eclipse.microprofile.metrics.annotation.Counted",
    "org.eclipse.microprofile.metrics.annotation.Gauge",
    "org.eclipse.microprofile.metrics.annotation.ConcurrentGauge",
    "org.eclipse.microprofile.metrics.annotation.Metered",
    "org.eclipse.microprofile.metrics.annotation.Timed",
    "org.eclipse.microprofile.metrics.annotation.SimplyTimed",
    "org.eclipse.microprofile.metrics.annotation.RegistryType",
    "org.eclipse.microprofile.openapi.annotations.Operation",
    "org.eclipse.microprofile.openapi.annotations.media.Content",
    "org.eclipse.microprofile.openapi.annotations.media.Schema",
    "org.eclipse.microprofile.openapi.annotations.parameters.Parameters",
    "org.eclipse.microprofile.openapi.annotations.parameters.Parameter",
    "org.eclipse.microprofile.openapi.annotations.responses.APIResponses",
    "org.eclipse.microprofile.openapi.annotations.responses.APIResponse",
    "org.eclipse.microprofile.faulttolerance.Timeout",
    "org.eclipse.microprofile.faulttolerance.Retry",
    "org.eclipse.microprofile.faulttolerance.Fallback",
    "org.eclipse.microprofile.faulttolerance.CircuitBreaker",
    "org.eclipse.microprofile.faulttolerance.Bulkhead",
    "org.eclipse.microprofile.health.Readiness",
    "org.eclipse.microprofile.health.Liveness",
    "javax.ws.rs.GET"
  ]
}```
turkeylurkey commented 1 month ago

2:56:08 p.m.: Executing 'runIde --stacktrace -Didea.ProcessCanceledException=disabled'...

Starting Gradle Daemon...
Connected to the target VM, address: '127.0.0.1:63104', transport: 'socket'
Gradle Daemon started in 552 ms
> Task :initializeIntelliJPlugin SKIPPED
> Task :copyDeps UP-TO-DATE
> Task :patchPluginXml UP-TO-DATE

> Task :verifyPluginConfiguration
[gradle-intellij-plugin :verifyPluginConfiguration] The following plugin configuration issues were found:
- The 'since-build' property is lower than the target IntelliJ Platform major version: 232 < 241.
- The dependency on the Kotlin Standard Library (stdlib) is automatically added when using the Gradle Kotlin plugin and may conflict with the version provided with the IntelliJ Platform, see: https://jb.gg/intellij-platform-kotlin-stdlib
See: https://jb.gg/intellij-platform-versions

> Task :compileKotlin NO-SOURCE
> Task :compileJava UP-TO-DATE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :instrumentCode UP-TO-DATE
> Task :jar UP-TO-DATE
> Task :inspectClassesForKotlinIC UP-TO-DATE
> Task :instrumentedJar UP-TO-DATE
Disconnected from the target VM, address: '127.0.0.1:63104', transport: 'socket'
> Task :prepareSandbox
Connected to the target VM, address: 'localhost:63110', transport: 'socket'

> Task :runIde
CompileCommand: exclude com/intellij/openapi/vfs/impl/FilePartNodeRoot.trieDescend bool exclude = true
2024-05-16 14:56:14,183 [    436]   WARN - #c.i.o.a.Application - No URL bundle (CFBundleURLTypes) is defined in the main bundle.
To be able to open external links, specify protocols in the app layout section of the build file.
Example: args.urlSchemes = ["your-protocol"] will handle following links: your-protocol://open?file=file&line=line
2024-05-16 14:56:14,388 [    641]   WARN - #c.i.i.s.p.i.BundledSharedIndexProvider - Bundled shared index is not found at: /Users/paulg/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIC/2024.1.1/610065d2e218939d0671358b7be2dd8509c64758/ideaIC-2024.1.1/jdk-shared-indexes
2024-05-16 14:56:14,431 [    684]   WARN - #c.i.i.u.l.LafManagerImpl - VersionControl.Log.Commit.rowHeight = null in LookAndFeelThemeAdapter; it may lead to performance degradation
2024-05-16 14:56:14,941 [   1194]   WARN - #c.i.s.ComponentManagerImpl - org.jetbrains.kotlin.idea.gradleJava.scripting.roots.GradleBuildRootDataSerializer <clinit> requests com.intellij.util.gist.storage.GistStorage instance. Class initialization must not depend on services. Consider using instance of the service on-demand instead.
2024-05-16 14:56:15,524 [   1777]   WARN - #c.i.o.w.i.ToolWindowImpl - ToolWindow icons should be 13x13, but got: 16x16. Please fix ToolWindow (ID:  Language Servers) or icon RasterizedImageDataLoader(classLoader=com.intellij.util.lang.PathClassLoader@6adca536, path=webreferences/server.svg)
May 16, 2024 2:56:17 P.M. org.eclipse.lsp4jakarta.ls.JakartaLanguageServer initialize
INFO: Initializing Jakarta EE server
May 16, 2024 2:56:17 P.M. org.eclipse.lsp4mp.ls.MicroProfileLanguageServer initialize
INFO: Initializing MicroProfile server 0.10.0-20231005-1228 with /Users/paulg/.gradle/caches/modules-2/files-2.1/com.jetbrains/jbre/jbr_jcef-17.0.10-osx-aarch64-b1207.14/extracted/jbr_jcef-17.0.10-osx-aarch64-b1207.14/Contents/Home
May 16, 2024 2:56:17 P.M. org.eclipse.lsp4mp.ls.java.JavaTextDocuments lambda$getProjectInfo$0
WARNING: Error while getting ProjectLabelInfoEntry (classpath) for 'file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/system/SystemResource2.java'
org.eclipse.lsp4j.jsonrpc.ResponseErrorException: The request (id: 5, method: 'microprofile/java/projectLabels') has been cancelled
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:209)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:193)
    at org.eclipse.lsp4mp.ls.commons.ParentProcessWatcher.lambda$apply$0(ParentProcessWatcher.java:148)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
    at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:840)

2024-05-16 14:56:18,260 [   4513]   WARN - #c.i.o.m.LanguageLevelUtil - File not found: api23.txt
May 16, 2024 2:56:18 P.M. org.eclipse.lsp4jakarta.snippets.JakartaEESnippetRegistryLoader load
INFO: Loading snippets into registry...
2024-05-16 14:56:19,298 [   5551]   WARN - #c.i.u.x.Binding - No accessors for org.jetbrains.security.package.Package. This means that state class cannot be serialized properly. Please see https://jb.gg/ij-psoc
2024-05-16 14:57:14,034 [  60287]   WARN - #c.i.u.x.Binding - No accessors for com.intellij.platform.feedback.impl.state.DontShowAgainFeedbackState. This means that state class cannot be serialized properly. Please see https://jb.gg/ij-psoc
2024-05-16 14:57:14,035 [  60288]   WARN - #c.i.u.x.Binding - No accessors for com.intellij.platform.feedback.impl.state.CommonFeedbackSurveysState. This means that state class cannot be serialized properly. Please see https://jb.gg/ij-psoc
2024-05-16 15:00:18,213 [ 244466]   WARN - #c.i.u.x.Binding - No accessors for org.jetbrains.kotlin.cli.common.arguments.InternalArgument. This means that state class cannot be serialized properly. Please see https://jb.gg/ij-psoc
2024-05-16 17:03:27,550 [7633803]   WARN - #c.i.o.w.i.ToolWindowImpl - ToolWindow icons should be 13x13, but got: 16x16. Please fix ToolWindow (ID:  Language Servers) or icon RasterizedImageDataLoader(classLoader=com.intellij.util.lang.PathClassLoader@6adca536, path=webreferences/server.svg)
May 16, 2024 5:03:28 P.M. org.eclipse.lsp4jakarta.ls.JakartaLanguageServer initialize
INFO: Initializing Jakarta EE server
May 16, 2024 5:03:28 P.M. org.eclipse.lsp4mp.ls.MicroProfileLanguageServer initialize
INFO: Initializing MicroProfile server 0.10.0-20231005-1228 with /Users/paulg/.gradle/caches/modules-2/files-2.1/com.jetbrains/jbre/jbr_jcef-17.0.10-osx-aarch64-b1207.14/extracted/jbr_jcef-17.0.10-osx-aarch64-b1207.14/Contents/Home
May 16, 2024 5:03:28 P.M. org.eclipse.lsp4jakarta.snippets.JakartaEESnippetRegistryLoader load
INFO: Loading snippets into registry...
May 16, 2024 5:03:28 P.M. org.eclipse.lsp4mp.ls.java.JavaTextDocuments lambda$getProjectInfo$0
WARNING: Error while getting ProjectLabelInfoEntry (classpath) for 'file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/system/SystemResource2.java'
org.eclipse.lsp4j.jsonrpc.ResponseErrorException: The request (id: 5, method: 'microprofile/java/projectLabels') has been cancelled
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:209)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:193)
    at org.eclipse.lsp4mp.ls.commons.ParentProcessWatcher.lambda$apply$0(ParentProcessWatcher.java:148)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
    at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:840)

May 16, 2024 5:53:53 P.M. org.eclipse.lsp4mp.ls.java.JavaTextDocuments lambda$getProjectInfo$0
WARNING: Error while getting ProjectLabelInfoEntry (classpath) for 'file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/health/ServiceLiveHealthCheck.java'
org.eclipse.lsp4j.jsonrpc.ResponseErrorException: The request (id: 142, method: 'microprofile/java/projectLabels') has been cancelled
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:209)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:193)
    at org.eclipse.lsp4mp.ls.commons.ParentProcessWatcher.lambda$apply$0(ParentProcessWatcher.java:148)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
    at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:840)

May 16, 2024 5:53:53 P.M. org.eclipse.lsp4mp.ls.java.JavaTextDocuments lambda$getProjectInfo$0
WARNING: Error while getting ProjectLabelInfoEntry (classpath) for 'file:///Users/paulg/WASDevEx/liberty-tools-intellij/src/test/resources/projects/gradle/sampleGradleMPLSApp/src/main/java/io/openliberty/mp/sample/health/ServiceLiveHealthCheck.java'
org.eclipse.lsp4j.jsonrpc.ResponseErrorException: The request (id: 141, method: 'microprofile/java/projectLabels') has been cancelled
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:209)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:193)
    at org.eclipse.lsp4mp.ls.commons.ParentProcessWatcher.lambda$apply$0(ParentProcessWatcher.java:148)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
    at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:840)```
angelozerr commented 1 month ago

Have you another ls like jakarta ls which compute code actions.

If yes could you disable your jakarta ls and see if it is working with mp ls?

angelozerr commented 1 month ago

It is important to note that these results were achieved using the April 1 version

It is hard to know. We did a release yesterday please try it and give us feeddback

angelozerr commented 1 month ago

It is working perfectly with our IJ Quarkus with good performance, see following demo:

CodeActionMPLS

Please:

turkeylurkey commented 1 month ago

I'd like to try IJ Quarkus but when I use runIde on the source extracted from the main branch I can load a project but no language servers start, not even lsp4mp. Is there a recommended setup to run IJ Quarkus?

angelozerr commented 1 month ago

It should work without some extra configuration.

But for your problem you should go step by step. Disable the Jakarta LS (by stopping it with LSP console) and check if you see quickfixes from MP LS.

turkeylurkey commented 1 month ago

I disabled the Jakarta language server in the plugin.xml and tested with a project generated by microprofile.io. Only the lsp4mp language server was running. After typing a few blanks on the end of a line the quick fixes were not generated. First the diagnostic:

image

Next the quick fixes:

image
turkeylurkey commented 1 month ago

Just one language server is running:

image
turkeylurkey commented 1 month ago

I'm still working with the April 1 code but an associate using the 0.0.1 code is seeing similar behaviour.

angelozerr commented 1 month ago

I have no idea why you have this problem, perhaps I don't do the good usecase?

I'm trying your usecase with the following demo https://github.com/redhat-developer/lsp4ij/issues/294#issuecomment-2124466277 and it works pretyy well is it your usecase?

Please try with last version of LSP4IJ.

angelozerr commented 4 weeks ago

@turkeylurkey have you again the problem with last version of LSP4IJ?

turkeylurkey commented 3 weeks ago

We are currently stabilizing our release on the April 1 code and the latest version of LSP4IJ is in our forward development stream. What we are finding in our testing is that the more diagnostics that appear in a Java file the more likely the quick fixes do not appear.

In a testing scenario you might have a test program with a large number of errors so that you can tests all the diagnostics. In a real life scenario I expect two possibilities. 1) You are porting a large volume of code from one system to another. You'll likely have a lot of errors at once. 2) You are developing a new app and every time you type something wrong you get one diagnostic and you then fix it.

It would be best if we could support both scenarios. If a lot of diagnostics resulted in slower performance I think a lot of people would accept that. But if a lot of diagnostics causes some other feature not to work I think people will not appreciate that. So I'd like to see LSP4IJ handle a lot of diagnostics even if the language server is slow or passes large messages.

angelozerr commented 3 weeks ago

What we are finding in our testing is that the more diagnostics that appear in a Java file the more likely the quick fixes do not appear.

Without testing this usecase, I cannot do nothing. Please share a project which have this usecase and I could investigate your usecase. Thanks!

turkeylurkey commented 3 weeks ago

jakarta-sample.zip Open this project and navigate to FieldConstraintValidation.java. This file has 18 Jakarta diagnostics. If you have Jakarta diagnostics hover on one of them to see if the quick fix is displayed. Chances are 9 in 10 that the quick fix is not missing. If not missing, hit the space bar to force the diagnostics to be recalculated. Hover again to see if the quick fix is missing. If it is not missing hit space bar again. Repeat a 5 to 10 times until the quick fix(es) are missing.

I don't have a test case with a lot of MicroProfile diagnostics but I imagine it would not be hard to build.

angelozerr commented 3 weeks ago

It would be very nice if you could reproduce the problem with microprofile ls.

If I find time I will try your jakarta ls

angelozerr commented 3 weeks ago

@turkeylurkey if quickfix doesnt appear it means that the language server is not performant to collect code actions.

As I said codeaction must support resolve codeaction to compute the text edit which can be expansive.

Could you share only your jakarta lsp traces please.

angelozerr commented 3 weeks ago

@turkeylurkey it seems you have fixed your issue with mp quickfixes by aligning your mp support with our mp support in IJ quarkus https://github.com/OpenLiberty/liberty-tools-intellij/pull/814

Right?

turkeylurkey commented 2 weeks ago

To bring you up to date I have been working on this but have not yet reproduced it using just MP diagnostics. I some more ideas to try.

angelozerr commented 2 weeks ago

To bring you up to date I have been working on this but have not yet reproduced it using just MP diagnostics. I some more ideas to try.

OK Im waiting for more feedback to investigate your problem. I have never seen ptoblem with MP ls Qute and other ls that I have tested.

We have the luck that we have several users who uses lsp4ij for their ls and for the moment there are no complaints

turkeylurkey commented 1 week ago

I tried to reproduce this problem on LSP4MP but I could not. It seems to occur more when there are more Jakarta diagnostics so I wonder if it is a capacity problem (either number of messages or size of messages).

While the solution could be to make the Jakarta LS more careful with its messages (e.g. use quick fix resolve) the load is not so bad that one would expect message passing problems. LSP4IJ is supposed to be a generic component so I think it should be more forgiving of slow language servers. Could you look into this issue some more?

One way to investigate could be to add a 100ms delay to each of LSP4MPs messages. Maybe that could cause the quick fixes not to appear.

Another approach is to try Liberty Tools IntelliJ (LTI). Extract https://github.com/OpenLiberty/liberty-tools-intellij/tree/lsp4ij-market-0.0.2-integration and build it from source using gradle runIDE. It will load LSP4IJ from the JetBrains marketplace. Then extract https://github.com/eclipse/lsp4jakarta and navigate to the jakarta-sample test case in jakarta.jdt/org.eclipse.lsp4jakarta.jdt.test/projects/. Import this into Liberty Tools IntelliJ. Open class beanvalidation.FieldConstraintValidation and perform minor edits as you check to see if the quick fixes are attached to a diagnostic or not.

angelozerr commented 1 week ago

Could you please share your LSP traces with jakarta ls when you have problem.

angelozerr commented 1 week ago

LSP4IJ is supposed to be a generic component so I think it should be more forgiving of slow language servers. Could you look into this issue some more?

Have you tried to investigate the problem? I need really now to work on our intellij quarkus to do the release with LSP4IJ so I will be very busy again.

If I find time I will try to install your liberty plugin but I have seen that you did several changes in lsp4mp by copying our intellij quarkus, so perhaps you have the same problem with jakarta ls?

turkeylurkey commented 1 week ago

JakartaQFTrace.zip This is the trace after reproducing the problem. You'll see I opened the project, typed space about three times and I hovered over a diagnostic each time to check if the quick fix appears.

I have tried to debug this code before but I found the nested completable futures and lambdas difficult to debug.

angelozerr commented 1 week ago

Your trace shows exactly that I tried to explain you many times, you don't support resolve code action.

You can see that in your 'jakarta/java/codeAction' which should just return code action without edit, in another words when Quick fixes must be displayed, the LSP codeAction must be very fast and should return only codeAction label (without computed edit which is very expansive in the case of MP LS and Jakarta LS).

[Trace - 14:35:55] Sending response 'jakarta/java/codeAction - (5)'. Processing request took 6ms
Result: [
  {
    "title": "Remove constraint annotation jakarta.validation.constraints.Email from element",
    "kind": "quickfix",
    "diagnostics": [
      {
        "range": {
          "start": {
            "line": 23,
            "character": 20
          },
          "end": {
            "line": 23,
            "character": 32
          }
        },
        "severity": 1,
        "code": "FixTypeOfElement",
        "source": "jakarta-bean-validation",
        "message": "The @Email annotation can only be used on String and CharSequence type fields.",
        "data": "jakarta.validation.constraints.Email"
      }
    ],
    "edit": {
      "changes": {
        "file:///Users/paulg/Library/CloudStorage/Box-Box/demo/jakarta-sample/src/main/java/io/openliberty/sample/jakarta/beanvalidation/FieldConstraintValidation.java": [
          {
            "range": {
              "start": {
                "line": 0,
                "character": 0
              },
              "end": {
                "line": 64,
                "character": 1
              }
            },
            "newText": "package io.openliberty.sample.jakarta.beanvalidation;\n\nimport java.util.Calendar;\nimport java.util.List;\n\nimport jakarta.validation.constraints.*;\n\npublic class FieldConstraintValidation {\n\n    @AssertTrue\n    private int isHappy;                    // invalid types\n\n    @AssertFalse\n    private Double isSad;\n\n    @DecimalMax(\"30.0\")\n    @DecimalMin(\"10.0\")\n    private String bigDecimal;\n\n    @Digits(fraction \u003d 0, integer \u003d 0)\n    private boolean digits;\n\n    private Integer emailAddress;\n\n    @FutureOrPresent\n    private boolean graduationDate;\n\n    @Future\n    private double fergiesYear;\n\n    @Min(value \u003d 50)\n    @Max(value \u003d 100)\n    private boolean gpa;\n\n    @Negative\n    private boolean subZero;\n\n    @NegativeOrZero\n    private String notPos;\n\n    @NotBlank\n    private boolean saysomething;\n\n    @Pattern(regexp \u003d \"\")\n    private Calendar thisIsUsed;\n\n    @Past\n    private double theGoodOldDays;\n\n    @PastOrPresent\n    private char[] aGoodFieldName;\n\n    @Positive\n    private String[] area;\n\n    @PositiveOrZero\n    private List\u003cString\u003e maybeZero;\n\n    @AssertTrue\n    private static boolean typeValid;       // static\n\n    @Past\n    private static boolean doubleBad;      // static and invalid type\n}"
          }
        ]
      }
    },
    "data": {
      "participantId": "io.openliberty.tools.intellij.lsp4jakarta.lsp4ij.beanvalidation.BeanValidationQuickFix",
      "documentUri": "file:///Users/paulg/Library/CloudStorage/Box-Box/demo/jakarta-sample/src/main/java/io/openliberty/sample/jakarta/beanvalidation/FieldConstraintValidation.java",
      "range": {
        "start": {
          "line": 23,
          "character": 20
        },
        "end": {
          "line": 23,
          "character": 32
        }
      },
      "extendedData": {
        "annotationName": "jakarta.validation.constraints.Email"
      },
      "resourceOperationSupported": false,
      "commandConfigurationUpdateSupported": false
    }
  }
]

I suggest that you see MP LS in our IJ Quarkus (or I think you already copied/pasted our code) to do the same thing with Jakarta LS.

In our case you compute so many edits which degrade the LS performance and those edits will never used by the user ifuser don't click on the quick fix.

turkeylurkey commented 1 week ago

Hi @angelozerr ,

It is not a requirement for language servers to support resolve code action. It may be a preference, but it is not a requirement. As a base layer common component, LSP4IJ should be able to handle language servers that do not support resolve code action.

The performance of a language server should not impact the correctness of language server results because of how a base layer component like LSP4IJ behaves. Even if a language server performance is slow, LSP4IJ should be able to handle that situation.

As a client, Liberty Tools for IntelliJ has to work with the existing release of LSP4Jakarta. There is no current release of LSP4Jakarta that supports resolve code action. LSP4Jakarta does not run into this issue in the VS Code or Eclipse environment. It is unique to IntelliJ and LSP4IJ.

angelozerr commented 1 week ago

Hi @angelozerr ,

It is not a requirement for language servers to support resolve code action. It may be a preference, but it is not a requirement. As a base layer common component, LSP4IJ should be able to handle language servers that do not support resolve code action.

Indeed and it should work with another language server. Mp ls and Jakarta LS are not commons usecase since language server is running in the same JVM than IntelliJ IDE and the compute of quickfixes use a ReadAction lock which can lock the IDE and not only the LSP request process.

In short for MP ls and Jakarta LS the IJ code which compute anything must be fast to avoid locking with one ReadAction for a long time the IDE. This problem occurs only for mp and jakrta ls which delegates the codeaction compute to JDT or IJ.

The performance of a language server should not impact the correctness of language server results because of how a base layer component like LSP4IJ behaves. Even if a language server performance is slow, LSP4IJ should be able to handle that situation.

It should work like this but as explained y ou below it is not a commons use case.

As a client, Liberty Tools for IntelliJ has to work with the existing release of LSP4Jakarta. There is no current release of LSP4Jakarta that supports resolve code action. LSP4Jakarta does not run into this issue in the VS Code or Eclipse environment. It is unique to IntelliJ and LSP4IJ.

If your jakarta ls is a copy paste of mp ls Im pretty sure that jakarta ls supports resolve code action. I suggest to check that in vscode with JDT and checks you generate codeaction without edit.

If it is working like this the problem comes from your jakartals for IJ which doesnt take care of resolve code action correctly.

I remember that lsp4mp for IJ didnt take care of resolve codeaction and I had to do some fixes.

angelozerr commented 1 week ago

It may be a preference, but it is not a requirement.

No it is the capability of the language server. When I see your trace, you mention that Jakarta LS supports code action, but not resolve code action with "codeActionProvider": true:

[Trace - 14:35:44] Received response 'initialize - (1)' in 70ms.
Result: {
  "capabilities": {
    "textDocumentSync": 2,
    "hoverProvider": true,
    "completionProvider": {
      "resolveProvider": false
    },
    "codeActionProvider": true
  }
}

It should be:

    "codeActionProvider": {
        "resolveProvider": true
   }

In MP LS, we support code action provider with dynamic registration:

[Trace - 16:53:11] Received request 'client/registerCapability - (1)'
Params: {
  "registrations": [
    {
      "id": "864c618b-ab65-49eb-95b3-4be1497ce7fc",
      "method": "textDocument/codeAction",
      "registerOptions": {
        "resolveProvider": true
      }
    }
  ]
}

When I see the Jakarta LS sources it seems that you support this capability correctly https://github.com/eclipse/lsp4jakarta/blob/2ca7a71c9127f27358af208f0b2650d6e9caa3e2/jakarta.ls/src/main/java/org/eclipse/lsp4jakarta/settings/capabilities/ServerCapabilitiesConstants.java#L40

Are you sure that you consume the same Jakarta LS?

I think you should debug your Jakarta ls. You can do that by using debug port that you can configure https://github.com/redhat-developer/lsp4ij/blob/main/docs/UserGuide.md#lsp-console

Once your Jakarta LS will send the proper "resolveProvider": true, I think (if your code is the same than LSP4MP) your jakarta/java/codeAction request will have resolveSupported set to true:

[Trace - 14:36:01] Received request 'jakarta/java/codeAction - (6)'
Params: {
  "resolveSupported": true,

In your trace this flag is set to false, so it explains why you resolve edit. I suggest too that you check that in vscode too, this flag must be set to true and not false like your LSP traces.

Good luck!

turkeylurkey commented 6 days ago

There is code for code action resolve in the main branch of LSP4Jakarta, but that code was added after the last release and it is not yet available to use.

LSP4Jakarta does provide diagnostics and quick fixes without this bug for VS Code and Eclipse without support for code action resolve. In all cases it uses the delegation model where it sends a message to a remote Java model server for assistance. I think this model should work for IntelliJ too.

If performance is an issue, lsp4ij could print "loading quick fixes" in place of the quick fixes when there is an outstanding code action request until that request is fulfilled. Then when the code action message is received, the "loading quick fixes" message could be replaced by the quick fixes or nothing if there are no quick fixes.

The bottom line is that LSP4IJ should support language servers that do not support "resolve code action".

angelozerr commented 6 days ago

There is code for code action resolve in the main branch of LSP4Jakarta, but that code was added after the last release and it is not yet available to use.

LSP4Jakarta does provide diagnostics and quick fixes without this bug for VS Code and Eclipse without support for code action resolve. In all cases it uses the delegation model where it sends a message to a remote Java model server for assistance. I think this model should work for IntelliJ too.

The main problem is that you compute so many quickfixes with ReadAction lock . In your trace you can see a lot of code actions which are cancelled by ij because I think it takes too many times.

If performance is an issue, lsp4ij could print "loading quick fixes" in place of the quick fixes when there is an outstanding code action request until that request is fulfilled. Then when the code action message is received, the "loading quick fixes" message could be replaced by the quick fixes or nothing if there are no quick fixes.

I am not sure that you can customize the Quickfix popup so I dont know how to manage that. But if you know how to do that dont hesitate to create a PR

The bottom line is that LSP4IJ should support language servers that do not support "resolve code action".

LSP4IJ support quckfixes with or without resolve code action. Our LS are not a common usecase which lock ReadAction when response must be computed