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.
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.
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-diagnosticsjust 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.