Closed jtormey closed 4 months ago
@NduatiK how much of a lift would it be to support multiline rules? I believe we are currently splitting on \n
and parsing each individually.
I bet I could repurpose the code I'm writing for the interpolation update. It just really requires a byte processor to detect when a rule's (
and )
terminate and using that as the point to split on. I may try to solve this tonight
@NduatiK how much of a lift would it be to support multiline rules? I believe we are currently splitting on
\n
and parsing each individually.
We are not splitting on \n
. I believe we use whitespace
and ignore_whitespace
to be agnostic on the delimiter between things. We know that a rule has ended if it has the expected structure: "..." do ... end
.
That said, annotations could do with some work though, the rule in the original issue produces the following AST. The :sheet
source should capture everything in the original snippet instead of just capturing the line and source of the closing )
"sheet" => [
{:sheet, [file: "mock_sheet.ex", line: 10, module: MockSheet, source: ")"],
[
[
asdf: "<- invalid",
isPresented:
{:__attr__,
[
file: "mock_sheet.ex",
line: 7,
module: MockSheet,
source: "isPresented: attr(\"presented\"),"
], "presented"},
onDismiss:
{:__event__,
[
file: "mock_sheet.ex",
line: 8,
module: MockSheet,
source: "onDismiss: event(\"sheet_dismiss\"),"
], ["sheet_dismiss", []]},
content: :sheet_content
]
]}
]
@bcardarella, could you also run this with the latest swiftui to see if the issue is still there?
I suspect that the swiftui side is detecting an invalid key on asdf: "<- invalid"
and failing to show the location because kv pairs do not have annotations. In that case, it might also be useful to have the swift ui parser climb up the ast to find annotations higher up the tree, in this case, asdf: "<- invalid"
should use sheet
s annotations
@NduatiK you are correct, this works perfect fine. Thanks, closing as a non-issue for main
Given an invalid multi-line modifier like this:
The following message will print in the Xcode console:
It would be nice for debugging if the full modifier call were printed.