rest-nvim / tree-sitter-http

HTTP grammar for tree-sitter
MIT License
34 stars 17 forks source link

add support for response redirects #40

Closed treywood closed 4 weeks ago

treywood commented 1 month ago

as supported in jetbrains IDEs: https://jetbrains.com/help/rider/Exploring_HTTP_Syntax.html#response-redirect

boltlessengineer commented 1 month ago

This would be easier to implement now with recent updates in the grammar. I’ll have a look if I can merge or rebase your commits later. Merging PRs in tree-sitter parser is hard 😭

treywood commented 1 month ago

oof I actually think recent changes in main broke some thing outside of this PR. in particular, external bodies are broken with response handler scripts. specifically this test fails:

GET https://www.example.com

< ./user.json

> /handler.json

expected result:

(document
  (section
    (request
      method: (method)
      url: (target_url)
      body: (external_body
        path: (path))
      (res_handler_script
        (path))))

actual result:

(document
  (section
    (request
      method: (method)
      url: (target_url)
      body: (external_body
        path: (path))
      body: (raw_body) <-- unexpected
      (res_handler_script
        (path))))

it seems like additional content after an external body causes everything to just be parsed as a raw body

treywood commented 1 month ago

@boltlessengineer I rebased on main, conflicts weren't too terrible :)

treywood commented 4 weeks ago

@boltlessengineer bump :)

boltlessengineer commented 4 weeks ago

Merging now. Thank you for your contribution!