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

Younan Zhang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 15 03:01:59 PDT 2023


zyounan added a comment.

Updated now. Thank you again for your patient review. :)



================
Comment at: clang-tools-extra/clangd/CodeCompletionStrings.cpp:213
       ++SnippetArg;
-      if (SnippetArg == CursorSnippetArg) {
+      if (ShouldPatchPlaceholder0 && SnippetArg == CursorSnippetArg) {
         // We'd like to make $0 a placeholder too, but vscode does not support
----------------
nridge wrote:
> I realized the first part of the condition is now redundant: if `ShouldPatchPlaceholder0 == false`, then `CursorSnippetArg` will have value `std::numeric_limits<unsigned>::max()` and `SnippetArg == CursorSnippetArg` will never be true.
Aha, yes. Almost forget that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145319



More information about the cfe-commits mailing list