c++llvmclangd

Flags or arguments to configure Clangd in VS Code


I've installed an extension for vscode (Ubuntu), set it up a bit and it works, but now I have no completion for keywords like template, typename and so on. And worse clangd produce auto insertion of parentheses, angled brackets, types placeholders and maybe something else I haven't seen yet...

Searches in google, LLVM website and Reddit gave nothing so as official Discord server.


Solution

  • The behaviour of inserting placeholders for function (and template) arguments can be disabled by passing --function-arg-placeholders=0 to clangd. In VSCode, you would do this in VSCode's settings under "clangd.arguments".

    Regarding completion of keywords like template and typename, this does work for me out of the box, though note that the completion items have the "snippet" kind, e.g. for template, the item label is "template declaration" but when you choose it only template is inserted followed by a space, putting the cursor in the right position for you to type the rest of the declaration.

    If completion is not working as intended in some specific scenario, I would suggest filing an issue at https://github.com/clangd/clangd/issues/ with details.