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

Debugger doesn't output errors if Debug Console is the focused tab #1687

Closed
1 task done
scheals opened this issue Dec 19, 2023 · 2 comments · Fixed by Shopify/vscode-ruby-lsp#1013
Closed
1 task done
Labels
bug Something isn't working transferred This issue was transferred from vscode-ruby-lsp

Comments

@scheals
Copy link

scheals commented Dec 19, 2023

Operating System

Xubuntu 22.04 VM VirtualBox 7

Ruby version

3.2.2

Project has a bundle

  • Has bundle

Ruby version manager being used

rbenv

Description

The Setup

  • A lovely test.rb file with these contents:
# testing
asdasdasd
two = 1 + 1
p two
sdasdasd
  • Default debugging .json from Ruby-LSP
  • Use Debug script as the debug config
  • No breakpoints needed
  • ls -a output is as follows:
    image
  • My Gemfile is empty - it had ruby-lsp previously, but I removed it:
# frozen_string_literal: true

source "https://rubygems.org"

# gem "rails"
  • As such, Gemfile.lock is mostly empty as well:
GEM
  remote: https://rubygems.org/
  specs:

PLATFORMS
  x86_64-linux

DEPENDENCIES

BUNDLED WITH
   2.4.10
  • For Ruby-LSP to work for me, it has to detect any Gemfile.lock in the project root, hence why this is here. I could've removed it at this point and it'd still work since that's what makes it create .ruby-lsp.

Expected Behaviour

Something like when debugging JavaScript files using default Run Current File config from NodeJS for example this lovely one:

let one = 1
oneee

I can stay on Debug Console tab and see this:
image

If I'm on Problems tab for example, VSCode doesn't change the tab and the proper output is still in Debug Console.

Observed Behaviour

When I run the aforementioned Ruby file while having Debug Console focused, this is what happens:
image
Notice how it automatically jumped to Output tab. My Debug Console tab looks like this:
image

If I for example have Problems tab focused, it still jumps to the Output tab but my Debug Console tab does have output:
image

This might not be an Ruby-LSP problem but rather a VSCode problem, I am not sure, apologies if this is not the right repo.

@scheals scheals added the bug Something isn't working label Dec 19, 2023
@snutij
Copy link
Contributor

snutij commented Dec 29, 2023

Hello @scheals, this is a behavior from the extension, here exactly:

https://github.com/Shopify/vscode-ruby-lsp/blob/841a86b28302dd553f8e6cd2e0367fd23d2933b2/src/debugger.ts#L234-L240

  • If debugging exit with an error (which is the case here, asdasdasd is undefined) the extensions show the OUTPUT tab. Running this debug on a file without error, do not jump to OUTPUT tab.
  • To be honest, I don't know why it's cleaning the DEBUG CONSOLE after redirecting only from this tab itself.
  • I feel quite weird to redirect to OUTPUT after saying "check the output channel for more information", I think this redirection is challengeable.

If maintainers are agreed with this last point, I can handle it if necessary.

@vinistock
Copy link
Member

On Shopify/vscode-ruby-lsp#989, we switched from the exit event to the close event, which means we wait for the stderr pipe to be closed before throwing the error. This makes it so that the backtrace of the debug server shows up in the debug console, making it much easier to diagnose issues.

I agree that we can now remove the automatic opening of the output tab 👍.

@st0012 st0012 transferred this issue from Shopify/vscode-ruby-lsp Mar 18, 2024
@st0012 st0012 added the transferred This issue was transferred from vscode-ruby-lsp label Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working transferred This issue was transferred from vscode-ruby-lsp
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants