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

feat: ai fix html #467

Merged
merged 2 commits into from
Jun 11, 2024
Merged

feat: ai fix html #467

merged 2 commits into from
Jun 11, 2024

Conversation

teodora-sandu
Copy link
Contributor

@teodora-sandu teodora-sandu commented Jun 6, 2024

Description

Adds the AI fix panel and some small changes (position line is a link, learn more link has an external icon, background colour matches the old one).

To test, run npm run build first before running the extension. It needs snyk/snyk-ls#527 for testing.

Checklist

  • Tests added and all succeed
  • Linted
  • CHANGELOG.md updated
  • README.md updated, if user-facing

Screenshots / GIFs

The backend isn't working at the moment so for testing I used an org that doesn't have the feature flag enabled and had to change a small part of the code so it's loading the HTML panel:

diff --git a/src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts b/src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts
index 82e57bd..640c05e 100644
--- a/src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts
+++ b/src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts
@@ -90,7 +90,7 @@ export class CodeSuggestionWebviewProvider
   }

   async showPanel(issue: Issue<CodeIssueData>): Promise<void> {
-    const isIgnoresEnabled = configuration.getFeatureFlag(FEATURE_FLAGS.consistentIgnores);
+    const isIgnoresEnabled = true;

     try {
       await this.focusSecondEditorGroup();
Screen.Recording.2024-06-07.at.16.52.14.mov

@@ -1,3 +1,23 @@
@import '../../common/vscode';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of styling is already in these stylesheets so I imported them .

}
} else {
const lineDiv = document.createElement('div');
lineDiv.className = 'example-line';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just got all of these scripts from src/snyk/snykCode/views/suggestion/codeSuggestionWebviewScript.ts, the only thing I changed was the class name so that it matches the existing one used for the example commit fixes.

A lot of these functions are related to switching tabs and rendering different elements. Some of this can be moved to snyk-ls but it would add a lot of complexity to the task and the review process so I chose to do that in a future ticket/PR. It would be a good task to do when we implement this in IntelliJ too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note that we are currently working on the refactor from tabs to arrows for the Community Fixes / Fixed Code Examples

@teodora-sandu teodora-sandu marked this pull request as ready for review June 7, 2024 16:11
@teodora-sandu teodora-sandu requested a review from a team as a code owner June 7, 2024 16:11
Copy link
Contributor

@cat2608 cat2608 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@teodora-sandu teodora-sandu merged commit 3cfd254 into main Jun 11, 2024
7 checks passed
@teodora-sandu teodora-sandu deleted the feat/ai-fix-html branch June 11, 2024 12:17
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