sxyazi / yazi

💥 Blazing fast terminal file manager written in Rust, based on async I/O.
https://yazi-rs.github.io
MIT License
11.42k stars 266 forks source link

feat!: include the `sender` ID in static messages #1172

Closed sxyazi closed 1 week ago

sxyazi commented 1 week ago

In practice, the severity of static messages has proven to be meaningless and increases protocol complexity.

This PR replacing severity with sender to resolves https://github.com/sxyazi/yazi/pull/1004#discussion_r1596707396

⚠️ Breaking changes

This PR removes the ps.pub_static() method and replaces it with ps.pub_to():

- ps.pub_static(10, "greeting", "Hello, World!")
+ ps.pub_to(0, "@greeting", "Hello, World!")

Messages with a kind that starts with @ indicate they are static messages. Accordingly, ps.sub_remote() subscribes to static messages using that kind:

- ps.sub_remote("greeting", function() end)
+ ps.sub_remote("@greeting", function() end)

The ya pub-static command has also been removed and replaced with ya pub:

- ya pub-static 10 "greeting" --str "Hello, World!"
+ ya pub "@greeting" 0 --str "Hello, World!"
sxyazi commented 1 week ago

Need more tests to merge

mikavilpas commented 1 week ago

Looks like a great idea, and this would be quite helpful in the neovim integration. I'll try to find time to do a proof of concept with this, maybe next week.