New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The argument --fallback-style={...} for clangd is not working with coc-clangd #362
Comments
Huh, I was certain that clang-format's --fallback-style was parsed the same way as --style, but it seems --fallback-style must be a predefined style (and clangd follows clang-format here). We could diverge from clang-format, or change clang-format to allow this too. |
(This is a clangd bug/feature) |
We'll almost certainly address this when we add config files, allowing something like:
to be placed in a dotfile. It's unlikely we'll fix this in the command-line flag, as we'll likely deprecate that in favor of user config files. |
when write some personal small files like algorithm practice and so on, it is cumbersome to configure .clang-format every time, may be it's greater to support both config file and command-line flag? |
i agree i think you should still support the command line flags, config files (with 1 line) in every project is very cumbersome. |
Did something change here or is there a solution to this? I'm using native lsp of nvim and the issue seemingly still persists. |
At the moment, is there any way to change the (default) format settings, in order to be applied when the .clang-format file is missing? |
My current solution is to add a file at For example: # ~/.clang-format
---
BasedOnStyle: Microsoft
IndentWidth: 4
---
Language: Cpp
# Force pointers to the type for C++.
DerivePointerAlignment: false
PointerAlignment: Left And my file at #include <iostream>
using namespace std;
int N, D;
int main()
{
int* a;
cin >> N >> D;
} For Linux/Windows users, you can put the file at |
Why not add the |
It would be nice if there could be a command line flag for clangd to load the format configuration file from a specified path instead of putting in a string in the command line. All my projects have the same format, and putting a format file into every one, even little test projects that live for less than a day is cumbersome. I would much rather like a fall back format file, such as the |
We have #805 open for this. |
Problem
I want to set up a fallback formatter for clangd with the concrete argument
--fallback-style={--fallback-style="{BasedOnStyle: LLVM, IndentWidth: 4}"}
in filecoc-settings.json
so the formatted code has indentation width of 4, but then the coc command in nvim:Format
still indents the code with indetntation width of 2.This is the
coc-settings.json
config file:Expected behaviour
The coc command in nvim
:Format
should format the code with indent width 4Current behaviour
The formatted code is with indent width 2
The text was updated successfully, but these errors were encountered: