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

Make error logs so one can click into file when possible #5332

Closed
bep opened this issue Oct 17, 2018 · 6 comments
Closed

Make error logs so one can click into file when possible #5332

bep opened this issue Oct 17, 2018 · 6 comments
Assignees
Milestone

Comments

@bep
Copy link
Member

bep commented Oct 17, 2018

https://discourse.gohugo.io/t/help-test-browser-errors-etc-new-in-next-hugo-0-50/14745/8?u=bep

@bep bep added this to the v0.50 milestone Oct 17, 2018
@bep bep self-assigned this Oct 17, 2018
@kaushalmodi
Copy link
Contributor

Emacs and vim allow opening files at given line number using emacs +LINE FILENAME (same for vim too).

Emacs also allows emacs +LINE:COL FILENAME (vim doesn't support this).

So would it be possible to make this configurable?

@bep
Copy link
Member Author

bep commented Oct 18, 2018

So would it be possible to make this configurable?

That would be a future request. As usual, I have taken on too much already ... But it's going to be nice ...

@bep
Copy link
Member Author

bep commented Oct 18, 2018

@kaushalmodi thinking about it, a configuration option for this sounds like little work compared to the benefit. How would you suggest we make that configuration look like?

@kaushalmodi
Copy link
Contributor

kaushalmodi commented Oct 18, 2018

To avoid maintenance annoyance for a variety of editors out there, I'd suggest to have a single map-style user-configurable config variable in the site's config.toml. This map defaults to an empty map, so that you don't need to update the default map for each editor out there.

This is what the user will put in their config.toml:

[Editor]
  emacs = "+LINE:COL FILE"
  vim = "+LINE FILE"
  sublime = "FILE:LINE"

LINE, COL, FILE are special placeholders.

How this will work:

  1. Internally, hugo will check the $EDITOR environment variable. Let's say it finds that to be emacsclient.
  2. Looping through all the keys in the .Site.Editor map, it will use the first key which matches with the beginning of $EDITOR. In above example, as the env var is set to emacsclient, the emacs key would match.
  3. Then simply replace the LINE, COL and FILE placeholders with the actual values in the value of that selected key. Let's say that value is a string "foo". Then hugo simply launches $EDITOR foo.
  4. If the $EDITOR environment variable is not set, don't hyperlink the line in the error message.

@bep
Copy link
Member Author

bep commented Oct 24, 2018

This is fixed, see #5352 for the config bit.

@bep bep closed this as completed Oct 24, 2018
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants