Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve span accuracy during parsing #6072

Closed
JeanMertz opened this issue Jan 15, 2021 · 0 comments · Fixed by #6353
Closed

improve span accuracy during parsing #6072

JeanMertz opened this issue Jan 15, 2021 · 0 comments · Fixed by #6353
Assignees
Labels
domain: vrl Anything related to the Vector Remap Language type: enhancement A value-adding code change that enhances its existing functionality.

Comments

@JeanMertz
Copy link
Contributor

JeanMertz commented Jan 15, 2021

Once #6023 is merged, VRL will have its first batch of diagnostic messages.

While the initial batch is "good enough", there's more we can do.

Take there two examples:

error: unneeded error assignment
  ┌─ :2:1
  │
2 │ ok, err = 5;
  │ ^^^^^^^   - because this expression cannot fail
  │ │          
  │ this error assignment is unneeded
  │
  = hint: assign to "ok", without assigning to "err"
  = see language documentation at: https://...
error: unknown function argument keyword
  ┌─ :2:11
  │
2 │ to_string(foo: .bar, .baz)
  │           ^^^^^^^^^^^^^^^ unknown keyword: foo
  │
  = see language documentation at: https://...

While they are useable, the span ranges aren't as specific as I'd like.

For example, in the first one, I'd rather have the span point to err specifically. And for the second one it should point to the foo keyword.

This is mostly a matter of slicing up our parse functions into smaller sections that only parse one specific part, and then encode the span of that part in their result. We're close to that goal, but this issue can track the progress to resolving the above to cases, and any others where more fine-grained span information would improve the diagnostic.

@JeanMertz JeanMertz added type: enhancement A value-adding code change that enhances its existing functionality. domain: vrl Anything related to the Vector Remap Language labels Jan 15, 2021
@binarylogic binarylogic added this to the 2021-01-18 Tabula E-Rasa milestone Jan 15, 2021
@jamtur01 jamtur01 removed this from the 2021-01-18 Tabula E-Rasa milestone Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: vrl Anything related to the Vector Remap Language type: enhancement A value-adding code change that enhances its existing functionality.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants