rust-analyzer JSON-RPC STDIN Example

This is the readme for this project which is where I figured out how to connect to the rust-analyzer over STDIN for a neopolitan LSP

  • An example of how to connect to rust-analyzer from STDIN with JSON-RPC

  • This gets semantic tokens

  • The paths are hardcoded to "/Users/alan/Desktop/ratest"

  • A "Cargo.toml" file has to exist at "/Users/alan/Desktop/ratest/Cargo.toml" for the semantic tokens to work

  • Watch out for the escaping of the paths. I think I had some problems with that as well, but that was early so it may have been unrelated issue

  • The "output.log" shows an example run

  • There's a couple sleep timers in the mix. They're necessary for things to work properly. This was just a scratchpad test and they did the job. Something aimed at production would need a more robust solution

  • One thing to examine is the "augmentsSyntaxTokens" option which sounds like it reduced the number of tokens sent so they don't fight with other highlighters.






STDIN Logger

This is the little tool I wrote that let me see what Neovim was sending to rust-analyzer (I did a quick renamed to put it in place to see what was going across the wire)




Neopolitan - a plain-text format for websites