microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.96k stars 29.53k forks source link

Add ability to read outputChannel text. #65108

Closed NTaylorMullen closed 1 year ago

NTaylorMullen commented 5 years ago

I believe this is what #6208 was asking but I disagree that it was a duplicate of the linked issue.

Basically, I'm building an issue reporter that captures log output to make filing issues easier for my extension. For my own logger this is easy because I can just save the data that should have been logged to a variable. However, my extension relies on OmniSharp and they have their own log. It'd be valuable to capture that as well.

jrieken commented 5 years ago

There will be a document in the vscode.workspace.textDocuments which has your contents but it's not linked to the channel.

NTaylorMullen commented 5 years ago

There will be a document in the vscode.workspace.textDocuments which has your contents but it's not linked to the channel.

Totally agree, but that only happens if your log has been viewed recently and from what I've seen it also doesn't have a clear identifier in order to associate it to the channel so you could be getting a random log outputs content.

jrieken commented 5 years ago

Totally agree, but that only happens if your log has been viewed recently

Yeah... We have optimised this recently because sync'ing output channels has caused quite some load

akshita31 commented 5 years ago

Having this will really benefit the C# extension as for each issue we have to ask the users to upload the output from the omnisharp and the C# channel. It adds to a step in the loop and many times new users dont understand how to do it.

akshita31 commented 5 years ago

@sandy081 Would you guys be open to a pull request for the same?

sandy081 commented 5 years ago

Its the same step for us that we ask users to provide logs. We ask in following way.

Please provide us logs from following location F1 > View: Open View > Log(Shared)

Why not doing the same?

F1 > View: Open View > C# ?

bkelley13 commented 5 years ago

For e2e testing, I'm getting the output channel by first opening it (in the test), and then getting it by name. ("extension-output-#5"). The name is troubling, as it seems the extension's name for the output channel "XYZ" is not being used, but instead that generic one "extension-output-#5". If the name could just match up with the choice, or perhaps something such as -output-.

TylerLeonhardt commented 5 years ago

Also would really like to see this feature for the PowerShell extension for the same reason as @akshita31 mentioned. Having to ask the user to go to the Output Windows (we have 2 of them, one client, one server) and copy the content is an extra step.

Especially since a small percentage of folks actually read the issue templates, this feature would save us a lot of back-and-forth time with the user who's having trouble.

TylerLeonhardt commented 5 years ago

I attempted to script out:

unfortunately, myLanguageClient.outputChannel.show() doesn't seem to work - the Output pane nor the language client's specific output window opened.

vscodebot[bot] commented 4 years ago
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our [documentation](https://aka.ms/vscode-issue-lifecycle). Happy Coding!
TylerLeonhardt commented 4 years ago

Since this is an extensibility feature request, I find it hard to believe that this will get the required likes to not be closed.

Please consider not doing that...

This would be really useful and the lack of this feature already means I have to ask the user to follow more steps thus delaying my ability to diagnose issues that customers have.

vscodebot[bot] commented 4 years ago
This feature request has not yet received the 20 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our [documentation](https://aka.ms/vscode-issue-lifecycle). Happy Coding
TylerLeonhardt commented 4 years ago

Pls no

NTaylorMullen commented 4 years ago

Out of curiosity the 20 community upvote limit also applies to developer extension APIs?

TylerLeonhardt commented 4 years ago

It appears so.

vscodebot[bot] commented 4 years ago
:slightly_smiling_face: This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our [documentation](https://aka.ms/vscode-issue-lifecycle). Happy Coding!
worksofliam commented 3 years ago

Reading from an output channel would be excellent. My use case is for walkthroughs. I'd like to read from the output channel to trigger contexts for my walkthrough. E.g. if one step of the walkthrough is the print Hello world to standard out (which in my case, then writes to its own output channel), I'd like to be able to capture that.

const outputChannel = vscode.window.getOutputChannel(`IBM i Output`); //This channel is from another extension

outputChannel.on(`append`, (content) => {
  if (content.includes(`Hello world`)) {
    vscode.commands.executeCommand(`setContext`, `code-for-ibmi-walkthroughs:helloworld`, true);
  }
});
vscodenpa commented 1 year ago

We closed this issue because we don't plan to address it in the foreseeable future. If you disagree and feel that this issue is crucial: we are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding, and happy coding!

ShuiRuTian commented 1 year ago

Ping @sandy081 and @connor4312

This might also be helpful for the debug feature of testing API.

To debug, the only way should be to use VSCode's debug configuration, which might be another extension.

An example is Rust, the debug extension could be LLDBCode, but the extension which knows rust is Rust-Analyzer.

The rust-analyzer creates a debug config and then give control to LLDBCode, then, there is no way to get the output from LLDBCode(in fact it's from cargo, but I think there is no way to capture output from cargo directly). The status of debugging is lost.

A hack way might be to use a wrapper, LLDB starts the wrapper and the wrapper starts the real program. Then it's possible to use some IPC ways then to pass the output.

If this feature is implemented, life would be much easier.