rubberduck-ai / rubberduck-vscode

Use AI-powered code edits, explanations, code generation, error diagnosis, and chat in Visual Studio Code with the official OpenAI API.
https://marketplace.visualstudio.com/items?itemName=Rubberduck.rubberduck-vscode
MIT License
583 stars 72 forks source link

"Explain code" should explain the current file when no code is selected #13

Open AnthonyLenglet opened 1 year ago

AnthonyLenglet commented 1 year ago

Is this request related to a problem? Please describe.

Currently, whenever you select the option "explain code", not selecting any code in the file gives you the error Variable 'selectedText' is too short, forcing you to select the entire file before asking for the AI to explain the entire code

Describe the solution you'd like

Whenever no code is selected, the selectedText variable should be equal to the entirety of the file currently in focus

lgrammel commented 1 year ago

I agree. The reason selections are required at the moment is that the prompt input size is limited (4096 tokens - tokens reserved for the response), so you'd run into errors with larger files. But that could be solved with a different error message.

trymeouteh commented 4 months ago

https://github.com/rubberduck-ai/rubberduck-vscode/issues/119