-
Notifications
You must be signed in to change notification settings - Fork 175
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
Print debugger output to the Ruby LSP output channel as well as the debug console #2957
Conversation
…ebug console Because the debug console is only available when the debugger is actually spawned and attached to, users often miss crucial debugging messages about the reason the debugger exits unexpectedly. This commit prints all output to the Ruby LSP output channel as well as the debug console. So when the debugger exits unexpectedly, users can still see the output in the Ruby LSP output channel.
this.logDebuggerMessage(`Spawning debugger in directory ${cwd}`); | ||
this.logDebuggerMessage(` Command bundle ${args.join(" ")}`); | ||
this.logDebuggerMessage( | ||
` Environment ${JSON.stringify(configuration.env)}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the trailing comma accidental?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, it seems the linter is defaulting to an 80 character line limit.
@@ -341,4 +344,12 @@ export class Debugger | |||
}); | |||
}); | |||
} | |||
|
|||
private logDebuggerMessage(message: string) { | |||
const trimmedMessage = message.trimEnd(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the debugger prints messages containing a \n
in the end, it'd create an empty line in the log, which takes up space and doesn't help understanding the message. So IMO it's better to remove them.
Motivation
Because the debug console is only available when the debugger is actually spawned and attached to, users often miss crucial debugging messages about the reason the debugger exits unexpectedly.
This commit prints all output to the Ruby LSP output channel as well as the debug console. So when the debugger exits unexpectedly, users can still see the output in the Ruby LSP output channel.
Example
Launching Rails server is a project where
bin/rails
is removed. In this case, because the debugger does not successfully start,DEBUG CONSOLE
will have no output.Before
After
Implementation
Automated Tests
Manual Tests