-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Repeated output with pauses + newlines loses text #4519
Comments
Just updated positron and I still see the problem: Positron Version: 2024.08.0 (Universal) build 48 |
Do we think this may be another example of problems arising from our current approach to #1762? It is a |
This is likely a unique bug we haven't seen before |
I was reminded of this issue again today as I was working on elmer. It makes it really difficult to use streaming output (which you really want to do for a good user experience). |
Bumping priority to 2024.11 |
…eam specialization (#4848) Addresses #4519 In `addActivityItemStream()`, either a `ActivityItemOutputStream` or `ActivityItemErrorStream` always goes in, but it was possible for a "generic" `ActivityItemStream` to come out here when we make one from the `remainderText` after the last newline: https://github.com/posit-dev/positron/blob/e51332d5baa59b72f5e8b28861bbb751f25452ea/src/vs/workbench/services/positronConsole/browser/classes/activityItemStream.ts#L118-L136 That generic `ActivityItemStream` would get set here: https://github.com/posit-dev/positron/blob/c9504d307c686ce2deefdc6887ad2f7b044dd2e9/src/vs/workbench/services/positronConsole/browser/classes/runtimeItemActivity.ts#L110-L116 And then pushed onto `this._activityItems` https://github.com/posit-dev/positron/blob/c9504d307c686ce2deefdc6887ad2f7b044dd2e9/src/vs/workbench/services/positronConsole/browser/classes/runtimeItemActivity.ts#L138-L139 The problem is that our Console code doesn't know how to deal with a generic `ActivityItemStream`. It must be a specialized `ActivityItemOutputStream` or `ActivityItemErrorStream`! https://github.com/posit-dev/positron/blob/c9504d307c686ce2deefdc6887ad2f7b044dd2e9/src/vs/workbench/contrib/positronConsole/browser/components/runtimeActivity.tsx#L46-L49 If a generic `ActivityItemStream` slipped through, the output would never appear in the Console, making it look "dropped", as reported in #4519. --- I like how we have a generic `ActivityItemStream` class that we specialize for the output/error types, so I've fixed this bug by using [polymorphic `this`](https://www.typescriptlang.org/docs/handbook/advanced-types.html#polymorphic-this-types) to allow `addActivityItemStream()` to take and return objects of the correct specialized type. Ideally we'd simply be able to use `new this.constructor()` in place of `new ActivityItemStream()` to use the polymorphic constructor when we need to create new objects, but due to some [well known weirdness](microsoft/TypeScript#3841) in typescript, you have to manually cast it to the constructor type, so `newActivityItemStream()` wraps that up. I've also made the `ActivityItemStream` constructor `protected` to avoid us using it by accident in the codebase. We should _always_ be creating `ActivityItemOutputStream` or `ActivityItemErrorStream` instead. Before 😢 https://github.com/user-attachments/assets/b1854d9e-94eb-4952-aead-bebcf5c5d6a2 After 🥳 https://github.com/user-attachments/assets/4a76974c-6862-4e84-a296-620717ddb8da
Verified Fixed
Test scenario(s)No output is dropped now. Link(s) to TestRail test cases run or created: |
System details:
Positron and OS details:
Positron Version: 2024.07.0 (Universal) build 125
Code - OSS Version: 1.91.0
Commit: cae4905
Date: 2024-08-01T00:27:06.019Z (3 wks ago)
Electron: 29.4.0
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Darwin arm64 23.5.0
Interpreter details:
R 4.4.0
Describe the issue:
Sometimes printed output is silently lost from the console.
Steps to reproduce the issue:
Expected or desired behavior:
Output shouldn't go missing 😄
Were there any error messages in the UI, Output panel, or Developer Tools console?
The text was updated successfully, but these errors were encountered: