graphql / graphiql

GraphiQL & the GraphQL LSP Reference Ecosystem for building browser & IDE tools.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Refactor LSP to enable remote schema invalidation

acao opened this issue · comments

Refactor in this case is referring to the highest level interface of the LSP server - the LSP protocol server itself. Perhaps we will make sure runServer is still 100% in parity as well. But MessageProcessor and anything inside the GraphQLLanguageService and GraphQLCache could change completely.

The MessageProcessor class has grown unwieldy, taking on responsibilities beyond it's duty that would make more sense for GraphQLCache to own, and in some cases even duplicating the file cache to some degree.

  • All methods related to cacheing code-first schemas need to be migrated from MessageProcessor to GraphQLCache (so that it can make this part of the schema cache lifecycle, thus more up-to-date generated schema files!)
  • All methods related to loading config and cacheing files should also be migrated from MessageProcessor to GraphQLCache - it makes more sense for the cache class to own this lifecycle, and it will make it easier to handle cache invalidation across code first and schema first scenarios.
  • The _textDocumentCache in MessageProcessor should be migrated to/merged with GraphQLCache's file cache

Before we begin this we refactor, we will wait for #3521 to be merged, so that we have a high quality test plane from which to detect regressions.

Then, we can fix the code first schema invalidation scenario!