[PATCH] D64741: [clangd] Added highlighting for tokens that are macro arguments.

Johan Vikström via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 17 03:22:38 PDT 2019


jvikstrom added a comment.

In D64741#1588987 <https://reviews.llvm.org/D64741#1588987>, @ilya-biryukov wrote:

> > I had completely missed that there could be conflicting tokens when only highlighting macro arguments as well. Added code to just remove conflicting tokens.
>
> Picking one of the highlightings looks fine, but we probably want to make sure it's deterministic. Given that we use `sort` now, I bet it won't be. Maybe include kinds into comparison as well? That's not a perfect solution, but would at least make sure the user-visible behavior is not random.
>  Could you add tests for that case too?


Already added the case you sent a comment on in the test case. (look at the top of it)
Don't understand what you mean with the `sort` though. Kinds are already included in the comparator for sort. After the call to unique the only tokens that will share ranges are the ones that have different kinds.

Could just have a custom comparator in the call to unique that only compares the tokens' ranges which would leave us with the token whose kind is the lowest when there are conflicting ones. But do we really want to highlight anything when there are conflicts?

Maybe we should add another kind of Kind for when a token is conflicting?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64741/new/

https://reviews.llvm.org/D64741





More information about the cfe-commits mailing list