Open fawwazanvilen opened 1 month ago
Hey @fawwazanvilen , thanks for the great writeup here! Would definitely appreciate a PR to address this issue.
I think that the Math.max(0, lineNumber)
approach seems solid. If you're able to write a quick unit test for this work after your updates that would be helpful as well.
Before submitting your bug report
Relevant environment info
Description
Hello Continue.dev team!
I've encountered a bug in the VSCode extension where negative line numbers are causing errors. Here are the details:
Description: The
showLines
function is throwing an error when it receives negative line numbers. This is causing problems when trying to display certain code snippets.Error Message:
Error: Illegal argument: line must be non-negative
Proposed Solution: We could modify the
showLines
function to handle negative line numbers gracefully. Here's a possible approach:Math.max(0, lineNumber)
.Affected Files: The main file that needs to be updated is likely
extensions/vscode/src/ideProtocol.ts
, but we may need to make similar changes in other files that callshowLines
. TheCodeSnippetPreview.tsx
file seems particularly suspicious because it's doing some string parsing and integer conversion, which could potentially lead to negative numbers.Additional Context: This fix will improve the robustness of the extension and prevent crashes due to unexpected negative line numbers.
I'd be happy to work on a PR to fix this issue if you think this approach sounds good. Let me know if you need any additional information or have any questions!
Thanks for your time and for maintaining this awesome project! 😊
To reproduce
Log output