eclipse-theia / theia

Eclipse Theia is a cloud & desktop IDE framework implemented in TypeScript.
http://theia-ide.org
Eclipse Public License 2.0
19.9k stars 2.49k forks source link

[ts] TS Server error: Error: Debug Failure. Invalid cast. #7342

Open kittaakos opened 4 years ago

kittaakos commented 4 years ago

Description

I got this when I used the TS feature inside the electron-example started from the sources. I was editing the `electron-menu-contribution.ts` module: ``` Error: TypeScript Server Error (3.6.3) Debug Failure. Invalid cast. The supplied value [object Object] did not pass the test 'isLabeledStatement'. Error: Debug Failure. Invalid cast. The supplied value [object Object] did not pass the test 'isLabeledStatement'. at Object.cast (tsserver.js:1457:25) at doChange (tsserver.js:120116:39) at tsserver.js:120108:96 at Function.ChangeTracker.with (tsserver.js:114831:17) at Object.getCodeActions (tsserver.js:120108:64) at tsserver.js:115852:121 at Object.flatMap (tsserver.js:583:25) at Object.getFixes (tsserver.js:115852:23) at tsserver.js:125866:35 at Object.flatMap (tsserver.js:583:25) at Object.getCodeFixesAtPosition (tsserver.js:125864:23) at IOSession.Session.getCodeFixes (tsserver.js:135063:64) at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (tsserver.js:133850:61) at tsserver.js:135256:88 at IOSession.Session.executeWithRequestId (tsserver.js:135247:28) at IOSession.Session.executeCommand (tsserver.js:135256:33) at IOSession.Session.onMessage (tsserver.js:135279:35) at Interface. (tsserver.js:136594:27) at Interface.emit (events.js:182:13) at Interface._onLine (readline.js:290:10) at Interface._normalWrite (readline.js:433:12) at Socket.ondata (readline.js:149:10) at Socket.emit (events.js:182:13) at addChunk (_stream_readable.js:283:12) at readableAddChunk (_stream_readable.js:264:11) at Socket.Readable.push (_stream_readable.js:219:10) at Pipe.onStreamRead [as onread] (internal/stream_base_commons.js:94:17) at Function.create (/Users/akos.kitta/Desktop/theia/plugins/vscode-builtin-typescript-language-features/extension/dist/extension.js:53:63406) at h.dispatchResponse (/Users/akos.kitta/Desktop/theia/plugins/vscode-builtin-typescript-language-features/extension/dist/extension.js:53:56561) at h.dispatchMessage (/Users/akos.kitta/Desktop/theia/plugins/vscode-builtin-typescript-language-features/extension/dist/extension.js:53:55459) at _reader.onData.e (/Users/akos.kitta/Desktop/theia/plugins/vscode-builtin-typescript-language-features/extension/dist/extension.js:53:54935) at /Users/akos.kitta/Desktop/theia/packages/core/lib/common/event.js:160:33 at CallbackList.invoke (/Users/akos.kitta/Desktop/theia/packages/core/lib/common/event.js:175:39) at Emitter.fire (/Users/akos.kitta/Desktop/theia/packages/core/lib/common/event.js:262:29) at t.Reader.onLengthData (/Users/akos.kitta/Desktop/theia/plugins/vscode-builtin-typescript-language-features/extension/dist/extension.js:53:61626) at Socket.e.on.e (/Users/akos.kitta/Desktop/theia/plugins/vscode-builtin-typescript-language-features/extension/dist/extension.js:53:61274) at Socket.emit (events.js:182:13) at file:///Users/akos.kitta/Desktop/theia/examples/electron/lib/vs/editor/editor.main.js:2549:31 ``` I do not know whether it belongs here or not. If no, let me know and I'll move it. ### Reproduction Steps

OS and Theia version:

Diagnostics:

kittaakos commented 4 years ago

I can see another error too, maybe they're related:

root ERROR [hosted-plugin: 90904] Promise rejection not handled in one second: TypeError: r.languages.registerSelectionRangeProvider is not a function , reason: TypeError: r.languages.registerSelectionRangeProvider is not a function
root ERROR [hosted-plugin: 90904] With stack trace: TypeError: r.languages.registerSelectionRangeProvider is not a function
    at s.VersionDependentRegistration [as _doRegister] (/Users/akos.kitta/Desktop/theia/plugins/vscode-builtin-typescript-language-features/extension/dist/extension.js:1:165510)
    at s.update (/Users/akos.kitta/Desktop/theia/plugins/vscode-builtin-typescript-language-features/extension/dist/extension.js:1:12165)
    at t.VersionDependentRegistration.update (/Users/akos.kitta/Desktop/theia/plugins/vscode-builtin-typescript-language-features/extension/dist/extension.js:1:12634)
    at new t.VersionDependentRegistration (/Users/akos.kitta/Desktop/theia/plugins/vscode-builtin-typescript-language-features/extension/dist/extension.js:1:12433)
    at Object.t.register (/Users/akos.kitta/Desktop/theia/plugins/vscode-builtin-typescript-language-features/extension/dist/extension.js:1:165444)
    at Promise.all.Promise.resolve.then.then.t (/Users/akos.kitta/Desktop/theia/plugins/vscode-builtin-typescript-language-features/extension/dist/extension.js:1:123023)
    at process._tickCallback (internal/process/next_tick.js:68:7)
Promise rejection not handled in one second: TypeError: r.languages.registerSelectionRangeProvider is not a function , reason: TypeError: r.languages.registerSelectionRangeProvider is not a function
root ERROR [hosted-plugin: 90904] With stack trace: TypeError: r.languages.registerSelectionRangeProvider is not a function
    at s.VersionDependentRegistration [as _doRegister] (/Users/akos.kitta/Desktop/theia/plugins/vscode-builtin-typescript-language-features/extension/dist/extension.js:1:165510)
    at s.update (/Users/akos.kitta/Desktop/theia/plugins/vscode-builtin-typescript-language-features/extension/dist/extension.js:1:12165)
    at t.VersionDependentRegistration.update (/Users/akos.kitta/Desktop/theia/plugins/vscode-builtin-typescript-language-features/extension/dist/extension.js:1:12634)
    at new t.VersionDependentRegistration (/Users/akos.kitta/Desktop/theia/plugins/vscode-builtin-typescript-language-features/extension/dist/extension.js:1:12433)
    at Object.t.register (/Users/akos.kitta/Desktop/theia/plugins/vscode-builtin-typescript-language-features/extension/dist/extension.js:1:165444)
    at Promise.all.Promise.resolve.then.then.t (/Users/akos.kitta/Desktop/theia/plugins/vscode-builtin-typescript-language-features/extension/dist/extension.js:1:123023)
    at process._tickCallback (internal/process/next_tick.js:68:7)
root INFO [nsfw-watcher: 90899] Started watching: /Users/akos.kitta/Desktop/theia/tsconfig.json
root ERROR [hosted-plugin: 90904] Promise rejection not handled in one second: undefined , reason: undefined
akosyakov commented 4 years ago

Is it still actual? We upgraded to latest typescript and registerSelectionRangeProvider api was implemented last month?

I could not reproduce it.