-
-
Notifications
You must be signed in to change notification settings - Fork 785
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
LSP Code Action: Generate dynamic decoder #4106
LSP Code Action: Generate dynamic decoder #4106
Conversation
Oh, do we want to add support for decoding tuples as well? If so, what would that decoder look like (I've only done basic decoding thus far) |
Yes please! Something like this: use hostname <- decode.field("hostname", decode.string)
use ip <- decode.field("ip", {
use a <- decode.field(0, decode.int)
use b <- decode.field(1, decode.int)
use c <- decode.field(2, decode.int)
use d <- decode.field(3, decode.int)
decode.success(#(a, b, c, d))
})
decode.success(Server(hostname:, ip:)) |
Ah I see, you can use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super cool! Neat how little code it is too. Very clean! Thank you!
|
||
decode.success(#(a, b, c)) | ||
}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we remove these empty lines please 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do it 👍
Closes #2955
This PR implements a code action to generate a dynamic decoder for a custom type.