Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ export class QueryEditor extends React.Component<Props, {}> {
if (this.props.schema !== prevProps.schema) {
this.editor.options.lint.schema = this.props.schema
this.editor.options.hintOptions.schema = this.props.schema
if (this.props.schema) {
this.editor.options.hintOptions.schema.getType = type => {
return type
}
}
CodeMirror.signal(this.editor, 'change', this.editor)
}
if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/

import { GraphQLNonNull, GraphQLList } from 'graphql'
// import { GraphQLNonNull, GraphQLList } from 'graphql'
import * as marked from 'marked'

/**
Expand Down Expand Up @@ -93,7 +93,7 @@ export default function onHasCompletion(cm, data, onHintInformationRender) {
// Now that the UI has been set up, add info to information.
const description = ctx.description
? marked(ctx.description, { sanitize: true })
: 'Self descriptive.'
: ''
const type = ctx.type
? '<span class="infoType">' + renderType(ctx.type) + '</span>'
: ''
Expand Down Expand Up @@ -124,11 +124,11 @@ export default function onHasCompletion(cm, data, onHintInformationRender) {
}

function renderType(type) {
if (type instanceof GraphQLNonNull) {
return `${renderType(type.ofType)}!`
}
if (type instanceof GraphQLList) {
return `[${renderType(type.ofType)}]`
}
return `<a class="typeName">${type.name}</a>`
// if (type instanceof GraphQLNonNull) {
// return `${renderType(type.ofType)}!`
// }
// if (type instanceof GraphQLList) {
// return `[${renderType(type.ofType)}]`
// }
return `<a class="typeName">${type}</a>`
}