Skip to content

Overlapping ranges are not allowed! when discarding edits #204592

Open

Description

Discarded edits from inline and got the error below

 ERR Error: Overlapping ranges are not allowed!
    at S.applyEdits (pieceTreeTextBuffer.ts:311:12)
    at U.xb (textModel.ts:1427:31)
    at U.applyEdits (textModel.ts:1417:16)
    at l.pushEditOperation (editStack.ts:429:45)
    at U.vb (textModel.ts:1365:31)
    at U.pushEditOperations (textModel.ts:1271:16)
    at R.discardAll (inlineChatSession.ts:729:20)
    at P.cancel (inlineChatStrategies.ts:78:33)
    at P.cancel (inlineChatStrategies.ts:487:16)
    at G.CANCEL (inlineChatController.ts:885:38)
    at G.R (inlineChatController.ts:288:36)
    at async G.run (inlineChatController.ts:267:4)
Details

{
"session": {
"id": 2,
"placeholder": "Ask Copilot to edit code...",
"slashCommands": [
{
"command": "doc",
"detail": "Add documentation comment for this symbol",
"executeImmediately": true
},
{
"command": "tests",
"detail": "Generate unit tests for the selected code"
},
{
"command": "fix",
"detail": "Propose a fix for the problems in the selected code"
},
{
"command": "explain",
"detail": "Explain how the selected code works",
"refer": true
}
],
"wholeRange": {
"startLineNumber": 369,
"startColumn": 1,
"endLineNumber": 399,
"endColumn": 1
},
"message": "$(copilot-logo) Copilot generated code may be incorrect"
},
"when": "2024-02-07T12:05:33.032Z",
"exchanges": [
{
"prompt": "add doc to all these classes",
"res": {
"wholeRange": {
"startLineNumber": 369,
"startColumn": 1,
"endLineNumber": 399,
"endColumn": 1
},
"id": 0,
"type": "editorEdit",
"edits": [
{
"text": "/\n * One request/response pair in chat history.\n */\nexport interface ChatAgentHistoryEntry {\n\t/\n\t * The request that was sent to the chat agent.\n\t */\n\trequest: ChatAgentRequest;\n\n\t/\n\t * The content that was received from the chat agent. Only the progress parts that represent actual content (not metadata) are represented.\n\t */\n\tresponse: (ChatAgentContentProgress | ChatResponseTextPart | ChatResponseMarkdownPart | ChatResponseFilesPart | ChatResponseAnchorPart)[];\n\n\t/\n\t * The result that was received from the chat agent.\n\t */\n\tresult: ChatAgentResult2;\n}\n\n/\n * Represents an error result from a chat request.\n */\nexport interface ChatAgentErrorDetails {\n\t/\n\t * An error message that is shown to the user.\n\t */\n\tmessage: string;\n\n\t/\n\t * If partial markdown content was sent over the progress callback before the response terminated, then this flag\n\t * can be set to true and it will be rendered with incomplete markdown features patched up.\n\t *\n\t * For example, if the response terminated after sending part of a triple-backtick code block, then the editor will\n\t * render it as a complete code block.\n\t */\n\tresponseIsIncomplete?: boolean;\n\n\t/\n\t * If set to true, the response will be partly blurred out.\n\t */\n\tresponseIsFiltered?: boolean;\n}\n\n/\n * The result of a chat request.\n */\nexport interface ChatAgentResult2 {\n\t/\n\t * If the request resulted in an error, this property defines the error details.\n\t */\n\terrorDetails?: ChatAgentErrorDetails;\n\n\t// TODO@API\n\t// add CATCH-all signature [name:string]: string|boolean|number instead of T extends...\n\t// readonly metadata: { readonly [key: string]: any };\n}\n\n/\n * Represents the type of user feedback received.\n */\nexport enum ChatAgentResultFeedbackKind {\n\t/\n\t * The user marked the result as helpful.\n\t */\n\tUnhelpful = 0,\n\n\t/\n\t * The user marked the result as unhelpful.\n\t */\n\tHelpful = 1,\n}\n\n/\n * Represents user feedback for a result.\n */\nexport interface ChatAgentResult2Feedback {\n\t/\n\t * This instance of ChatAgentResult2 is the same instance that was returned from the chat agent,\n\t * and it can be extended with arbitrary properties if needed.\n\t */\n\treadonly result: TResult;\n\n\t/\n\t * The kind of feedback that was received.\n\t */\n\treadonly kind: ChatAgentResultFeedbackKind;\n}\n\n/\n * Represents a subCommand of a chat agent.\n */\nexport interface ChatAgentSubCommand {\n\t/\n\t * A short name by which this command is referred to in the UI, e.g. fix or\n\t * explain for commands that fix an issue or explain code.\n\t *\n\t * Note: The name should be unique among the subCommands provided by this agent.\n\t */\n\treadonly name: string;\n\n\t/\n\t * Human-readable description explaining what this command does.\n\t */\n\treadonly description: string;\n\n\t/\n\t * When the user clicks this subCommand in /help, this text will be submitted to this subCommand\n\t */\n\treadonly sampleRequest?: string;\n\n\t/\n\t * Whether executing the command puts the\n\t * chat into a persistent mode, where the\n\t * subCommand is prepended to the chat input.\n\t */\n\treadonly shouldRepopulate?: boolean;\n\n\t/\n\t * Placeholder text to render in the chat input\n\t * when the subCommand has been repopulated.\n\t * Has no effect if shouldRepopulate is false.\n\t */\n\treadonly followupPlaceholder?: string;\n}\n\n/\n * Represents a provider of subCommands for a chat agent.\n */\nexport interface ChatAgentSubCommandProvider {\n\t/\n\t * Returns a list of subCommands that its agent is capable of handling. A subCommand\n\t * can be selected by the user and will then be passed to the {@link ChatAgentHandler handler}\n\t * via the {@link ChatAgentRequest.subCommand subCommand} property.\n\t *\n\t * @param token A cancellation token.\n\t * @returns A list of subCommands. The lack of a result can be signaled by returning undefined, null, or\n\t * an empty array.\n\t */\n\tprovideSubCommands(token: CancellationToken): ProviderResult<ChatAgentSubCommand[]>;\n}\n\n/\n * Represents a followup command to be executed after a chat agent request.\n */\nexport interface ChatAgentCommandFollowup {\n\tcommandId: string;\n\targs?: any[];\n\ttitle: string; // supports codicon strings\n\twhen?: string;\n}\n\n/\n * Represents a followup reply to be sent after a chat agent request.\n */\nexport interface ChatAgentReplyFollowup {\n\t/\n\t * The message to send to the chat.\n\t */\n\tmessage: string;\n\n\t/\n\t * A tooltip to show when hovering over the followup.\n\t */\n\ttooltip?: string;\n\n\t/\n\t * A title to show the user, when it is different than the message.\n\t */\n\ttitle?: string;\n}\n\n/\n * Represents a followup action suggested by the chat agent.\n */\nexport type ChatAgentFollowup = ChatAgentCommandFollowup | ChatAgentReplyFollowup;\n\n/\n * Represents a provider of followup actions for a chat agent result.\n */\nexport interface ChatAgentFollowupProvider {\n\t/\n\t * Provides a list of followup actions to be shown to the user after a chat agent request.\n\t *\n\t * @param result The same instance of the result object that was returned by the chat agent, and it can be extended with arbitrary properties if needed.\n\t * @param token A cancellation token.\n\t */\n\tprovideFollowups(result: TResult, token: CancellationToken): ProviderResult<ChatAgentFollowup[]>;\n}\n\n/\n * Represents a chat agent.\n */\nexport interface ChatAgent2 {\n\t/\n\t * The short name by which this agent is referred to in the UI, e.g workspace.\n\t */\n\treadonly name: string;\n\n\t/\n\t * The full name of this agent.\n\t */\n\tfullName: string;\n\n\t/\n\t * A human-readable description explaining what this agent does.\n\t */\n\tdescription: string;\n\n\t/\n\t * Icon for the agent shown in UI.\n\t */\n\ticonPath?: Uri | {\n\t\t/\n\t\t * The icon path for the light theme.\n\t\t */\n\t\tlight: Uri;\n\t\t/\n\t\t * The icon path for the dark theme.\n\t\t */\n\t\tdark: Uri;\n\t} | ThemeIcon;\n\n\t/\n\t * The provider for subCommands of this agent.\n\t */\n\tsubCommandProvider?: ChatAgentSubCommandProvider;\n\n\t/\n\t * The provider for followup actions of this agent.\n\t */\n\tfollowupProvider?: ChatAgentFollowupProvider;\n\n\t/\n\t * When the user clicks this agent in /help, this text will be submitted to this subCommand\n\t */\n\tsampleRequest?: string;\n\n\t/\n\t * An event that fires whenever feedback for a result is received, e.g. when a user up- or down-votes\n\t * a result.\n\t *\n\t * The passed {@link ChatAgentResult2Feedback.result result} is guaranteed to be the same instance that was\n\t * previously returned from this chat agent.\n\t */\n\tonDidReceiveFeedback: Event<ChatAgentResult2Feedback>;\n\n\t/\n\t * Dispose this agent and free resources.\n\t */\n\tdispose(): void;\n}\n\n/\n * Represents a chat agent request.\n */\nexport interface ChatAgentRequest {\n\t/\n\t * The prompt entered by the user. The {@link ChatAgent2.name name} of the agent or the {@link ChatAgentSubCommand.name subCommand}\n\t * are not part of the prompt.\n\t *\n\t * @see {@link ChatAgentRequest.subCommand}\n\t */\n\tprompt: string;\n\n\t/\n\t * The ID of the chat agent to which this request was directed.\n\t */\n\tagentId: string;\n\n\t/\n\t * The name of the {@link ChatAgentSubCommand subCommand} that was selected for this request.\n\t */\n\tsubCommand?: string;\n\n\t/\n\t * Variables associated with the chat agent request.\n\t */\n\tvariables: Record<string, ChatVariableValue[]>;\n}\n\n/\n * Represents a stream of responses from a chat agent.\n */\nexport interface ChatAgentResponseStream {\n\t/\n\t * Push a text part to this stream.\n\t *\n\t * @param value A plain text value.\n\t * @returns This stream.\n\t */\n\ttext(value: string): ChatAgentResponseStream;\n\n\t/\n\t * Push a markdown part to this stream.\n\t *\n\t * @param value A markdown string or a string that should be interpreted as markdown.\n\t * @returns This stream.\n\t */\n\tmarkdown(value: string | MarkdownString): ChatAgentResponseStream;\n\n\t/\n\t * Push an anchor part to this stream.\n\t *\n\t * @param value A uri or location.\n\t * @param title An optional title that is rendered with value.\n\t * @returns This stream.\n\t */\n\tanchor(value: Uri | Location, title?: string): ChatAgentResponseStream;\n\n\t/\n\t * Push a file part to this stream.\n\t *\n\t * @param value File tree data.\n\t * @param baseUri The base uri to which this file tree is relative to.\n\t * @returns This stream.\n\t */\n\tfiles(value: ChatAgentFileTreeData, baseUri: Uri): ChatAgentResponseStream;\n\n\t/\n\t * Push a progress part to this stream.\n\t *\n\t * @param value A progress message.\n\t * @returns This stream.\n\t */\n\tprogress(value: string): ChatAgentResponseStream;\n\n\t/\n\t * Push a reference part to this stream.\n\t *\n\t * @param value A uri or location.\n\t * @returns This stream.\n\t */\n\treference(value: Uri | Location): ChatAgentResponseStream;\n}\n\n/\n * Represents a chat agent response.\n */\nexport interface ChatAgentResponse {\n\t/\n\t * The stream of responses from the chat agent.\n\t */\n\tstream: ChatAgentResponseStream;\n}\n\n/\n * Represents a chat agent file tree data.\n */\nexport interface ChatAgentFileTreeData {\n\t// TODO: Define the structure of the file tree data.\n}\n\n/\n * Represents a value of a chat variable.\n */\nexport type ChatVariableValue = string | number | boolean | null | undefined;\n\n/\n * Represents a cancellation token.\n */\nexport interface CancellationToken {\n\t/\n\t * Is true when the token has been cancelled, false otherwise.\n\t */\n\tisCancellationRequested: boolean;\n}\n\n/\n * Represents a provider result.\n */\nexport type ProviderResult = T | undefined | null;\n\n/\n * Represents a markdown string.\n */\nexport interface MarkdownString {\n\t// TODO: Define the structure of the markdown string.\n}\n\n/\n * Represents a URI.\n */\nexport interface Uri {\n\t// TODO: Define the structure of the URI.\n}\n\n/\n * Represents a location.\n */\nexport interface Location {\n\t// TODO: Define the structure of the location.\n}\n\n/\n * Represents a theme icon.\n */\nexport interface ThemeIcon {\n\t// TODO: Define the structure of the theme icon.\n}\n\n/\n * Represents an event.\n */\nexport interface Event {\n\t// TODO: Define the structure of the event.\n}\n",
"range": {
"startLineNumber": 6,
"startColumn": 1,
"endLineNumber": 342,
"endColumn": 1
}
}
]
}
}
]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugimportantIssue identified as high-priorityinline-chat

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions