[PATCH] D148489: [clangd] Implement configs to stop clangd produce a certain semantic tokens
Qingyuan Zheng via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 16 21:03:00 PDT 2023
daiyousei-qz updated this revision to Diff 514087.
daiyousei-qz added a comment.
Add a test in SemanticHighlightingTests.cpp
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148489/new/
https://reviews.llvm.org/D148489
Files:
clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
+++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "Annotations.h"
+#include "Config.h"
#include "Protocol.h"
#include "SemanticHighlighting.h"
#include "SourceCode.h"
@@ -1260,6 +1261,17 @@
EXPECT_EQ(Toks[3].deltaStart, 2u);
EXPECT_EQ(Toks[3].length, 3u);
}
+
+TEST(SemanticHighlighting, WithHighlightingFilter) {
+ llvm::StringRef AnnotatedCode = R"cpp(
+int *$Variable[[x]] = new int;
+)cpp";
+ Config Cfg;
+ Cfg.SemanticTokens.DisabledKinds = { "Operator" };
+ Cfg.SemanticTokens.DisabledModifiers = { "Declaration", "Definition" };
+ WithContextValue WithCfg(Config::Key, std::move(Cfg));
+ checkHighlightings(AnnotatedCode, {}, ~ScopeModifierMask);
+}
} // namespace
} // namespace clangd
} // namespace clang
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148489.514087.patch
Type: text/x-patch
Size: 1072 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230417/9f65482b/attachment-0001.bin>
More information about the cfe-commits
mailing list