[PATCH] D55994: [clangd] Check preceding char when completion triggers on ':' or '>'
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 2 03:15:08 PST 2019
hokein added a comment.
The code looks mostly good to me.
================
Comment at: clangd/ClangdLSPServer.cpp:789
+bool ClangdLSPServer::isSporadicCompletion(
+ const CompletionParams &Params) const {
----------------
The method name is a bit confusing to me, I didn't get its meaning at the first glance and without reading its comment. Maybe `shouldRunCompletion`?
================
Comment at: clangd/ClangdLSPServer.cpp:811
+ if (Trigger == ">")
+ return (*Code)[*Offset - 2] != '-'; // trigger only on '->'.
+ if (Trigger == ":")
----------------
Checking `Offset` is not always right for rare cases like (`bar:/*commment*/:`), a robust way is to use lexer and get the token at the current position, but I don't think it is worth (these rare cases should not happen when people write code). Maybe add a comment documenting the limitation?
Repository:
rCTE Clang Tools Extra
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55994/new/
https://reviews.llvm.org/D55994
More information about the cfe-commits
mailing list