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

CSS errors have a broken path #3569

Closed
willmcgugan opened this issue Oct 22, 2023 · 4 comments · Fixed by #3582
Closed

CSS errors have a broken path #3569

willmcgugan opened this issue Oct 22, 2023 · 4 comments · Fixed by #3582
Assignees
Labels
bug Something isn't working Task

Comments

@willmcgugan
Copy link
Collaborator

CSS errors will create an invalid path to the CSS, if the CSS is in code. This is because it adds the widget name to the path.

Here's an example:

Image

If you click the heading it should take you to the file containing the error, but it doesn't because the path is invalid.

It would be nice to display the widget within the title, but it should probably be a separate field.

@rodrigogiraoserrao
Copy link
Contributor

Much like the :line:col is displayed but it doesn't break the file link, I can just fix the file link and leave the :object:line:col in the displayed link.

Another alternative is to tweak Token so that it keeps track of where it comes from (which Widget + class variable) and separate it from the link.

@rodrigogiraoserrao rodrigogiraoserrao self-assigned this Oct 23, 2023
@rodrigogiraoserrao rodrigogiraoserrao added bug Something isn't working Task labels Oct 23, 2023
@rodrigogiraoserrao
Copy link
Contributor

My preference would be for the panel title to be something like:

Error at /Users/willmcgugan/projects/textual/src/textual/widget.py:2:9 in Widget.DEFAULT_CSS

@willmcgugan
Copy link
Collaborator Author

Works for me.

Bonus points if you can figure out how to point to the line in the Python file, rather than relative to the CSS. But don't spend too much time on that.

Copy link

github-actions bot commented Nov 1, 2023

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants