[clangd-dev] Specifying format style using command line option

Sam McCall via clangd-dev clangd-dev at lists.llvm.org
Fri May 3 06:18:24 PDT 2019


Hi Dovod,
Sorry for the late reply!
I replied in more detail in https://github.com/clangd/clangd/issues/26, but
the short version:
 - I think this is better controlled at the editor level.
 - are you using VSCode? You can use the "editor.formatOnType" setting to
govern this.
 - this can be set for certain filetypes only:
https://code.visualstudio.com/docs/getstarted/settings#_language-specific-editor-settings
 - I'm working on improving our format-on-type implementation to be less
surprising, and would welcome feedback: https://reviews.llvm.org/D60605
Cheers, Sam

On Sun, Mar 24, 2019 at 8:11 PM Dovod Dovodov via clangd-dev <
clangd-dev at lists.llvm.org> wrote:

> Hello guys.
> This is my first attempt to contribute to clangd, so I hope for your
> understanding.
>
> Clangd by default tries to use .clang-format file to format code. Since
> "Format as you type" is experimental feature, it may be unusual for people
> like me who are used to format code before commit or using some
> keybindings. And personally I have some discomfort when my editor tries to
> do too much things when I'm typing.
> So here's a patch which adds a new command line option to control
> formatting style. Using it I can pass "-clang-format-style={DisableFormat:
> true, SortIncludes: false}" and clangd will not apply any formatting to my
> code. Since there's "-clang-tidy-checks" for clang-tidy, it looks
> reasonable to have the same option for clang-format.
> Will be grateful for any feedback, thank you very much!
> _______________________________________________
> clangd-dev mailing list
> clangd-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/clangd-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/clangd-dev/attachments/20190503/c0952b82/attachment.html>


More information about the clangd-dev mailing list