Skip to content
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

onDidWriteData, PseudoTerminal and Tasks #83927

Closed
FlavienBusseuil opened this issue Nov 4, 2019 · 8 comments
Closed

onDidWriteData, PseudoTerminal and Tasks #83927

FlavienBusseuil opened this issue Nov 4, 2019 · 8 comments
Assignees
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code)

Comments

@FlavienBusseuil
Copy link

I wrote a VSCode extension (https://marketplace.visualstudio.com/items?itemName=flavienbusseuil.terminus) based on the feature onDidWriteData that has been deprecated in 1.39.

My extension is about reading terminal output (mostly for Tasks) and watch for particular regex.

The new PseudoTerminal API support a similar feature but can only be used on terminals created by the extension itself.

I think I understand the reason of this choice... giving the control over existing terminals may lead to security issues. (even if I found odd that sendText is still available on legacy terminals)

Regarding this consideration, I feel like my extension is broken forever... but I still have needs for it. Maybe there is another path for it?
I was thinking of re-doing my own Task launcher to have control over terminals through Pseudo Terminal... but sounds overkill.

Thanks in advance for your help!

@vscodebot
Copy link

vscodebot bot commented Nov 4, 2019

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@Tyriar
Copy link
Member

Tyriar commented Nov 4, 2019

So window.onDidWriteTerminalData is equivalent to Terminal.onDidWriteData but the plan is not to stabilize it for perf/security reasons. Though I'm not sure why your extension is published at all since proposed APIs aren't allowed to be published to the marketplace?

Task problem matchers seem to mostly cover what you're trying to do? https://code.visualstudio.com/docs/editor/tasks#_processing-task-output-with-problem-matchers

Other things of note:

@Tyriar Tyriar closed this as completed Nov 4, 2019
@Tyriar Tyriar added the *question Issue represents a question, should be posted to StackOverflow (VS Code) label Nov 4, 2019
@FlavienBusseuil
Copy link
Author

Weird... Terminal.onDidWriteData was available without Insiders and publishable on the marketplace (I never paid attention that it was a "proposed API" 😱).

Problem matchers would have been just perfect but as I deal with unformatted output (legacy code), that is really not referring to any piece of code or a file. In fact I'm not always looking for "problems" in the output neither.

I guess I will have to reconsider the tooling I'm using right now. Thanks for your time and your relevant points 👍

@Tyriar
Copy link
Member

Tyriar commented Nov 4, 2019

@alexr00 might be able to give more guidance with tasks and problem matchers, but they match on regex and then expose problems, plus they're part of the built-in diagnostics system.

@alexr00
Copy link
Member

alexr00 commented Nov 5, 2019

Problem matchers can also provide warnings and info, but they all end up in the "Problems" pane.
This issue tracks programmatic parsing of task output: #59337
If you need to do something "special" (not just create problems) with your task output, then you could take a look at the CustomExecution API (example: https://github.com/microsoft/vscode-extension-samples/blob/master/task-provider-sample/src/customTaskProvider.ts). No docs for it yet, but I'll be writing some soon.

@FlavienBusseuil
Copy link
Author

Hey that's cool! I think CustomExecution API would do the job for me! 🎉

Thanks @alexr00 and @Tyriar !

@alexr00
Copy link
Member

alexr00 commented Nov 5, 2019

I suspect that CustomExecution probably gives you more freedom than you need and that if we had #59337 then that would be more suited to what you need and mean less work for you. If you're interested, I recommend subscribing to #59337 so if I add API just for that then you can use it/provide feedback.

@FlavienBusseuil
Copy link
Author

Awesome, thanks for all your assistance. 👍
I subscribed to #59337 and would love give it a try when available!

@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code)
Projects
None yet
Development

No branches or pull requests

3 participants