microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.86k stars 29.51k forks source link

Support markdowns in `PreparedToolInvocation.invocationMessage` #230900

Open DonJayamanne opened 1 month ago

DonJayamanne commented 1 month ago

The current type for the property invocationMessage is string. However if we provide a markdown string it will get rendered. However if there are some line breaks, then things don't get rendered correctly.

Suggest we either treat this as a bug and fix Or disallow rendering markdown for strings returned (else users will always try to hack this)


    /**
     * The result of a call to {@link LanguageModelTool.prepareToolInvocation}.
     */
    export interface PreparedToolInvocation {
        /**
         * A customized progress message to show while the tool runs.
         */
        invocationMessage?: string;

        /**
         * Customized messages to show when asking for user confirmation to run the tool.
         */
        confirmationMessages?: LanguageModelToolConfirmationMessages;
    }
DonJayamanne commented 1 month ago

Here's what happens with markdown in this string

The word Evaluating is rendered in the first columnn, and rest of the md (Python code) in a second column. Also the # comments in Python code is treated as markdown ('```python' code blocks) are not handled. Image

The word Evaluating is rendered in the first columnn, and rest of the md (Python code) in a second column. Image

I found that returning a simple markdown such as '```python\n,/n```' will get rendered beautifully