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

Add support for Zipper.find_all/3 #163

Merged
merged 1 commit into from
Aug 10, 2024

Conversation

bcardarella
Copy link
Contributor

No description provided.

|> Z.next()
|> Z.next()
|> Z.next()
|> Z.next()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if there is a better way to get to the last node let me know. I tried Zipper.rightmost but I think that only goes to the right most of the current node

@bcardarella
Copy link
Contributor Author

FYI unrelated tests failing with Elixir 1.17

  1) test get_range/1 bitstrings (SourcerorTest.RangeTest)
     test/range_test.exs:1041
     Assertion with == failed
     code:  assert decorate(code, to_range(code)) == "«<<1, 2,\n\n foo>>»\n" |> String.trim_trailing()
     left:  "«<<1, 2,\n\n foo>>\n»"
     right: "«<<1, 2,\n\n foo>>»"
     stacktrace:
       test/range_test.exs:1051: (test)

......

  2) test get_range/1 anonymous functions (SourcerorTest.RangeTest)
     test/range_test.exs:664
     Assertion with == failed
     code:  assert decorate(code, to_range(code)) == "«fn ->\n  :ok\nend»\n" |> String.trim()
     left:  "«fn ->\n  :ok\nend\n»"
     right: "«fn ->\n  :ok\nend»"
     stacktrace:
       test/range_test.exs:674: (test)

................................................................................................................................................................

  3) test get_end_position/2 returns the correct positions (SourcerorTest)
     test/sourceror_test.exs:546
     Assertion with == failed
     code:  assert Sourceror.get_end_position(quoted) == [line: 3, column: 1]
     left:  [line: 3, column: 3]
     right: [line: 3, column: 1]
     stacktrace:
       test/sourceror_test.exs:565: (test)

.

  4) doctest Sourceror.get_end_position/2 (20) (SourcerorTest)
     test/sourceror_test.exs:7
     Doctest failed
     doctest:
       iex> quoted = ~S"""
       ...> foo do
       ...>   :ok
       ...> end
       ...> """ |>  Sourceror.parse_string!()
       iex> Sourceror.get_end_position(quoted)
       [line: 3, column: 1]
     code:  Sourceror.get_end_position(quoted) === [line: 3, column: 1]
     left:  [line: 3, column: 3]
     right: [line: 3, column: 1]
     stacktrace:
       lib/sourceror.ex:562: Sourceror (module)

@bcardarella
Copy link
Contributor Author

force pushed format fix for CI

Copy link
Owner

@doorgan doorgan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you!

About the 1.17 test issues, it seems some bugs in the elixir parser were fixed in core elixir. We can either backport those fixes in a new PR, or adopt lib_elixir(I have a POC here but there's some polishing needed to make it work appropriately)

@doorgan doorgan merged commit c6b0cd9 into doorgan:main Aug 10, 2024
6 checks passed
@bcardarella bcardarella deleted the bc-zipper-find-all branch August 10, 2024 07:48
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

Successfully merging this pull request may close these issues.

2 participants