0

when I type if and use clangd code completion, I got this.

if (condition) {
statements
}

I'm expecting

if (condition) {
    statements
}

It's the same thing for while and for.

clangd-12 --version
Ubuntu clangd version 12.0.0-3ubuntu1~20.04.4
clangd extension
v0.1.13

Although I apt installed clangd-12, vscode clangd extension installed clangd 12.0.1.zip for me automatically.

I guess this has something to do with the problems.

isudfv
  • 179
  • 1
  • 9
  • Are you also using clang-format? – sweenish Sep 29 '21 at 15:08
  • @sweenish there is no .clang-format in this project – isudfv Sep 29 '21 at 15:12
  • 1
    That wouldn't stop you from using the tool, though. What I'm getting at is that clangd's job is not to format your code. But it is clang-format's. – sweenish Sep 29 '21 at 15:13
  • I'm not expecting clangd to format the code. It's just so weird that there's no indentation before **statement**. – isudfv Sep 29 '21 at 15:17
  • That's what formatting is.. At the end of day, it might just be a bug in one of the extension or clangd. With clang-format, it's also just an annoyance. I don't use that extension myself in VS Code. I do use clangd with neovim, but I haven't set up snippets with it. One last thing, did you install the LLVM suite as well? You only indicate that you've installed clangd. – sweenish Sep 29 '21 at 15:22

0 Answers0