[PATCH] D145319: [clangd] Refine logic on $0 in completion snippets

Younan Zhang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 5 04:24:21 PST 2023


zyounan created this revision.
Herald added subscribers: kadircet, arphaman.
Herald added a project: All.
zyounan added reviewers: nridge, kadircet.
zyounan published this revision for review.
zyounan added inline comments.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.


================
Comment at: clang-tools-extra/clangd/CodeCompletionStrings.cpp:130
+      return false;
+    return true;
+  }();
----------------
I was cringed that if we should refine the logic based on `CursorKind`: It is from libclang; The meaning is sometimes kind of opaque (to me, I don't know it very clearly TBH) like `CXCursor_NotImplemented`...


We have a workaround from D128621 <https://reviews.llvm.org/D128621> that makes $0 no longer being
a placeholder to conform a vscode feature. However, we have to
refine the logic as it may suppress the last parameter placeholder
for constructor of base class because not all patterns of completion
are compound statements.

This fixes clangd/clangd#1479


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145319

Files:
  clang-tools-extra/clangd/CodeComplete.cpp
  clang-tools-extra/clangd/CodeCompletionStrings.cpp
  clang-tools-extra/clangd/CodeCompletionStrings.h
  clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145319.502425.patch
Type: text/x-patch
Size: 5264 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230305/b80c3e2b/attachment-0001.bin>


More information about the cfe-commits mailing list