truffleruby icon indicating copy to clipboard operation
truffleruby copied to clipboard

Core file paths aren't clickable in a terminal

Open chrisseaton opened this issue 4 years ago • 3 comments

<internal:core> core/string.rb:354:in `encode!': wrong number of arguments (given 3, expected 0) (ArgumentError)
        from <internal:core> core/string.rb:431:in `encode'
        from <internal:core> core/array.rb:589:in `join'
        from <internal:core> core/posix.rb:132:in `attach_function_eagerly'
        from <internal:core> core/posix.rb:98:in `getpid'

Is it possible to turn on full or relative paths, so I can click these paths in my terminals?

chrisseaton avatar Nov 21 '21 18:11 chrisseaton

They are designed to:

  • Always look the same, so the backtrace are consistent and can be tested meaningfully
  • Clickable in IntelliJ

If we'd just print an absolute paths like in the past, we'd e.g. break tests relying in backtrace and various gems which might rely on the <internal: prefix.

File paths are never clickable in my terminal (Gnome Terminal), so I'm not sure what you expect. If you mean selection (on double click), then core/string.rb gets selected for me.

eregon avatar Nov 22 '21 12:11 eregon

In VSCode I can click on Ruby file's mentioned in terminal output to open them. That doesn't work with core, as VSCode thinks the file doesn't exist (as it doesn't at this location) so doesn't make it clickable.

Screenshot 2021-11-23 at 12 36 57

chrisseaton avatar Nov 23 '21 12:11 chrisseaton

I see, then we could try <internal:core> relative path from initial CWD or <internal:core> absolute path. The latter might be fairly long and hard to read. The former depends on initial CWD, which can be weird (e.g., the relative path might include ..).

They are both not stable paths (depends on CWD or location of the truffleruby checkout), hence the current approach seems best by default, notably for tests and issue reports (if they were absolute paths from another machine then we couldn't click them in IntelliJ), but we could have an option to enable one of those variants.

Absolute paths seems easier to implement (as an option), PR welcome. I think it would be better if we could teach VSCode to search harder like IntelliJ does, because that means e.g. you can click on backtraces from other people and not just runs on the current machine.

eregon avatar Nov 23 '21 13:11 eregon