[PATCH] D154450: [clangd][c++20] Drop first template argument in code completion in some contexts.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 5 02:31:21 PDT 2023


sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang-tools-extra/clangd/CodeComplete.cpp:484
+      S.Signature = RemoveFirstTemplateArg(S.Signature);
+      S.SnippetSuffix = RemoveFirstTemplateArg(S.SnippetSuffix);
+    }
----------------
massberg wrote:
> sammccall wrote:
> > maybe leave a comment:
> > 
> > // dropping the first placeholder from the suffix will leave a `$2` with no `$1`.
> > // However, editors appear to deal with this OK.
> > 
> > (assuming you've tested this in vscode)
> Yes I've tested it with vscode and it looks fine. Why is the numbering of the parameters required?
The numbering defines the logical sequence, in practice which placeholder will be selected first, and the order that pressing `<tab>` will visit the others in.

I guess this could make sense when they're not parameters but some other snippet placeholders, but honestly this seems more confusing than useful, I'd prefer they were un-numbered and always LTR.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154450



More information about the cfe-commits mailing list