Skip to content

Commit 4fa911d

Browse files
committed
Auto-complete description
1 parent f84b2a2 commit 4fa911d

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

packages/graphql-playground/src/components/Playground/QueryEditor.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@ export class QueryEditor extends React.Component<Props, {}> {
147147
if (this.props.schema !== prevProps.schema) {
148148
this.editor.options.lint.schema = this.props.schema
149149
this.editor.options.hintOptions.schema = this.props.schema
150+
if (this.props.schema) {
151+
this.editor.options.hintOptions.schema.getType = type => {
152+
return type
153+
}
154+
}
150155
CodeMirror.signal(this.editor, 'change', this.editor)
151156
}
152157
if (

packages/graphql-playground/src/components/Playground/onHasCompletion.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
import { GraphQLNonNull, GraphQLList } from 'graphql'
9+
// import { GraphQLNonNull, GraphQLList } from 'graphql'
1010
import * as marked from 'marked'
1111

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

126126
function renderType(type) {
127-
if (type instanceof GraphQLNonNull) {
128-
return `${renderType(type.ofType)}!`
129-
}
130-
if (type instanceof GraphQLList) {
131-
return `[${renderType(type.ofType)}]`
132-
}
133-
return `<a class="typeName">${type.name}</a>`
127+
// if (type instanceof GraphQLNonNull) {
128+
// return `${renderType(type.ofType)}!`
129+
// }
130+
// if (type instanceof GraphQLList) {
131+
// return `[${renderType(type.ofType)}]`
132+
// }
133+
return `<a class="typeName">${type}</a>`
134134
}

0 commit comments

Comments
 (0)