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

fix: do not purge the code action cache in language server before the action is resolved by the client [IDE-134] #5062

Conversation

bastiandoetsch
Copy link
Contributor

@bastiandoetsch bastiandoetsch commented Feb 21, 2024

Pull Request Submission

Please check the boxes once done.

The pull request must:

  • Reviewer Documentation
    • follow CONTRIBUTING rules
    • be accompanied by a detailed description of the changes
    • contain a risk assessment of the change (Low | Medium | High) with regards to breaking existing functionality. A change e.g. of an underlying language plugin can completely break the functionality for that language, but appearing as only a version change in the dependencies.
    • highlight breaking API if applicable
    • contain a link to the automatic tests that cover the updated functionality.
    • contain testing instructions in case that the reviewer wants to manual verify as well, to add to the manual testing done by the author.
    • link to the link to the PR for the User-facing documentation
  • User facing Documentation
    • update any relevant documentation in gitbook by submitting a gitbook PR, and including the PR link here
    • ensure that the message of the final single commit is descriptive and prefixed with either feat: or fix: , others might be used in rare occasions as well, if there is no need to document the changes in the release notes. The changes or fixes should be described in detail in the commit message for the changelog & release notes.
  • Testing
    • Changes, removals and additions to functionality must be covered by acceptance / integration tests or smoke tests - either already existing ones, or new ones, created by the author of the PR.

What does this PR do?

Risk: low

This PR updates Snyk Language Server to the latest version. This version provides a fix for code action handling in language server. Resolvable Code Actions are working in a two-step modus in language server: First, the action is created with a callback function stored in language server. The second step is the code action resolution. When a client calls language server with the codeaction/resolve request, the stored callback function is looked up in the cache and executed.

Previously, this cache was purged on each code action request call. This is not working well, if code action information is retained by the IDE. Therefore, the cache entry for the callback function is now only purged when the action is resolved.

Where should the reviewer start?

snyk/snyk-ls#447

How should this be manually tested?

Launch VSCode, scan with Snyk Code and autofix enabled a project that contains issues that are auto-fixable. Execute the code action to fix it.

Any background context you want to provide?

We are integrating language server Snyk Code into IntelliJ right now. When implementing the Snyk Code ExternalAnnotator (SnykCodeAnnotatorLS), the error with too early purged code actions occurred.

What are the relevant tickets?

IDE-134

Screenshots

Additional questions

Copy link
Contributor

github-actions bot commented Feb 21, 2024

Warnings
⚠️

"fix: do not purge the code action cache in language server before the action is resolved by the client [IDE-134]" is too long. Keep the first line of your commit message under 72 characters.

Generated by 🚫 dangerJS against 9775b93

@bastiandoetsch bastiandoetsch force-pushed the fix/IDE-134_dont-purge-code-action-cache-before-resolution-of-action branch 2 times, most recently from aaabdf7 to 9ba9fb4 Compare February 21, 2024 09:18
… action is resolved by the client [IDE-134]

This version provides a fix for code action handling in language server. Resolvable Code Actions are working in a two-step modus in language server: First, the action is created with a callback function stored in language server. The second step is the code action resolution. When a client calls language server with the codeaction/resolve request, the stored callback function is looked up in the cache and executed.

Previously, this cache was purged on each code action request call. This is not working well, if code action information is retained by the IDE. Therefore, the cache entry for the callback function is now only purged when the action is resolved.
@bastiandoetsch bastiandoetsch force-pushed the fix/IDE-134_dont-purge-code-action-cache-before-resolution-of-action branch from 9ba9fb4 to 9775b93 Compare February 21, 2024 09:20
@bastiandoetsch bastiandoetsch marked this pull request as ready for review February 21, 2024 09:20
@bastiandoetsch bastiandoetsch requested a review from a team as a code owner February 21, 2024 09:20
@bastiandoetsch bastiandoetsch enabled auto-merge (squash) February 21, 2024 09:39
@bastiandoetsch bastiandoetsch merged commit 4bf4333 into main Feb 21, 2024
12 checks passed
@bastiandoetsch bastiandoetsch deleted the fix/IDE-134_dont-purge-code-action-cache-before-resolution-of-action branch February 21, 2024 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants