From 383c3131dad00c548c8fda0522dc208e5961395f Mon Sep 17 00:00:00 2001 From: Berkay Berabi Date: Mon, 14 Oct 2024 16:25:21 +0200 Subject: [PATCH] fix/autofix: fixed handling of empty suggestions (#536) Co-authored-by: Abdelrahman Shawki Hassan --- .../views/suggestion/codeSuggestionWebviewProvider.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts b/src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts index 584506f54..5c5cdd33c 100644 --- a/src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts +++ b/src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts @@ -265,9 +265,8 @@ export class CodeSuggestionWebviewProvider relativePath, issueId, ); - if (diffs.length === 0) { - throw Error('Unable to generate a relevant fix'); - } + // todo(berkay.berabi): Here if suggestions are empty, we should post a different type of message that + // will show the user correct information, namely: we tried but no fixes available for now. void this.postSuggestMessage({ type: 'setAutofixDiffs', args: { suggestion, diffs } }); } catch (error) {