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

Hyperlinks #61

Open
stuaxo opened this issue Dec 12, 2018 · 7 comments
Open

Hyperlinks #61

stuaxo opened this issue Dec 12, 2018 · 7 comments

Comments

@stuaxo
Copy link

stuaxo commented Dec 12, 2018

It would be great if the better exceptions could output file:/// hyperlinks using the new ansi standard.

I'm not quite sure which bit of the output should be the link.

Unfortunately AFAICT line numbers aren't supported, but just being able to click from somewhere in the exception and open the file would be a big plus.

https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda

@Qix-
Copy link
Owner

Qix- commented Dec 12, 2018

The problem is that detecting those terminals is very hard. This would break a lot of people, unfortunately.

@stuaxo
Copy link
Author

stuaxo commented Dec 12, 2018

I'd be happy setting an environment variable or config option to enable it.

It's semi-useful being able to open files by right-clicking after ls --hyperlink opening files from tracebooks would be very useful.

@Qix-
Copy link
Owner

Qix- commented Jan 14, 2019

Perhaps. If someone wants to submit a PR I'd be happy to consider it. But it has to be enable-able via environment variable for now.

@stuaxo
Copy link
Author

stuaxo commented Aug 27, 2019

Quick note to myself on where to find the filename output:

https://github.com/Qix-/better-exceptions/blob/master/better_exceptions/formatter.py#L253

Another note, about how this becomes a bit annoying under docker - paths are different (though the hostname bit of the file url being different would alert the terminal emulator) - this is a bit past the MVP of getting this working at all though.

@Qix-
Copy link
Owner

Qix- commented Aug 27, 2019

There's no feasible way to do that in docker, really. That would just add to the complexity and not something we should support.

@stuaxo
Copy link
Author

stuaxo commented Aug 27, 2019

That bit was definitely a note too myself, that's something the terminal emulator could do eventually, convert remote URLs to local ones, e.g.

file://some-hostname-docker-came-up-with/somepath/myfile.py
to
file://localhost/some/docker-mountpoint/somepath/myfile.py

But I make have a fork of this, that can replace the beginning bit of the path somehow, as my current dev is all in docker containers :/

@stuaxo
Copy link
Author

stuaxo commented Aug 27, 2019

Here's an initial go at a PR https://github.com/Qix-/better-exceptions/pull/97

No tests yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants