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

Jens Massberg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 4 08:01:48 PDT 2023


massberg created this revision.
massberg added a reviewer: sammccall.
Herald added subscribers: kadircet, arphaman.
Herald added a project: All.
massberg requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.

In case of a top level context the first template argument of a concept
should be dropped. Currently the indexer doesn't support different
signatures for different contexts (for an index entry always the default
`Symbol` context is used). Thus we add a hack which checks if we are in
a top level context and have a concept and in that case removes the
first argment of the signature and snippet suffix. If there is only a
single argument, the signature and snippet suffix are completly
removed. The check for the first argument is done by simply looking for
the first comma which should be sufficient in most cases.

Additionally extend test environment to support adding artificial index
entries with signature and completion snippet suffix.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154450

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154450.537108.patch
Type: text/x-patch
Size: 8567 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230704/de857a7f/attachment-0001.bin>


More information about the cfe-commits mailing list