question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[REQUEST] Make it possible to join Syntax elements with different stylings.

See original GitHub issue

How would you improve Rich?

The feature request I would be interested is the ability to join Syntax items so that different parts could be highlighted in a different theme. The desire to do so is to reproduce the highlighting recently introduced by IPython for indicating the location of the part of code that causes an exception as shown in a recent tweet; image below. This obviously cannot work if each Syntax item appends a newline character by default as noted in #1827 … However, this feature request goes well beyond what is required to “fix” #1827.

In pseudo-code, and using a line of code from the image below, I would like to be able to do something like:

code = Syntax('return ', "python") + Syntax('x[0][i]', "Text only", theme="error") + Syntax('[0]')
print(code)

FI5_l4MWUAAF6gI

What problem does it solve for you?

Being able to reproduce the new styles of IPython tracebacks (including in Jupyter notebooks) to show the location of an error, instead of using a separate line and using ^ characters.

I already do this when showing tracebacks within IDLE (not supported by Rich).

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
willmcgugancommented, Feb 11, 2022

Syntax will grow the ability to highlight ranges of columns soon. Which should negate the need to join Syntax objects, which was always going to be problematic.

0reactions
github-actions[bot]commented, Feb 11, 2022

Did I solve your problem?

Why not buy the devs a coffee to say thanks?

Read more comments on GitHub >

github_iconTop Results From Across the Web

SQL Server Self Join (Explained by Examples) - Devart
The SELF JOIN in SQL, as its name implies, is used to join a table to itself. This means that each row in...
Read more >
Documentation: 15: 2.6. Joins Between Tables - PostgreSQL
It is widely considered good style to qualify all column names in a join query, so that the query won't fail if a...
Read more >
JOIN examples - Amazon Redshift - AWS Documentation
Provides join query examples. Left and right outer joins retain values from one of the joined tables when no match is found in...
Read more >
Array.prototype.join() - JavaScript - MDN Web Docs - Mozilla
The join() method creates and returns a new string by concatenating all of the elements in an array (or an array-like object), separated...
Read more >
Joins in Impala SELECT Statements
Queries with the explicit JOIN keywords are known as SQL-92 style joins, referring to the level of the SQL standard where they were...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found