-
Notifications
You must be signed in to change notification settings - Fork 30
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
Feat: display preview to AI fix #445
Conversation
src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts
Outdated
Show resolved
Hide resolved
src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts
Outdated
Show resolved
Hide resolved
src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts
Outdated
Show resolved
Hide resolved
src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts
Outdated
Show resolved
Hide resolved
src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts
Outdated
Show resolved
Hide resolved
src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts
Outdated
Show resolved
Hide resolved
src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts
Outdated
Show resolved
Hide resolved
src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts
Outdated
Show resolved
Hide resolved
src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts
Outdated
Show resolved
Hide resolved
src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts
Outdated
Show resolved
Hide resolved
src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts
Outdated
Show resolved
Hide resolved
src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts
Outdated
Show resolved
Hide resolved
src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts
Outdated
Show resolved
Hide resolved
src/snyk/snykCode/views/suggestion/codeSuggestionWebviewScript.ts
Outdated
Show resolved
Hide resolved
src/snyk/snykCode/views/suggestion/codeSuggestionWebviewScript.ts
Outdated
Show resolved
Hide resolved
src/snyk/snykCode/views/suggestion/codeSuggestionWebviewScript.ts
Outdated
Show resolved
Hide resolved
src/snyk/snykCode/views/suggestion/codeSuggestionWebviewScript.ts
Outdated
Show resolved
Hide resolved
src/snyk/snykCode/views/suggestion/codeSuggestionWebviewScript.ts
Outdated
Show resolved
Hide resolved
src/snyk/snykCode/views/suggestion/codeSuggestionWebviewScript.ts
Outdated
Show resolved
Hide resolved
src/snyk/snykIac/views/suggestion/iacSuggestionWebviewScript.ts
Outdated
Show resolved
Hide resolved
88f2892
to
a95a72e
Compare
2a542ee
to
62aceeb
Compare
src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts
Outdated
Show resolved
Hide resolved
9d45448
to
73828eb
Compare
Not sure what the convention for these two are if someone can help :) I'm guessing merging to main wont release a new version immediately so not sure what exact contents to put in For README.md's case, I dont see any case where it needs to be updated - possibly because AI Fix is still an opt in feature? But I could be wrong :) |
IMHO, error handling is a pretty big deal considering the state of Code Fix AI services. But also, this is a tech debt, so I'm going to leave it for @bastiandoetsch to decide and unblock it from my side. |
@MichaelAquilina could you please also add a task for application workflow. |
wrote in a comment below. this PR is pretty big and my comment might be considered not vital to it right now
@bastiandoetsch might have to confirm this for me, but from what I can tell - these errors are actually originating from the Snyk language server not visual studio code. So fixing them would involve making separate changes in the language server (which is out of scope of this PR at the very least) |
constructor() {} | ||
async deserializeWebviewPanel(webviewPanel: vscode.WebviewPanel): Promise<void> { | ||
// we want to make sure the panel is closed on startup | ||
webviewPanel.dispose(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bastiandoetsch I tried making this dispose
on extension deactivation but it did not seem to work.
This solution I came up with here feels a bit hacky, but it does work as expected.
Please let me know if you can think of a better way to make sure the panel is closed if the user restarts their editor 🙏🏼
a62afe6
to
16d2e89
Compare
Hi @bastiandoetsch. Is there anything I can help with moving this along? I guess next stage is get the PR approved and prepare it for release? |
Didn't manage to review it, yet. It's high on my todo list, though! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so I thought this was something that would need to change on the language server, but thinking about it, we show the |
No you haven't, the HTTP 500 triggers the language server command handler to popup the dialog. The Oh Snap! message uses a different call/methodology. We can filter it though - I'll take care of that in the getAutofixDiffs command. If we had better HTTP codes on the backend, it would be easier, as we don't have any chance to report real errors, if we filter on the language server side. |
3fc3f80
to
3c2085c
Compare
a95fc69
to
7f4af0d
Compare
7f4af0d
to
220eb04
Compare
👏 👏 👏 |
Description
Add a new display preview when generating AI Fixes instead of them being applied to the user's code immediately.
The changes can be applied by the user with the "Apply Fix" button if they are happy with the changes being suggested.
If clicked, the updated code will be temporarily highlighted until either:
Checklist
Screenshots / GIFs
Screencast.from.2024-04-05.10-13-39.webm
Screencast.from.2024-04-17.16-47-21.webm