-
Notifications
You must be signed in to change notification settings - Fork 200
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
Working with rustic and eglot #565
Comments
Hello Sam.
What don't you tell me, without code, what you're generally trying to accomplish? |
Hi!
use package_not_in_Cargo_toml; eglot will show the error
fn main() {
println!("hello world");
} and call println: std
#[macro_export]
macro_rules! println
___
Prints to the standard output, with a newline.
[...] The text shows that |
Nowadays I read Eglot issues as a curious bystander, so I can be totally wrong here, but I think these kind of features should be implemented on the server side. As an example, LSP clients can send code action requests with a given location and the server usually replies with possible CodeActions. For example, when the point is somewhere at "use package_not_in_Cargo_toml;" a code action can contain a WorkspaceEdit that (when the user chooses to execute it) inserts the missing import. Alternatively, the user may ask code actions of a given kind (e.g., source.organizeImports) for the entire file. |
That is so interesting that you're trying to do this. Eglot is primarily an LSP client, and it support these things called "code actions" that are part of the LSP protocol. So when an import is missing, in any language, or when a language-specific thing needs to be inserted in the buffer the the server should provide that code action. It seems this "rustic" mode is a rust-specific mode that uses some LSP? @nemeth's advice is very good advice. That's not to say that Eglot cannot in the future function as an API for communication with LSP servers, but it's not its primary purpose. I'd suggest that you use the
Yep. It seems again an again that either LSP is failing totally or people are actively resisting its premise (and its promise). |
I agree that this is more appropriate. If I remember correctly, I looked into at least the 2nd feature and people seemed content to have short documentation available through the LSP server and complete documentation available online/as html files. However, I much prefer browsing org-files than html files and that's how that feature was born. It is possible that I should have spent my time trying to implement something on the server instead of what I have here, but I imagine that would have been more work.
Right. I do not believe that this feature is implemented in the Rust LSP server rust-analyzer. Again, upstreaming these features would be preferable but more work - maybe I should look at it though.
Yes!
Thank you, I will look into it 👍 |
Hi! I am looking at making some rustic functionality that currently only works with LSP-mode work with eglot as well. There are 2 things I'm trying to accomplish but I haven't been able to figure out.
One is for the PR brotzeit/rustic#177 - which relies on getting diagnostics for the current buffer. At the moment get them from
eglot--unreported-diagnostics
along with some flymake functions, but I would prefer to make it not require flymake. Is there a nice way to do this?The other is getting the information shown with with
display-local-help
, which eglot seems to calleglot-hover-eldoc-function
. With LSP-mode this is accomplished by sending atextDocument/hover
request. Is there an equivalent for eglot?The text was updated successfully, but these errors were encountered: