-
Notifications
You must be signed in to change notification settings - Fork 110
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
genai comments #605
base: main
Are you sure you want to change the base?
genai comments #605
Conversation
/test |
/genai-foobar |
1 similar comment
/genai-foobar |
/genai-foo |
/genai-foobar |
1 similar comment
/genai-foobar |
...rest, | ||
timestamp: new Date(timestamp), | ||
reactions: reactions.map((r) => ({ ...r, iconPath: "" })), | ||
mode: vscode.CommentMode.Preview, |
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.
The iconPath for the reactions is set to an empty string. This might lead to missing icons for the reactions in the comments.
generated by pr-review-commit
missing_icon_path
thread.canReply = true | ||
thread.state = resolved | ||
? vscode.CommentThreadState.Resolved | ||
: vscode.CommentThreadState.Unresolved |
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.
The state of the comment thread is either set to Resolved or Unresolved. There might be other states that are not handled.
generated by pr-review-commit
unhandled_state
? vscode.CommentThreadState.Resolved | ||
: vscode.CommentThreadState.Unresolved | ||
} | ||
}) |
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.
There is no error handling in the workspace change event. If an error occurs while processing the entries, it might lead to unexpected behavior.
generated by pr-review-commit
missing_error_handling
@@ -57,6 +58,7 @@ async function resolveExpansionVars( | |||
secrets[secret] = value | |||
} else trace.error(`secret \`${secret}\` not found`) | |||
} | |||
const comments = await commentsForSource(template.id) |
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.
You might have forgotten to use 'await' before calling the async function 'commentsForSource'.
generated by pr-review-commit
missing_await
const { reactions, timestamp, ...rest } = comment | ||
return { | ||
...rest, | ||
timestamp: new Date(timestamp), |
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.
You should validate the 'timestamp' before converting it to a Date object to avoid potential runtime errors.
generated by pr-review-commit
missing_date_validation
const r = new JSONLineCache<K, V>(name) | ||
host.userState[key] = r | ||
if (!snapshot) host.userState[key] = r | ||
return r |
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.
The function byName
does not handle the case when options
is undefined. This could lead to a TypeError when trying to destructure snapshot
from options
. Consider adding a default value for options
in the function parameters or a check for options
before destructuring. 🛠️
generated by pr-review-commit
missing_error_handling
const cache = commentsCache() | ||
const entries = await cache.entries() | ||
return entries.map(({ val }) => val).filter((c) => c.source === source) | ||
} |
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.
The function commentsCache
does not handle the case when options
is undefined. This could lead to a TypeError when passing options
to JSONLineCache.byName
. Consider adding a default value for options
in the function parameters or a check for options
before passing it to JSONLineCache.byName
. 🛠️
generated by pr-review-commit
missing_error_handling
const cache = commentsCache() | ||
const entries = await cache.entries() | ||
return entries.map(({ val }) => val).filter((c) => c.source === source) | ||
} |
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.
The function commentsCache
does not have a return type. It is a good practice to always specify return types for better readability and maintainability.
generated by pr-review-commit
missing_return_type
@@ -67,6 +69,7 @@ async function resolveExpansionVars( | |||
}, | |||
vars: attrs, | |||
secrets, | |||
comments, | |||
} |
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.
The variable res
does not have a type annotation. It is a good practice to always specify types for better readability and maintainability.
generated by pr-review-commit
missing_type_annotation
const r = new JSONLineCache<K, V>(name) | ||
host.userState[key] = r | ||
if (!snapshot) host.userState[key] = r | ||
return r |
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.
The name
parameter in the byName
method is not validated for being a non-empty string. This could lead to unexpected behavior if an empty string or a string with only whitespace is passed.
generated by pr-review-commit
missing_validation
: vscode.CommentThreadState.Unresolved | ||
} | ||
}) | ||
} |
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.
The activateComments
function creates comment threads and pushes them to the subscriptions
array, but there is no cleanup logic to remove these subscriptions when they are no longer needed. This could potentially lead to memory leaks.
generated by pr-review-commit
missing_cleanup
No description provided.