lsp4jakarta icon indicating copy to clipboard operation
lsp4jakarta copied to clipboard

Duplicate quickfixes present for the diagnostics.

Open aparnamichael opened this issue 1 year ago • 2 comments

Duplicate quick fixes are showing for InvalidProducerMethodParamAnnotation and InvalidDisposerMethodParamAnnotation in VS Code.

Diagnostics

  • A producer method cannot have parameter(s) annotated with @Disposes, @Observes, @ObservesAsync.jakarta-cdi(InvalidProducerMethodParamAnnotation)
  • A disposer method cannot have parameter(s) annotated with @Observes, @ObservesAsync.jakarta-cdi(InvalidDisposerMethodParamAnnotation)

image

image

This issue does not exist in the latest released version of lsp4Jakarta. This behavior is observed in the current main branch code as of November 14, 2024.

aparnamichael avatar Nov 14 '24 07:11 aparnamichael

Notes from discussion with @mrglavas and @turkeylurkey:

  • We believe that this issue was introduced by these changes - https://github.com/eclipse/lsp4jakarta/commit/16c0844a481a252c86918b9f30d33037fb6e9103 - which were part of resolving this issue - https://github.com/eclipse/lsp4jakarta/issues/134.
  • The reason behind the duplicate quick fixes is that they apply to both diagnostics that are being flagged on the same method.
    • Through investigation, we believe the language server is working as intended.
  • This behaviour is not observed in Eclipse or IntelliJ.
    • Eclipse only shows one diagnostic at a time, so we believe it only shows quick fixes associated with the displayed diagnostic.
    • It appears that either LSP4IJ or IntelliJ is filtering the quick fix list at some stage to remove duplicates

TrevCraw avatar Nov 14 '24 16:11 TrevCraw

Given the above, these are the options that were discussed:

  1. Consider design changes to update the interface/API for code actions in LSP4Jakarta
    • Come up with a way of filtering duplicate quick fixes
    • Not sure if this will work for Eclipse, and it may be redundant for IntelliJ
    • This may be a poor design option since the quick fixes would lose their connection to their associated diagnostics
  2. Filter the quick fix list at the VS Code client level
    • This is probably the most ideal solution, but we are not sure if this is possible
  3. Filter the quick fix list only for the VS Code flow in LSP4Jakarta
    • Not sure if this is possible either
    • The idea here would be to find the highest level point in LSP4Jakarta where the VS Code communication flow for code actions starts and see if it is possible to filter the quick fix list at this point.
    • Similar to (1), the concern would be losing connection between diagnostics and quick fixes
    • We are also not sure if there is a spot in LSP4Jakarta that is unique to the VS Code flow where we can make this change
    • We would need to ensure that Eclipse and IntelliJ are not impacted.

More investigation into these options would be required.

TrevCraw avatar Nov 14 '24 16:11 TrevCraw

This issue should be fixed as part of issue #540 fix. Will be conducting regressions for the same.

archana-1924 avatar Aug 18 '25 18:08 archana-1924

The solution implemented for #540 was further discussed and changed. Hence, there won't be any dependency on #540 anymore.

archana-1924 avatar Nov 04 '25 06:11 archana-1924