rust-tools.nvim icon indicating copy to clipboard operation
rust-tools.nvim copied to clipboard

Support for .vscode/settings.json

Open jrmoulton opened this issue 3 years ago • 5 comments

On several projects that I work on rust analyzer is configured to work using a vscode settings.json file in order to set project settings that without them renders rust analyzer basically useless. Is there any support/ any way to read in those project settings and set the rust analyzer settings?

An example project

jrmoulton avatar Jul 06 '22 02:07 jrmoulton

Shouldn't be too hard to add support for with workspace/configurationChange or whatever it's called, the real hard part would be parsing the json, but yeah you're right its definitely a useful feature

simrat39 avatar Jul 18 '22 23:07 simrat39

Cool. I can work on implementing it. Would I just parse the json and then pass that in to the RA with the other server configs?

https://github.com/simrat39/rust-tools.nvim/blob/11dcd674781ba68a951ab4c7b740553cae8fe671/lua/rust-tools.lua#L150-L152 Would I just extend this with the parsed json?

jrmoulton avatar Jul 19 '22 00:07 jrmoulton

hmm not sure, would definitely want a way to update the settings without restarting neovim so an autocmd + parse the json then send a workspace/didChangeConfiguration

simrat39 avatar Jul 19 '22 00:07 simrat39

Really interested as well

Miaxos avatar Aug 02 '22 10:08 Miaxos

FWIW I was able to workaround the lack of this by using tamago324/nlsp-settings.nvim:

  • :LspSettings local buffer
  • Add your rust-analyzer settings to the JSON file that is opened
  • Restart neovim (LspRestart did not seem to work)

Samyak2 avatar Oct 18 '22 17:10 Samyak2