This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Add a hidden tweak to annotate all highlighting tokens of the file.
ClosedPublic

Authored by hokein on Jul 3 2019, 8:08 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

hokein created this revision.Jul 3 2019, 8:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 3 2019, 8:08 AM
sammccall added inline comments.Jul 4 2019, 12:58 AM
clang-tools-extra/clangd/refactor/tweaks/AnnotateHighlightings.cpp
15 ↗(On Diff #207801)

it would be nice to use the textmate class name rather than an arbitrary string here, it saves a level of indirection when verifying/debugging behavior

48 ↗(On Diff #207801)

These operations are contextual, it would be nice to root at the selected node.

You should be able to do (approximately) this by walking up to the next decl and using it as the traversal scope - don't forget to reset it afterwards!

(This is a bit hacky and invalidates the parent map, but it's a debug tweak so it should be OK)

hokein updated this revision to Diff 207996.Jul 4 2019, 2:30 AM
hokein marked 3 inline comments as done.

address comments:

  • emit textmate scope names
  • rescope to the selected node rather than TU decl.
sammccall accepted this revision.Jul 4 2019, 2:56 AM
sammccall added inline comments.
clang-tools-extra/clangd/refactor/tweaks/AnnotateHighlightings.cpp
16 ↗(On Diff #207996)

can we move this to SemanticHighlighting.h, and define getTextMateScopeLookupTable() in terms of it? It seems much more fundamental.

53 ↗(On Diff #207996)

This needs a comment

59 ↗(On Diff #207996)

nit: can you give the overridden traversal scope as narrow a scope as possible? (put it in a block, or just reset explicitly immediately afterwards?) I'm a little paranoid about this scope being reused.

This revision is now accepted and ready to land.Jul 4 2019, 2:56 AM
hokein updated this revision to Diff 208012.Jul 4 2019, 3:43 AM
hokein marked 4 inline comments as done.

Address comments

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 4 2019, 3:50 AM