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

Show a file on error message #208

Open
certik opened this issue Jan 25, 2025 · 3 comments · May be fixed by #209
Open

Show a file on error message #208

certik opened this issue Jan 25, 2025 · 3 comments · May be fixed by #209

Comments

@certik
Copy link
Collaborator

certik commented Jan 25, 2025

Currently the error message is:

~/repos/math_notes(main)$ conda spawn -n myst
Syntax error:   × Failed to parse input
  ╰─▶ Failure to parse at Pos((3, 35))
   ╭────
 1 │ if test -n "${XML_CATALOG_FILES:-}"; then
   ·                                   ┬
   ·                                   ╰── expected QUOTED_ESCAPE_CHAR, QUOTED_CHAR, VARIABLE_EXPANSION, SUB_COMMAND, or EXIT_STATUS
   ╰────
  help: expected QUOTED_ESCAPE_CHAR, QUOTED_CHAR, VARIABLE_EXPANSION,
        SUB_COMMAND, or EXIT_STATUS

But we need to know the filename too, so that I can go in and workaround it, until we improve the shell.

certik added a commit to certik/shell that referenced this issue Jan 25, 2025
@certik certik linked a pull request Jan 25, 2025 that will close this issue
@certik
Copy link
Collaborator Author

certik commented Jan 25, 2025

This now says:

~$ conda spawn -n myst
Filename: "/Users/ondrej/miniforge3/envs/myst/etc/conda/activate.d/libxml2_activate.sh"
Syntax error:   × Failed to parse input
  ╰─▶ Failure to parse at Pos((3, 35))
   ╭────
 1 │ if test -n "${XML_CATALOG_FILES:-}"; then
   ·                                   ┬
   ·                                   ╰── expected QUOTED_ESCAPE_CHAR, QUOTED_CHAR, VARIABLE_EXPANSION, SUB_COMMAND, or EXIT_STATUS
   ╰────
  help: expected QUOTED_ESCAPE_CHAR, QUOTED_CHAR, VARIABLE_EXPANSION,
        SUB_COMMAND, or EXIT_STATUS

Which is very helpful to see the filename.

certik added a commit to certik/shell that referenced this issue Jan 25, 2025
@wolfv
Copy link
Member

wolfv commented Jan 26, 2025

There is a way to get miette to render the file name with the position properly, so that it becomes clickable as well. I need to read up on it, but it should also not print Pos((3, 35)).

The ideal print would be something like filename.sh:3:35 and miette can do it! :)

@certik
Copy link
Collaborator Author

certik commented Jan 26, 2025

In the meantime, why not merging #209 to get at least something in, and we can later refactor using miette?

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

Successfully merging a pull request may close this issue.

2 participants