graphiql icon indicating copy to clipboard operation
graphiql copied to clipboard

Missing field type info in code mirror and type ahead is broken

Open yilinjuang opened this issue 2 years ago • 4 comments

In doc viewer, the type of edges ([AccessEdge]!) is shown correctly image

But in code mirror, the type is missing image

Also, if the type is missing, type ahead inside the field doesn't work. Not sure if they share the same cause

edges {
  type_here_no_hint
}

yilinjuang avatar May 23 '22 11:05 yilinjuang

This is an issue with https://github.com/graphql/graphiql/blob/main/packages/graphiql-react/src/editor/completion.ts

It's hard to tell what wrong, because we've lost most of the git history for graphiql

acao avatar Jun 08 '22 12:06 acao

@acao I would like to work on this issue. Any suggestions or starting points?

yilinjuang avatar Jun 24 '22 09:06 yilinjuang

Hi @yilinjuang 👋 I just tried to replicate this bug with the current state of main but was not able to. I tried it for the same kind of wrapped type (non-nullable list of nullable underlying types) but the info tooltip showed me the correct type.

CleanShot 2022-06-27 at 10 53 43@2x

As I can't reproduce this, it's even better when you have some time to look into this! 🙌 This file (which is part of codemirror-graphql) registers the handler that renders the contents of this tooltip. The token argument of the callback will be the type or field that you hover over. Note that the implementation will change slightly with #2513 (will hopefully be merged in the coming days).

thomasheyenbrock avatar Jun 27 '22 09:06 thomasheyenbrock

@yilinjuang it could be that our html-escape is filtering out the string. is your type name spec valid? personally I think it's restrictive, I think there are proposals to extend it.

acao avatar Jun 27 '22 15:06 acao