Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate quickfixes present for the diagnostics. #538

Open
aparnamichael opened this issue Nov 14, 2024 · 2 comments
Open

Duplicate quickfixes present for the diagnostics. #538

aparnamichael opened this issue Nov 14, 2024 · 2 comments

Comments

@aparnamichael
Copy link
Contributor

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.

@TrevCraw
Copy link
Contributor

Notes from discussion with @mrglavas and @turkeylurkey:

  • We believe that this issue was introduced by these changes - 16c0844 - which were part of resolving this issue - Add quick-fix for Jakarta CDI Produces, Inject, Disposes, Observes/ObservesAsync diagnostics #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
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants