Hendrik
Hendrik

Reputation: 315

Lazyvim/Neovim Formatting Issue upon saving: A space is required between consecutive right angle brackets (use '> >') (fix available) clang

In my LazyVim/NeoVim setup, everytime I save a file, my files are formatted.

Using Mason, I installed clangd LSP and clangd-format. Unfortunately, it always removes the space between consecutive >, which does not allow my Makefile to compile my code. I'm working in C++98 for a school project. As I understand, this is a necessity in code pre C++11, yet the formatter keeps removing this space.

I have been looking for a fix here: https://github.com/clangd/clangd but cannot seem to locate a sort of config file where I could change this option.

Upvotes: 5

Views: 3000

Answers (1)

Hendrik
Hendrik

Reputation: 315

Managed to solve this pesky issue. Here are steps below!

  1. navigate to project root directory
  2. launch this cmd: clang-format -style=file -dump-config > .clang-format (you might need to install llvm with brew (MacOS): brew install llvm)
  3. enter .clang-format, replace the line Standard: Latest to Standard: C++03

Upvotes: 2

Related Questions