Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a useable GraphQL Monaco Mode and Example #1445

Closed
3 of 7 tasks
acao opened this issue Apr 1, 2020 · 1 comment · Fixed by #1459
Closed
3 of 7 tasks

Create a useable GraphQL Monaco Mode and Example #1445

acao opened this issue Apr 1, 2020 · 1 comment · Fixed by #1459

Comments

@acao
Copy link
Member

acao commented Apr 1, 2020

We are working towards a stable graphql-monaco that will become a part of the official, stable GraphiQL reference implementation, in place of our project codemirror-graphql.

Reasoning

The primary reasoning is that monaco is more closely aligned with the LSP spec, reducing many redundancies in the rest of our ide language service ecosystem. The effort of maintaining and introducing new language and editor features to GraphiQL and other browser/electron based IDEs will be significantly reduced.

What's more, users will have a great time with the vscode-like experience and built-in features. This will make it much easier for plugin authors to provide their own diagnostics (aka linting/validation), completion (aka hinting/autocompletion/intellisense), schema loaders, code helpers, command palette shortcuts, and many more options!

Design Notes

None of these will be dependent on react of course, as is also the case with codemirror-graphql. For example, altair project uses codemirror-graphql with angular! This is what we want to enable with monaco-graphql as wel, so implementations using vue, vanilla js, even older DOM manipulation frameworks are able to use this.

It will of course implement our underling GraphQL language service as other monaco modes do, so we will want to make PRs to modify/enhance the LSP and interfaces as needed. These will be ported from the current mega draft PR.

Monaco GraphQL and examples

  • packages/monaco-graphql (new)
  • examples/monaco-amd-example (new) - using amd/requirejs
  • examples/monaco-webpack-example (new)

Work in Progress:

  • Draft PR (Monaco Mode - Phase 1 #1421) - following monaco-json closely. This is the one that will become the actual monaco service.
  • Proof of Concept (POC) Branch - implements monaco using anti-patterns, but successfully achieves completion, diagnostics, popovers without instantiating the LSP class or using webworkers which is a requirement (this is what the draft PR above does). Uses underlying LSP functions the class uses, rather than the full class, similar to what codemirror-graphql does. This is meant to be for reference, just to see the familiar LS <> Monaco compatibility layer.

TODO

  • (in progress, some methods work but not full LSP class) launch language service(s) in webworker(s) (see: monaco-json, monaco-typescript, etc)
  • operation diagnostics
  • (in progress) operation completion
  • (in progress) Port GraphQL cache for web and server usage, remove runtime dependent features and replace with config options
  • re-register default graphql language with our own version
  • operation references/definition support (via LS class)
  • variables JSON completion/diagnostics/declarations etc (dynamically define json schema, so much simpler than with codemirror!)
@acao acao added this to the monaco-graphql@0.0.1 milestone Apr 1, 2020
@acao acao mentioned this issue Apr 1, 2020
9 tasks
@acao
Copy link
Member Author

acao commented Apr 3, 2020

@rebornix thinking the Phase 1 and next few PRs would add up to this, and then we can come back around and make sure workspaces support is in place, and user config/interfaces are improved, and cross-workspace symbol references (for e.g. a query field -> generated SDL schema representation), for another roadmap possibly? towards the completion of the full fledged monaco project?

@acao acao linked a pull request Apr 10, 2020 that will close this issue
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant