Closed salomartin closed 1 year ago
@salomartin thanks for the suggestion. In order to send a natural language prompt, initially you need to identify where the culprit is in your code if there is a compilation issue. In that case you can use, ChatGPT: Find problems
to ask it to analyze and find the issue.
Are you thinking more of an automated way of doing it? If so, could you elaborate a little bit more on this? I like the idea of enriching our feature set but just want to understand more on your scenario
In this case I executed python code that gpt had suggested with the vscode run command and got this output in the python debug console. In this case, i just then manually copy-pasted this over to gpt and asked how to fix this issue. It took a few iterations to get it right. If the question to suggest a fix was sent to gpt automatically after running code, it could reduce the iteration time. Of course we could go on from here and get it to apply the fix too, but that'd be a new suggestion already :-)
Output from the debug-console:
Traceback (most recent call last):
File "code_suggested_by_gpt.py", line 34, in
Runtime errors are maybe a bit too language/version specific?
Maybe compiler errors have a better internal interface in vscode. While programming flutter/Dart, I often get suggestions from before breaking changes. When I insert that code, I get errors in the "problems" tab (bottom) after a second (some dart tooling is used there). Maybe it's similar for other languages/frameworks.
It would be cool, if those error descriptions get feed back directly into a prompt "Repair this problem", or something.
When code execution fails, it could automatically take the error message & traceback and ask GPT to suggest a fix. Could be a setting to toggle this to run automatically or have it manually triggered on demand.
Would be a great alternative to just asking what's wrong with a piece of code.