File tree Expand file tree Collapse file tree
apollo-language-server/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -197,27 +197,31 @@ export class GraphQLLanguageProvider {
197197 }
198198 break ;
199199 }
200+
200201 case Kind . FIELD : {
201202 const parentType = typeInfo . getParentType ( ) ;
202203 const fieldDef = typeInfo . getFieldDef ( ) ;
203204
204205 if ( parentType && fieldDef ) {
206+ const argsString = fieldDef . args . length > 0 ?
207+ `(${ fieldDef . args . map ( a => `${ a . name } : ${ a . type } ` ) . join ( ", " ) } )` : "" ;
205208 return {
206209 contents : `
207210\`\`\`graphql
208- ${ parentType } .${ fieldDef . name } : ${ fieldDef . type }
211+ ${ parentType } .${ fieldDef . name } ${ argsString } : ${ fieldDef . type }
209212\`\`\`
210213${ fieldDef . description }
211214` ,
212215 range : rangeForASTNode ( highlightNodeForNode ( node ) )
213216 } ;
214217 }
218+
215219 break ;
216220 }
217- case Kind . NAMED_TYPE : {
218- const type = typeInfo . getType ( ) as GraphQLNamedType | void ;
219221
220- if ( ! ( type && type . astNode && type . astNode . loc ) ) break ;
222+ case Kind . NAMED_TYPE : {
223+ const type = set . schema . getType ( node . name . value ) as GraphQLNamedType | void ;
224+ if ( ! type ) break ;
221225
222226 return {
223227 contents : `
@@ -229,6 +233,19 @@ ${type.description}
229233 range : rangeForASTNode ( highlightNodeForNode ( node ) )
230234 } ;
231235 }
236+
237+ case Kind . ARGUMENT : {
238+ const argumentNode = typeInfo . getArgument ( ) ! ;
239+ return {
240+ contents : `
241+ \`\`\`graphql
242+ ${ argumentNode . name } : ${ argumentNode . type }
243+ \`\`\`
244+ ${ argumentNode . description }
245+ ` ,
246+ range : rangeForASTNode ( highlightNodeForNode ( node ) )
247+ }
248+ }
232249 }
233250 }
234251 return null ;
Original file line number Diff line number Diff line change @@ -222,9 +222,7 @@ export class GraphQLProject {
222222
223223 for ( const set of this . documentSets ) {
224224 if ( ! set . schema ! . getQueryType ( ) ! . astNode ) {
225- const schemaSource = printSchema ( set . schema ! , {
226- commentDescriptions : true
227- } ) ;
225+ const schemaSource = printSchema ( set . schema ! ) ;
228226
229227 set . schema = buildSchema (
230228 new Source (
Original file line number Diff line number Diff line change 171171 ]
172172 },
173173 "graphql-comment" : {
174- "comment" :
175- " need to prefix comment space with a scope else Atom's reflow cmd doesn't work" ,
176- "name" : " comment.line.graphql.js" ,
177- "match" : " (\\ s*)(#).*" ,
178- "captures" : {
179- "1" : { "name" : " punctuation.whitespace.comment.leading.graphql" }
180- }
174+ "patterns" : [
175+ {
176+ "comment" :
177+ " need to prefix comment space with a scope else Atom's reflow cmd doesn't work" ,
178+ "name" : " comment.line.graphql.js" ,
179+ "match" : " (\\ s*)(#).*" ,
180+ "captures" : {
181+ "1" : { "name" : " punctuation.whitespace.comment.leading.graphql" }
182+ }
183+ },
184+ {
185+ "name" : " comment.line.graphql.js" ,
186+ "begin" : " (\"\"\" )" ,
187+ "end" : " (\"\"\" )" ,
188+ "beginCaptures" : {
189+ "1" : { "name" : " punctuation.whitespace.comment.leading.graphql" }
190+ }
191+ }
192+ ]
181193 },
182194 "graphql-variable-definitions" : {
183195 "begin" : " \\ s*(\\ ()" ,
You can’t perform that action at this time.
0 commit comments