fannheyward / coc-rust-analyzer

rust-analyzer extension for coc.nvim
MIT License
1.13k stars 40 forks source link

Build updated local docs before opening them #1263

Open danielrainer opened 3 months ago

danielrainer commented 3 months ago

At the moment, local docs are not updated when running rust-analyzer.openDocs, which can result in unintentionally reading outdated documentation.

I suggest to provide a way of automatically building docs before opening them.

The simplest approach, which I use right now, is to just use an editor shortcut which runs cargo doc before requesting opening docs. (<cmd>!cargo doc<cr><cmd>CocCommand rust-analyzer.openDocs<cr>)

Alternatively, this functionality could be integrated into coc-rust-analyzer (possibly configurable), but this might be unnecessarily complicated.

In case the code is kept the way it is, I think it would be good to add a note in the documentation of the rust-analyzer.openDocs command indicating that local docs are not updated, and adding a hint that updated can be achieved by running cargo doc in the same shortcut used for opening docs.