This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Add a new highlighting kind for typedefs
ClosedPublic

Authored by ilya-biryukov on Sep 6 2019, 10:39 AM.

Details

Summary

We still attempt to highlight them as underlying types, but fallback to
the generic 'typedef' highlighting kind if the underlying type is too
complicated.

Event Timeline

ilya-biryukov created this revision.Sep 6 2019, 10:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 6 2019, 10:39 AM
ilya-biryukov marked an inline comment as done.
ilya-biryukov added inline comments.
clang-tools-extra/clangd/SemanticHighlighting.cpp
530

Not sure what the rules for the scope names are, happy to change if I'm doing it wrong

nridge added a subscriber: nridge.Sep 6 2019, 10:43 AM
hokein accepted this revision.Sep 9 2019, 7:19 AM
hokein added inline comments.
clang-tools-extra/clangd/SemanticHighlighting.cpp
530

I think the current name is fine, just checked the name for this type in vscode highlighting configs, but didn't find a particular name for this type (my guess is that regex-based highlighting is not able to catch this case).

clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
498–499

nit: the comment is out-of-date with this patch.

This revision is now accepted and ready to land.Sep 9 2019, 7:19 AM
ilya-biryukov marked 3 inline comments as done.
  • Remove stale comment
clang-tools-extra/clangd/SemanticHighlighting.cpp
530

Ack. Keeping as is, thanks for taking a look.
Is there a way for us to provide a custom color for this in our extension? Or would we just revert to the default color for entity.name.type?

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptSep 9 2019, 7:33 AM
hokein added inline comments.Sep 9 2019, 7:34 AM
clang-tools-extra/clangd/SemanticHighlighting.cpp
530

Is there a way for us to provide a custom color for this in our extension?

we don't support it yet, this is a feature request in https://github.com/clangd/clangd/issues/143.

Or would we just revert to the default color for entity.name.type?

Yes, we will fallback to the color for entity.name.type.