Skip to content

Crash for copilot code blockΒ #60118

Closed
@mjbvz

Description

@mjbvz

πŸ”Ž Search Terms

  • Copilot

πŸ•— Version & Regression Information

5.7.0-dev.20240927, not a regression

⏯ Playground Link

No response

πŸ’» Code

Using copilot in VS Code:

  1. Add this selection to panel chat https://github.com/microsoft/vscode/blob/d085816005ae61fc8f39b3720b3ec4594b35ecd0/src/vs/base/common/async.ts#L1145-L1278.
  2. Have this be your current selection https://github.com/microsoft/vscode/blob/d085816005ae61fc8f39b3720b3ec4594b35ecd0/src/vs/base/test/common/async.test.ts#L1523-L1554
  3. As @workspace /tests The last work call has a delay of 51 ms, but I already waited out the throttle delay why is this and how do I fix it.
  4. πŸ› The TS Server crashes

πŸ™ Actual behavior

As the result is streaming back, we get a crash:

Err 55338 [09:24:42.710] Exception on executing command {
  "seq": 18117,
  "type": "request",
  "command": "updateOpen",
  "arguments": {
    "changedFiles": [
      {
        "fileName": "^/vscode-chat-code-block/ts-nul-authority/Users/matb/projects/vscode/src/vs/base/test/common/async.test.ts",
        "textChanges": [
          {
            "newText": "",
            "start": {
              "line": 1503,
              "offset": 1
            },
            "end": {
              "line": 1503,
              "offset": 42
            }
          }
        ]
      }
    ],
    "closedFiles": [],
    "openFiles": []
  }
}:

    Cannot read properties of undefined (reading 'charCount')

    TypeError: Cannot read properties of undefined (reading 'charCount')
        at _LineNode.walk (/Users/matb/projects/vscode/node_modules/typescript/lib/typescript.js:194903:30)
        at _LineIndex.edit (/Users/matb/projects/vscode/node_modules/typescript/lib/typescript.js:194803:17)
        at _ScriptVersionCache._getSnapshot (/Users/matb/projects/vscode/node_modules/typescript/lib/typescript.js:194609:31)
        at _ScriptVersionCache.lineOffsetToPosition (/Users/matb/projects/vscode/node_modules/typescript/lib/typescript.js:194628:17)
        at TextStorage.lineOffsetToPosition (/Users/matb/projects/vscode/node_modules/typescript/lib/typescript.js:184011:22)
        at ScriptInfo.lineOffsetToPosition (/Users/matb/projects/vscode/node_modules/typescript/lib/typescript.js:184319:29)
        at /Users/matb/projects/vscode/node_modules/typescript/lib/typescript.js:191473:40
        at mapDefinedIterator (/Users/matb/projects/vscode/node_modules/typescript/lib/typescript.js:2602:19)
        at mapDefinedIterator.next (<anonymous>)
        at _ProjectService.applyChangesToFile (/Users/matb/projects/vscode/node_modules/typescript/lib/typescript.js:190256:16)

The crash seems to happen during response streaming. During this, code blocks may be updated multiple times and the code in them may not be complete

πŸ™‚ Expected behavior

No crash

Additional information about the issue

No response

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions