This is an archive of the discontinued LLVM Phabricator instance.

Move the column marking functionality to the Highlighter framework
ClosedPublic

Authored by teemperor on Aug 29 2018, 4:05 PM.

Details

Summary

The syntax highlighting feature so far is mutually exclusive with the lldb feature
that marks the current column in the line by underlining it via an ANSI color code.
Meaning that if you enable one, the other is automatically disabled by LLDB.

This was caused by the fact that both features inserted color codes into the the
source code and were likely to interfere with each other (which would result
in a broken source code printout to the user).

This patch moves the cursor code into the highlighting framework, which provides
the same feature to the user in normal non-C source code. For any source code
that is highlighted by Clang, we now also have cursor marking for the whole token
that is under the current source location. E.g., before we underlined only the '!' in the
expression '1 != 2', but now the whole token '!=' is underlined. The same for function
calls and so on. Below you can see two examples where we before only underlined
the first character of the token, but now underline the whole token.


It also simplifies the DisplaySourceLines method in the SourceManager as most of
the code in there was essentially just for getting this column marker to work as
a FormatEntity.

Diff Detail

Repository
rL LLVM

Event Timeline

teemperor created this revision.Aug 29 2018, 4:05 PM
aprantl accepted this revision.Aug 29 2018, 4:21 PM

Thank you, this looks great!

This revision is now accepted and ready to land.Aug 29 2018, 4:21 PM
This revision was automatically updated to reflect the committed changes.