eclipse-corrosion / corrosion

Eclipse Corrosion - Rust edition in Eclipse IDE
Eclipse Public License 2.0
219 stars 31 forks source link

[feature request] Allow RLS logging to file #147

Closed norru closed 5 years ago

norru commented 5 years ago

In a very non-surprising twist of events this is only supported in VSC as it requires a setting to be sent via a LSP client.

https://github.com/rust-lang-nursery/rls/blob/master/debugging.md

Logging

You can also dump to a file by setting rust-client.logToFile to true in the VSCode extension. The file will be in the project root; each time you start the extension, you'll get a new file.

As far as I can understand, this is not the same option that we have now (which logs the LSP4E messages to file).

norru commented 5 years ago

@mickaelistria

norru commented 5 years ago

https://github.com/rust-lang-nursery/rls/issues/1047

Boereck commented 5 years ago

I was just looking how to get compiler logs to be written in context of a different issue. A quick look at the VS Code sources reveals that the option rust-client.logToFile simply writes the std-err output of the RLS to a file. Error messages that are enabled via the environment variable RUST_LOG are written to std-err. In LSP4E std-err outputs are written to the language server log. This mixes both regular LSP JSON messages with std-err outputs. For me personally, this is not a big issue, if you care for such separation, please open an issue on the LSP4E project.

norru commented 5 years ago

stderr in the LSP logs is fine.

Although, if I understand it, the side problem here is that RUST_LOG has to be in the env of Eclipse itself (at least on Unix) and that means either setting the RUST_LOG variable for the entire xsession (which requires a restart of the session to update), starting the IDE from a command line, or creating a separate startup script to be executed from the desktop GUI. Neither of these options is nice - given that the reason for using an IDE is to have an Integrated environment.

Said that, the suggestion is acceptable as a workaround for troubleshooting - just not very user friendly.

Boereck commented 5 years ago

Yes, there is no configuration to set environment variables for the RLS, they are just inherited from the parent process (which is Eclipse). This could be added in the future, I don't think it is very hard to do.

mickaelistria commented 5 years ago

Given that the use-case (debugging Corrosion/RLS) is for advanced users and that setting the environment variable to run Eclipse IDE is trivial, I don't think this deserves a specific development. What would be good instead could be to document the various tricks to debug (logging LS messqges with LSP4E, debug RLS with the env variable, check Eclipse IDE logs...)

-- Mickael Istria Eclipse IDE https://www.eclipse.org/downloads/eclipse-packages/ developer, for Red Hat Developers https://developers.redhat.com/

norru commented 5 years ago

I agree, as long as all these tricks are documented, it would work for the power users. If demand increases from the community, then the tricks could make their way into features.

mickaelistria commented 5 years ago

@norru would you be interesting in adding such documentation?

norru commented 5 years ago

@mickaelistria kind of maxed out at the moment. I'll chuck into my todo. I'd be happy to have someone else barge in.

What did you have in mind? A .md file in the repo? A blog post?

mickaelistria commented 5 years ago

Preferably doc inside the repo.

-- Mickael Istria Eclipse IDE https://www.eclipse.org/downloads/eclipse-packages/ developer, for Red Hat Developers https://developers.redhat.com/

norru commented 5 years ago

eclipse/corrosion#182

norru commented 5 years ago

@mickaelistria https://github.com/itadinanta/corrosion/blob/feature/troubleshooting_guide/documentation/Troubleshooting.md

It's a draft, very WIP, will send a pull request as soon as it's in a readable state.