Inline Pasted Code Snippets

I like how sometimes pasted code snippets will appear as a block in the chat message, rather than raw text, however I would prefer it to appear inline in the message.

If I am troubleshooting an error, I might type:

When this code runs: {code block}
I get this error: {error block}
Determine the cause of the error

The times when pasted code is added as a snippet, it is added as context in seemingly no order and its not clear where they are being added into the message sent to the AI model. There is a chance that this lack of structure would lead the data provided to be interpreted incorrectly because the model might be receiving:

{error block}
{code block}
{current file}

user message = """
When this code runs:
I get this error:
Determine the cause of the error
"""

I think pasted snippets should appear inline in the message and be passed to the AI in the position that they are pasted. This would allow more natural language chat messages with relation to the pasted snippets, may impact the quality of the results. Given that its not clear how the snippet is passed to the AI, its currently not clear how I should be referencing it. Do I need to write out the ‘Snippet name’ when referring to it? If I provide two versions of the same function, I can’t reference the function name in the snippet.

An explanation of how the snippets are added as context to the request may be enough to solve this issue for me in the short-term!

1 Like