ilya-biryukov added inline comments.
================ Comment at: clangd/ClangdLSPServer.cpp:101 json::obj{ - {"textDocumentSync", 1}, + {"textDocumentSync", 2}, {"documentFormattingProvider", true}, ---------------- simark wrote: > ilya-biryukov wrote: > > A comment mentioning that 2 means incremental document sync from LSP would > > be useful here. > I opted to add a TextDocumentSyncKind enum to Protocol.h and use that. > Though instead of an enum, I did a class with static const fields: > > ``` > struct TextDocumentSyncKind { > /// Documents should not be synced at all. > static const int None = 0; > > /// Documents are synced by always sending the full content of the document. > static const int Full = 1; > > /// Documents are synced by sending the full content on open. After that > /// only incremental updates to the document are send. > static const int Incremental = 2; > }; > ``` > > otherwise it would've required an (int) cast when using it to generate JSON: > > {"textDocumentSync", TextDocumentSyncKind::Incremental}, I'd opt for a real enum. Having some extra type-safety and compiler warnings (i.e. non-covered enum value in switch) is much more valuable than a small inconvenience when converting the value back to json and back. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D44272 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits