-
Notifications
You must be signed in to change notification settings - Fork 101
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
Missing imports eglot #177
base: master
Are you sure you want to change the base?
Conversation
We still have the problem that we call lsp-mode/flymake code that we didn't require. |
Good catch, in my mind |
Maybe we can add files for eglot and lsp-mode and require these files somewhere. |
As it is now, LSP and eglot should not be required if they're not loaded thanks to |
Use with 'prefix-arg` to select imports to add." | ||
(interactive) | ||
(when (rustic-cargo-edit-installed-p) | ||
(if-let ((missing-imports (if (ignore-error lsp-mode) |
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.
You can do something like (if (featurep 'lsp-mode) (print "foo"))
(if (string= "E0432" (gethash "code" errortable)) | ||
(cons (nth 3 (split-string (gethash "message" errortable) "`")) missing-crates) | ||
missing-crates)) | ||
(gethash (buffer-file-name) (lsp-diagnostics t)) '()))) |
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.
You can funcall
the lsp function here.
Just an update, I contacted the eglot maintainers and they'd rather I do something else than the current solution, so I will look into that when I get time, but school is taking up all my focus at the moment. |
For #169
Now supports both eglot and lsp. I'm not a huge fan of how I collect the missing imports from eglot. It works by inspecting errors that eglot is about to send to flymake, which makes it a bit hacky. In the lsp-mode version, a call to the function
lsp-diagnostics
just returns everything that's needed, but I could not find an equivalent function in eglot, though obviously it must be there somewhere.Werks on my machine, but I need to try it a bit more and have another look at the code.