Moves clangdserveropt gathering into a separate function to make sure
it's done before we take any actions based on options.
This also moves some state that controls how we handle certain requests from
LSPServer to options.
Paths
| Differential D133339
[clangd] Isolate logic for setting LSPServer options Needs ReviewPublic Authored by kadircet on Sep 6 2022, 12:18 AM.
Details
Summary Moves clangdserveropt gathering into a separate function to make sure This also moves some state that controls how we handle certain requests from
Diff Detail
Event TimelineComment Actions I like the change to initialize() a lot.
Comment Actions I agree this is creating confusing state for constructors of ClangdLSPServer. It
Revision Contents
Diff 458769 clang-tools-extra/clangd/ClangdLSPServer.h
clang-tools-extra/clangd/ClangdLSPServer.cpp
|
I don't really like making these options part of this struct.
Currently this struct is largely used to send data from main->ClangdLSPServer.
After this patch, half of the fields are for that and half of them are scratch space for ClangdLSPServer to use itself. Worse, they *look* like things that can/should be set beforehand, but will in fact the passed values are ignored.
(Admittedly, some of the *inherited* fields are used in the same way, sigh).
Additionally, these options are publicly exposed when they don't need to be - these are internals leaking into API without a use case.
Having updateServerOptions be a hidden helper rather than a member is nice, but I think not as important as the actual public interface.
Grouping the options is also nice. Having the members be consecutive seems enough to me (they're almost grouped: background queue state is in the wrong place). Adding a second struct also seems like an option though?