c++ - add (constructor) arguments auto completion - Stack Overflow

admin2025-04-19  0

I am using clangd in my C++ project.

When clangd suggests a function, it also inserts placeholders for the functions:

However, when I type a constructor, I only receive the overload window I can cycle through. RETURN will just create empty parenthesis:

Can I make clangd insert placeholders for constructor parameters?

My clangd arguments:

"clangd.arguments": [
    "--pretty",
    "--compile-commands-dir=${workspaceFolder}/build",
    "--background-index",
    "--completion-style=detailed",
    "--header-insertion=iwyu",
    "--function-arg-placeholders"
],
$ clangd --version
clangd version 19.1.7

The placeholders are already there, it's just that I need to scroll down for a particular constructor. Its a bit inconvenient.

I am using clangd in my C++ project.

When clangd suggests a function, it also inserts placeholders for the functions:

However, when I type a constructor, I only receive the overload window I can cycle through. RETURN will just create empty parenthesis:

Can I make clangd insert placeholders for constructor parameters?

My clangd arguments:

"clangd.arguments": [
    "--pretty",
    "--compile-commands-dir=${workspaceFolder}/build",
    "--background-index",
    "--completion-style=detailed",
    "--header-insertion=iwyu",
    "--function-arg-placeholders"
],
$ clangd --version
clangd version 19.1.7

The placeholders are already there, it's just that I need to scroll down for a particular constructor. Its a bit inconvenient.

Share Improve this question edited Apr 3 at 19:25 TylerH 21.1k79 gold badges79 silver badges114 bronze badges asked Mar 5 at 15:58 RaildexRaildex 4,8563 gold badges27 silver badges54 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

Add --completion-style=detailed to clangd's command line arguments ("clangd.arguments" setting in VSCode), and restart clangd for it to take effect.

Now, when you are typing Texture, the individual constructors should be offered as proposals, and if you select a particular one, you will get placeholders for the selected one.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745022045a280438.html

最新回复(0)