-
Notifications
You must be signed in to change notification settings - Fork 10
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 measure_width #26
Conversation
unimplemented!(); | ||
match method { | ||
"measure_width" => match from_value::<MeasureWidthRequest>(params) { | ||
Ok(req) => Box::new( |
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.
It's kind of a shame that we have to re-box something that was already boxed... If I understand correctly, impl Trait
would help here, but it's not supported in trait methods, yet. Not sure if there's something else to try.
Enabling word_wrap should cause Xi to send you this upon inserting characters. |
Ah nice, I'll try this out with xi-term then. I see you already added |
Feel free to ping me if you need help with that. I guess I won't be able to test it in gxi before #27 is resolved :/ |
b2c69e7
to
b37f6d2
Compare
|
Alright, I'll try to add this to gxi later |
I've thought about this for a bit, but I can't come up with a prettier solution than using one function per Request either, since using dynamic typing for this doesn't sound good, as you've mentioned. |
e0adaaf
to
9c70346
Compare
The |
Oh, okay, thanks :) |
Does xi-term send |
No it doesn't |
I'll try with |
Then that explains why it "bugs" out like that. You have to send Xi |
match JsonRpcResult::<Value, Value>::deserialize(deserializer)? { | ||
|
||
JsonRpcResult::Result(value) => { | ||
println!("{:?}", value); |
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.
note to self: remove that
src/client.rs
Outdated
"changes": changes, | ||
}), | ||
) | ||
pub fn modify_user_config(&self, domain: ConfigDomain, changes: ConfigChanges) -> ClientResult<()> { |
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.
@Cogitri I think you use modify_user_config
quite a lot already in gxi
so this will impact you. If having to deal with this bothers you, I'll move this change to a separate PR that can be merged later, just let me know.
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.
Ah, yes, thanks for the heads up! I do use this a lot in gxi - I don't use the file based config of xi anymore but allow configuration via the UI and GSettings (the GLib integrated way to deal with settings). It's a bit of a bother that I'll have to pass in all of my settings into the function now via ConfigChanges instead of just passing what has actually changed to it, but I guess this works for me.
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.
Right now I only pass the changes to xi: https://github.com/Cogitri/gxi/blob/master/src/gxi/src/main_win.rs#L949
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.
Yeah, I'll remove that change from this PR, we'll see later.
This changes the `Frontend` trait, renaming the too generic `handle_event()` into `handle_notification()`, and `XiEvent` into `XiNotification`.
we just ran `cargo fix --edition-idioms`
responses were not deserialized correctly, so this commit fixes it. it also simplifies (de)serialization with the `flatten` attribute.
- derive Default - skip serializing fields that are None - add `word_wrap`
Nice, will add to gxi. Thanks for your work! :) Will look at #29 in a few minutes I suppose. |
Yeah I'll look this afternoon (in ~2h probably). |
This is based on #24 so that @Cogitri can try it out if they want. Also note that I haven't tested it out yet because I'm not sure how to make xi-core to send me that specific request.
This is the first time we support requests (as opposed to notifications) from the core.
I could not reuse
XiEvent
because unlike all the events we've been handling until now, we need to return something to the core. As a result, we cannot usehandle_event()
. As a result, I added a method toFrontend
, and renamedXiEvent
andhandle_event()
toXiNotification
andhandle_notification()
respectively.One thing that annoys me is that with requests, we'll be reproducing the issue described in #21, because we'll add one method to the
Frontend
trait for each request with a distinct return type. For instance, here I added:One solution would be to only have one method called
handle_request
, and an enumXiRequest
similar to the currentXiEvent
:The problem is that we lose the strong typing on the return value, and implementors would have to convert their result into a
Value
which does not seem very nice.What do you think @ByteBuddha @Cogitri ?