[PATCH] D77225: [clangd] Support textDocument/semanticTokens/edits

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 2 02:41:00 PDT 2020


hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.

this is neat, and the new semantic highlighting protocol is much nicer than the old one.



================
Comment at: clang-tools-extra/clangd/ClangdLSPServer.cpp:1245
+static void increment(std::string &S) {
+  for (char &C : llvm::reverse(S)) {
+    if (C != '9') {
----------------
nit: add assert(C >= '0' && C <= '9').


================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:605
+diffTokens(llvm::ArrayRef<SemanticToken> Old,
+           llvm::ArrayRef<SemanticToken> New) {
+  // For now, just replace everything from the first-last modification.
----------------
nit: assert Old and New are sorted.


================
Comment at: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp:734
+    Results.push_back({HighlightingKind::Variable, R});
+  for (unsigned I = 0; I < static_cast<unsigned>(HighlightingKind::LastKind); ++I) {
+    HighlightingKind Kind = static_cast<HighlightingKind>(I);
----------------
should be `<=`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77225





More information about the cfe-commits mailing list