-
Notifications
You must be signed in to change notification settings - Fork 31
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
Handle some server requests #60
Conversation
this makes progress indicators work, at least in helix
including caching capabilities and replaying registrations to new clients
@pr2502 amazing work, thank you! could we map also some cargo.toml validation from rust-analyzer? if we add some wrong crate name for example and it doesn't compile, a generic error message is throw. could we add some more info like this output example? ERROR instance{pid=74513}: stderr line= Updating crates.io index
ERROR instance{pid=74513}: stderr line=error: no matching package named `flexi_logger2` found
ERROR instance{pid=74513}: stderr line=location searched: registry `crates-io`
ERROR instance{pid=74513}: stderr line=required by package `neovide v0.12.2 (/Users/falcucci/neovide)`
ERROR instance{pid=74513}: stderr line=
ERROR instance{pid=74513}: stderr line=
ERROR instance{pid=74513}: stderr line=2024-03-14T10:35:38.426974Z ERROR flycheck: Flycheck failed to run the following command: CommandHandle { program: "/Users/falcucci/.rustup/toolchains/nightly-aarch64-apple-darwin/bin/cargo", arguments: ["clippy", "--workspace", "--message-format=json", "--manifest-path", "/Users/falcucci/neovide/Cargo.toml", "--all-targets"], current_dir: Some("/Users/falcucci/neovide") } |
Oh, is that sent as a LSP message and we ignore it or is only logged by rust-analyzer? We could try to emit a fake https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#window_showMessage message from log errors, but this is really something the language server should be doing. |
I need to look deeper but I guess it's sent by rust-analyzer, we should probably just map it with more details. I've looked around and looks like zed have done something similar recently exposing those errors to their lsp properly: zed-industries/zed#8356 At neovim using coc.nvim it just shows a message "failed to load workspace" |
Task::FetchWorkspace(progress) => {
let (state, msg) = match progress {
ProjectWorkspaceProgress::Begin => (Progress::Begin, None),
ProjectWorkspaceProgress::Report(msg) => (Progress::Report, Some(msg)),
ProjectWorkspaceProgress::End(workspaces, force_reload_crate_graph) => {
self.fetch_workspaces_queue
.op_completed(Some((workspaces, force_reload_crate_graph)));
if let Err(e) = self.fetch_workspace_error() {
tracing::error!("FetchWorkspaceError:\n{e}");
}
self.switch_workspaces("fetched workspace".to_owned());
(Progress::End, None)
}
};
self.report_progress("Fetching", state, msg, None, None);
} |
@pr2502 I've made this working here but probably needs to be refactored. I couldn't find a way to join all errors to notify it only once tho, but at least we aren't blind anymore with do you have any idea of how improve this? your PR looks already good to be merged, maybe we should treat this in another PR? |
Yes definitely, please make a separate PR for it 🙏 |
Supersedes #26. This handles some of the server -> client requests explicitly in ways which should be safe for that particular request and continues to ignore the rest like before.
So far I've implemented all requests I've noticed while using helix with rust-analyzer. I'll try more editors and language servers I'm familiar with when I have time. If anyone wants to try it with their editor please reply with your findings :)