Skip to content

Commit

Permalink
Merge branch 'main' into feat/lazy-load-issue-description
Browse files Browse the repository at this point in the history
  • Loading branch information
ShawkyZ committed Oct 15, 2024
2 parents ba2f1d7 + 192b431 commit 7d53675
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- New error message in UI when net new scan is done on an invalid repository. Net new scans only work on Git.
- Clear in Memory cache when branch is changed.
- Added Clear Persisted Cache command.
- Add support for ai fix feedback analytic when pressing apply on a fix.

## [2.18.2]
- Update Language Server Protocol version to 15.
Expand Down
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ Code changes require extension reload when run in debug.
## Run tests and debug

- Unit tests

- Run `npm run test:unit` for a single execution, `npm run test:unit:watch` to watch for changes.
- Make sure to re-run the command to pick up new files, if new `**.test.ts` is added.

- Integration tests
- Run `npm run test:integration`.

- Run Lint
- npm `npm run lint`

You can debug tests via VS Code debugger, selecting "Extension Unit Tests" or "Extension Integration Tests" respectively.

## Analytics, experimentation and error reporting
Expand Down
1 change: 1 addition & 0 deletions src/snyk/common/constants/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const SNYK_WORKSPACE_SCAN_COMMAND = 'snyk.workspace.scan';
export const SNYK_TRUST_WORKSPACE_FOLDERS_COMMAND = 'snyk.trustWorkspaceFolders';
export const SNYK_GET_ACTIVE_USER = 'snyk.getActiveUser';
export const SNYK_CODE_FIX_DIFFS_COMMAND = 'snyk.code.fixDiffs';
export const SNYK_CODE_SUBMIT_FIX_FEEDBACK = 'snyk.code.submitFixFeedback';
export const SNYK_FEATURE_FLAG_COMMAND = 'snyk.getFeatureFlagStatus';
export const SNYK_CLEAR_CACHE_COMMAND = 'snyk.clearCache';
export const SNYK_CLEAR_PERSISTED_CACHE_COMMAND = 'snyk.clearPersistedCache';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as vscode from 'vscode';
import {
SNYK_CODE_FIX_DIFFS_COMMAND,
SNYK_GENERATE_ISSUE_DESCRIPTION,
SNYK_CODE_SUBMIT_FIX_FEEDBACK,
SNYK_IGNORE_ISSUE_COMMAND,
SNYK_OPEN_BROWSER_COMMAND,
SNYK_OPEN_LOCAL_COMMAND,
Expand Down Expand Up @@ -273,7 +274,7 @@ export class CodeSuggestionWebviewProvider
}

case 'applyGitDiff': {
const { patch, filePath } = message.args;
const { patch, filePath, fixId } = message.args;

const fileContent = readFileSync(filePath, 'utf8');
const patchedContent = applyPatch(fileContent, patch);
Expand All @@ -300,6 +301,11 @@ export class CodeSuggestionWebviewProvider
this.highlightAddedCode(filePath, patch);
this.setupCloseOnSave(filePath);

try {
await vscode.commands.executeCommand(SNYK_CODE_SUBMIT_FIX_FEEDBACK, fixId, 'FIX_APPLIED');
} catch (e) {
throw new Error('Error in submit fix feedback');
}
break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
args: {
patch: string;
filePath: string;
fixId: string;
};
};

Expand Down Expand Up @@ -244,10 +245,11 @@
const diffSuggestion = suggestion.diffs[diffSelectedIndex];
const filePath = suggestion.filePath;
const patch = diffSuggestion.unifiedDiffsPerFile[filePath];
const fixId = suggestion.id;

const message: ApplyGitDiffMessage = {
type: 'applyGitDiff',
args: { filePath, patch },
args: { filePath, patch, fixId },
};
sendMessage(message);
}
Expand Down
1 change: 1 addition & 0 deletions src/snyk/snykCode/views/suggestion/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export type ApplyGitDiffMessage = {
args: {
patch: string;
filePath: string;
fixId: string;
};
};

Expand Down

0 comments on commit 7d53675

Please sign in to comment.