lapce / lapce/lapce-plugin-rust
Function to send notification to client editor
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 31
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
There should be a function to easily send a notification to the client from a plugin. This can currently be achieved via object_to_stdout, but in a somewhat unpleasant manner and makes the plugin authors have to figure out the details of the LSP/PSP api for sending information. (I think that function should also be hidden, and plugin authors using the library should just deal with functions for sending notifications/requests)
We can use lsp-types/psp-types Notification trait to make things more type-safe, like:
pub fn send_notification<T: Notification>(params: T::Params) {
// Having them give the `T` ensures that they can't give us the wrong method name or the wrong params
// They can still do custom notifications (like editor-specific notifs) via making a custom structure and implementing Notification on it
let method: &'static str = T::METHOD;
// We could just have send_host_notification take `impl Serialize`?
send_host_notification(method, json!(params));
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the existing object_to_stdout path and reviewing the lsp-types/psp-types Notification trait mentioned in the issue. Define the typed notification entry point and determine how object_to_stdout should be hidden; done means plugin authors can send typed and custom notifications without handling the LSP/PSP details directly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, developer-experience
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100