This is an archive of the discontinued LLVM Phabricator instance.

[clangd] (Attempt to) read clang-format file for document formatting
ClosedPublic

Authored by rwols on Dec 8 2017, 1:51 PM.

Details

Summary

Takes into account the clang-format file of the project, if any.
Reverts to LLVM if nothing is found. Replies with an error if any error occured.
For instance, a parse error in the clang-format YAML file.

Diff Detail

Repository
rL LLVM

Event Timeline

rwols created this revision.Dec 8 2017, 1:51 PM
sammccall accepted this revision.Dec 12 2017, 12:49 AM

I'm not actually sure we're doing the user a service with this error handling.
LSP errors aren't surfaced to the user with a decent UI in practice.
Plus it adds a bunch of internal complexity.

I'd strongly consider just falling back to LLVM style on any error, inside ClangdServer::formatCode. I think the UX will be better, and the code will be simpler. But up to you.

This revision is now accepted and ready to land.Dec 12 2017, 12:49 AM
This revision was automatically updated to reflect the committed changes.