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

Use window log messages instead of printing to stderr #2419

Merged
merged 1 commit into from
Aug 9, 2024

Conversation

vinistock
Copy link
Member

Motivation

Closes #2057

This PR adds some extra logging to our automatic detections and gets rid of most $stderr.puts usages in the code (in tests it's fine).

We should always use window/logMessage when showing some trace to the user, which allows us to set the type and follows the specification.

The only remaining usages of puts are in the indexer, which I will follow up with another PR to get rid of.

Implementation

Added a convenience method to create log messages and started using it everywhere instead of printing.

As an added benefit, this PR forces us to separate presentation from logic instead of just putting puts everywhere.

Automated Tests

Made a few adjustments to the server test to make it more robust.

@vinistock vinistock added server This pull request should be included in the server gem's release notes other Changes that aren't bugfixes, enhancements or breaking changes labels Aug 8, 2024
@vinistock vinistock self-assigned this Aug 8, 2024
@vinistock vinistock requested a review from a team as a code owner August 8, 2024 20:21
@vinistock vinistock requested review from andyw8 and st0012 August 8, 2024 20:21
@vinistock vinistock merged commit f9575b8 into main Aug 9, 2024
35 checks passed
@vinistock vinistock deleted the vs-use-window-log-messages branch August 9, 2024 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
other Changes that aren't bugfixes, enhancements or breaking changes server This pull request should be included in the server gem's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add some diagnostic logging for ruby-lsp
2 participants