File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ export function syntaxError(
22
22
description : string
23
23
) : GraphQLError {
24
24
const location = getLocation ( source , position ) ;
25
- const line = location . line + source . location . line - 1 ;
25
+ const line = location . line + source . locationOffset . line - 1 ;
26
26
const error = new GraphQLError (
27
27
`Syntax Error ${ source . name } (${ line } :${ location . column } ) ${ description } ` +
28
28
'\n\n' +
@@ -40,7 +40,7 @@ export function syntaxError(
40
40
*/
41
41
function highlightSourceAtLocation ( source , location ) {
42
42
const line = location . line ;
43
- const lineOffset = source . location . line - 1 ;
43
+ const lineOffset = source . locationOffset . line - 1 ;
44
44
const contextLine = line + lineOffset ;
45
45
const prevLineNum = ( contextLine - 1 ) . toString ( ) ;
46
46
const lineNum = contextLine . toString ( ) ;
Original file line number Diff line number Diff line change @@ -15,19 +15,19 @@ type Location = {
15
15
16
16
/**
17
17
* A representation of source input to GraphQL.
18
- * `name` and `location ` are optional. They are useful for clients who store
19
- * GraphQL documents in source files; for example, if the GraphQL input starts
20
- * at line 40 in a file named Foo.graphql, it might be useful for name to be
21
- * "Foo.graphql" and location to be `{ line: 40, column: 0 }`.
18
+ * `name` and `locationOffset ` are optional. They are useful for clients who
19
+ * store GraphQL documents in source files; for example, if the GraphQL input
20
+ * starts at line 40 in a file named Foo.graphql, it might be useful for name to
21
+ * be "Foo.graphql" and location to be `{ line: 40, column: 0 }`.
22
22
*/
23
23
export class Source {
24
24
body : string ;
25
25
name: string ;
26
- location : Location ;
26
+ locationOffset : Location ;
27
27
28
- constructor ( body : string , name ? : string , location ? : Location ) : void {
28
+ constructor ( body : string , name ? : string , locationOffset ? : Location ) : void {
29
29
this . body = body ;
30
30
this . name = name || 'GraphQL request' ;
31
- this . location = location || { line : 1 , column : 0 } ;
31
+ this . locationOffset = locationOffset || { line : 1 , column : 0 } ;
32
32
}
33
33
}
You can’t perform that action at this time.
0 commit comments