Borrow visualizer for the Rust Language Service

I got the Atom version working with @eddyb's idea. Check it out:

There are some areas where the border is either missing or crosses in too much to the left. This seems to be a limitation of Atom itself. I'm requesting the right position, but

  1. Atom doesn't allow you to style anything after the end of the line unless it highlights onto the next line (this follows its own highlighting behavior, and I get around this by setting the end of the last highlight within a line to the 0th position on the next line...)
  2. Atom groups multiple spaces at the beginning of a line into a "tab" for highlighting, and assigning a position in the middle of the tab will shift the highlight to the left or right.

The downside to the approach I've taken is any editing will completely ruin the highlighting, so I have to see how I could work with that (either disable editing while visualizing or clearing the highlights on edit, I'm definitely open to alternatives too). I'm happy with the overall look, and tomorrow I'll try adding in the numbered identifiers and maybe start working on the locking functionality.

16 Likes