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

Parsing: chunking #470

Open
rbalicki2 opened this issue Mar 10, 2025 · 0 comments
Open

Parsing: chunking #470

rbalicki2 opened this issue Mar 10, 2025 · 0 comments

Comments

@rbalicki2
Copy link
Collaborator

In the pico world, it would be great to divide parsing of selection sets into a chunking step and then actually parsing, e.g.

field Query.Foo {
  bar
  baz # not defined
  syntax.error
}

If we hover on bar, then what should happen is that we do something like

  • get_chunks(some_identifier)
    • get_type("Query") -> query_object_id
    • get_field(query_object_id, "Foo")
    • find which chunk contains bar, i.e. the first chunk. This is done via comparing row/col or whatnot
    • get_field(query_object_id, "bar")
    • etc

i.e. at no point do we actually get get_field(query_object_id, "baz") and determine that it doesn't exist!

Chunking for iso literals:

  • we know that fields must end with a closing curly, comma, or line break
  • we know that curlies must match
  • we know that fields cannot start with @
  • that should be enough to divide the above into chunks: "bar", "baz", "syntax.error"

Chunking for GraphQL schema:

  • should be easy enough to do, also lower priority, though
  • but basically apply similar heuristics: go until closing matching curly or another keyword

I'm not sure how IDs work in this case, but presumably, we can chunk and find? idk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant