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.

Rewrite diff code using Rich

See original GitHub issue

The code in diff.py is pretty much the final location in Ward that isn’t using Rich for terminal output. We should update it to use Rich, which should also allow us to more easily add test coverage around this area.

I’ve put this as a “Good First Issue” because the diff code is fairly de-coupled from the rest of Ward.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
willmcgugancommented, May 20, 2021

Happy to help! I did have an idea to implement a diff renderable, but it wouldn’t happen for a while.

You probably want to use the console protocol to create a renderable Diff object. So you create an instance, and then print it with the console. Something like this:

my_diff = Diff(code)
console.print(my_diff)

The existing renderables all use this protocol. See the code here, in particular syntax.py which you will probably want to use as a reference.

Mention me if you have any questions…

2reactions
alanbatocommented, May 19, 2021

I’ll try to tackle this 😃 Any pointers are appreciated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Styles — Rich 12.6.0 documentation
Rich provides a Theme class which you can use to define custom styles that you can refer to by name.
Read more >
How to Use the Rich Library with Python - freeCodeCamp
Rich is a Python library for writing rich text (with color and style) to the terminal. It lets you display advanced content such...
Read more >
Set different background color using Rich - python
Use the word "on" to introduce the background color. For example: print("[bold green on blue]Fear is the mind-killer[/]").
Read more >
Using the rich text editor for content - Shopify Help Center
Using the rich text editor to format and style content, text, images, and ... Click a color or enter a hex code to...
Read more >
Create or delete a Rich Text field - Microsoft Support
You can store rich, formatted text in an Access database by using a Long Text (also called Memo) field and setting the field's...
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