Conversation
Also abstracted watchman initialization logic out of MessageProcess.handleInitializeRequest and into a separate instance method. In order to facilitate the use of MockWatchmanClient in tests, a GraphQLWatchman-shaped object is now passed into the MessageProcessor constructor.
@mgadda let's add the non-related files as separate PR(s) please. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@asiandrummer if you're referring to my comments about |
Thanks @mgadda ! |
@mgadda - apologies again for a huge delay. I'd love to establish a different primary contact mean from emailing - apparently I suck at reading them 😢 |
@asiandrummer I've sent you a message on Facebook Messenger if that's preferable. It's probably hiding in the people-you-don't-know inbox. |
This patch, which addresses issue #206, makes watchman an optional dependency of graphql-language-service. The motivation for this patch is defined within the language server specification under DidChangeWatchedFiles Notification. Less dependencies make for easier administration of IDEs that rely on graphql-language-service.
That said, it's conceivable that many consumers of this project already rely and/or prefer to use watchman instead of LSP for file watch events. To appease both use cases, this PR leaves full watchman support intact and functional by default. Only if watchman is not detected on the system will LSP be used for watched file change events.
In order to facilitate the two separate mechanisms for being notified of watched file change events,
GraphQLWatchman
has been decoupled fromGraphQLCache
. It is now a caller or consumer of GraphQLCache rather than a dependent class. This means thatGraphQLWatchman.listFiles()
has been replaced byglob()
whenGraphQLCache
wants to obtain a list of files to parse and cache.Watchman subscription is now handled within
MessageProcessor.handleInitializeRequest
and in turn_subcribeWatchman
.Finally, while the diff looks fairly large, it's mostly the same code you already know just moving around a bit.