Skip to content
This repository has been archived by the owner on Sep 2, 2020. It is now read-only.

Make watchman dependency optional #218

Merged
merged 12 commits into from Apr 3, 2018

Conversation

mgadda
Copy link
Collaborator

@mgadda mgadda commented Feb 22, 2018

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 from GraphQLCache. It is now a caller or consumer of GraphQLCache rather than a dependent class. This means that GraphQLWatchman.listFiles() has been replaced by glob() when GraphQLCache 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.

@asiandrummer
Copy link
Contributor

@mgadda let's add the non-related files as separate PR(s) please.

Copy link
Contributor

@asiandrummer asiandrummer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mgadda
Copy link
Collaborator Author

mgadda commented Mar 28, 2018

@asiandrummer if you're referring to my comments about buildJs.js and launch.json, both of those changes are reverted in the latest revision. So this PR is ready to merge, yes?

@asiandrummer asiandrummer merged commit 2b96960 into graphql:master Apr 3, 2018
@asiandrummer
Copy link
Contributor

Thanks @mgadda !

@asiandrummer
Copy link
Contributor

@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 😢
Facebook messenger vs. Slack vs. some other means maybe? Let me know!

@mgadda
Copy link
Collaborator Author

mgadda commented Apr 5, 2018

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants