Skip to content

Conversation

@u9g
Copy link
Contributor

@u9g u9g commented Oct 16, 2023

I remove the monaco-editor patch because it was the wrong fix, and we can just wait for the pr to land as it's just a console message.

This pr adds:

  • autocompleting fields on ctrl+space (on a new line)
  • autocompleting @-directives (after a field name or more @Directives) and will somewhat filter them based on the field's type
  • Only allow interfaces to be autocompleted that implement the type in ... on X fragments
  • Updates pnpm because they retroactively broke our pnpm version for patches as dependency installs fail and the solution update to latest

Future possibilities:

  • Autocomplete op type in @filter?

@u9g u9g changed the title Improve patches on graphql-language-service and remove monaco-editor patch Add new patches to graphql-language-service and remove monaco-editor patch Oct 16, 2023
Copy link
Owner

@obi1kenobi obi1kenobi left a comment

Choose a reason for hiding this comment

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

Love the ideas for smarter autocomplete! Thanks for putting this together.

I think I might have found a few remaining edge cases before this is ready to merge and publish. Whenever you're able to take a look, I'll be happy to merge this.

+ // `state` is `null` when the user autocompletes after typing just '@' then opening autocomplete menu
+ // further restrict the directives we suggest based on the type of the field we are on
+ // x.label does not include the '@'
+ if (primitives.has(typeInfo.fieldDef.type.name)) {
Copy link
Owner

Choose a reason for hiding this comment

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

What happens here if the field type is something like [String!] or [[Int]]!?

Copy link
Contributor Author

@u9g u9g Oct 18, 2023

Choose a reason for hiding this comment

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

Amazing point, thank you! Then it will be an object of

{
    "ofType": { // <- the list
        "name": "String" // <- the actual type
    }
}

So the solution is just to iterate, done in 0f15fee

@obi1kenobi obi1kenobi added C-enhancement Category: raise the bar on expectations A-playground Area: the query playground at play.predr.ag labels Oct 18, 2023
u9g added 2 commits October 17, 2023 23:23
Don't check over each type's interface's interface's since the parent type must declare all interfaces implemented
@obi1kenobi obi1kenobi force-pushed the main branch 3 times, most recently from 15f64a4 to 64ebfd5 Compare November 17, 2023 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-playground Area: the query playground at play.predr.ag C-enhancement Category: raise the bar on expectations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants