Updating My Emacs Rust Configuration
Federico Mena Quintero’s ‘Bringing my Emacs from the past’ taught me that rustic, lsp-mode, and the Rust Language Server (RLS) were all ready for the primetime, so I took the opportunity to update my own configuration. What I had was rather primitive as lsp-mode &c. were too immature and unreliable to use—particularly on Windows—back when I set it up.
First, I yanked out rust-mode and company-lsp. Next, I needed to install rustic, lsp-mode, and lsp-ui. I had trouble getting the packages at first—for some reason, Emacs (by way of use-package) insisted they couldn’t be found on MELPA, so I cloned the repositories. I kept getting errors when I tried to use them, so I gave MELPA another shot and this time the packages were mysteriously found. This made some errors go away. I next tried updating my version of dash from 2019-something to the latest version. Emacs was still unable to start the language server. Then, slowly, it dawned upon me that I may not have the RLS running at all. Sure enough, I didn’t have that Rust component installed.
Once I added the RLS component using rustup, I had a working lsp-mode. lsp-ui kept giving me errors about syntax-table-p, however, and I found nothing about it on GitHub. In the process of opening a new issue, I dove into the provenance of the error and discovered it wasn’t in lsp-ui at all but rather in a local copy of thingatpt+.el that I had lying around, for some reason. Once I deleted that (apparently unnecessary) file, everything worked perfectly and I had a functional Rust IDE with a language server providing completion, renaming, refactoring, syntax checking, and all that good stuff. (I thought at first that there was something wrong with the sideline, because it wasn’t showing anything, but that was only because there was nothing to show.)
- I still had to add the xterm-color package to get lsp-ui to work.↩