Refactored configuration management for LSP module
Currently, configuration requests require a round trip every time the language server needs a value from the client. For example, in TextDocumentServiceImpl, the completion method, which provides auto-complete suggestions, performs a round trip to fetch configuration values like netbeans.javadoc.load.timeout and netbeans.completion.warning.time. Additionally, listening to changes in specific configurations is difficult, as it requires registration in WorkspaceServiceImpl and it is not extensible.
This PR aims to address these challenges by introducing a new class, ClientConfigurationManager, which manages clients along with their configurations. It serves configuration values from a local cache if available, and only performs a request to the client when necessary. It also listens for configuration changes to keep the cache in sync.
There is also a new class ConfigValueCache which takes care of all the business logic of traversing the tree and maintaining configs according to the scopes as well.
Moreover, it allows listeners in the form of BiConsumer to be attached to specific configuration keys, enabling appropriate actions to be taken automatically when those configurations change.
PS: Thanks to @sid-srini for helping in the design.
@lahodaj addressed your review comments, please have a look again whenever it is possible. Thanks.
Seems sensible to me. Please note that there was a test in java.lsp.server failing - I've restarted the test, so we'll see.
@sdedic - please let us know if you have any comments. Thanks!
@Achal1607 just a nitpick for future PRs: it is better to describe in the commit msg what the commit changed or why the changes were made. When looking through history or running a git bisect "addressed review comments" is no longer helpful at this point.
@Achal1607 just a nitpick for future PRs: it is better to describe in the commit msg what the commit changed or why the changes were made. When looking through history or running a git bisect "addressed review comments" is no longer helpful at this point.
Thank you for the feedback, I’ll make sure to include more descriptive and meaningful commit messages in future PRs.
@Achal1607 you can still change it if you want ;)
Since it is a very old PR, I don't rember exact details, but will try to modify the commit by reading through the history of this PR.
@Achal1607 , I think what @mbien means is that it would be cleaner if the commit message just said "Refactored configuration management for LSP module", and didn't include these details:
addressed review comments
addressed some review comments
addressed review comments
fixed unit tests
@lahodaj , @mbien pushed again with the updated commit message.