apollo-rs icon indicating copy to clipboard operation
apollo-rs copied to clipboard

Many lexer errors do not have a location

Open goto-bus-stop opened this issue 1 year ago • 1 comments

Description

Many errors emitted by the lexer do not set the error.index property, so they point to the start of the document by default.

Steps to reproduce

Input a GraphQL document with unexpected characters:

type Query {
  // Some invalid characters
  user: User
}

Expected result

Syntax errors point to the correct position

Actual result

rror: syntax error: Unexpected character "/"
   ╭─[q.graphql:1:1]
   │
 1 │ type Query {
   │ ┬
   │ ╰── Unexpected character "/"
───╯
Error: syntax error: Unexpected character "/"
   ╭─[q.graphql:1:1]
   │
 1 │ type Query {
   │ ┬
   │ ╰── Unexpected character "/"
───╯

goto-bus-stop avatar Nov 09 '23 10:11 goto-bus-stop