Repository: rust-analyzer/rust-analyzer
Pull request #1781 (2019-09-06 17:59:37)

don't deadlock on shutdown


Patch:
diff --git a/crates/ra_lsp_server/src/main.rs b/crates/ra_lsp_server/src/main.rs
index d40fed9475..852fae0277 100644
--- a/crates/ra_lsp_server/src/main.rs
+++ b/crates/ra_lsp_server/src/main.rs
@@ -66,7 +66,7 @@ fn run_server() -> Result<()> {
         workspace_roots,
         initialize_params.capabilities,
         server_config,
-        &connection,
+        connection,
     )?;
 
     log::info!("shutting down IO...");
diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs
index 25fa51b8a7..2059f98001 100644
--- a/crates/ra_lsp_server/src/main_loop.rs
+++ b/crates/ra_lsp_server/src/main_loop.rs
@@ -52,7 +52,7 @@ pub fn main_loop(
     ws_roots: Vec<PathBuf>,
     client_caps: ClientCapabilities,
     config: ServerConfig,
-    connection: &Connection,
+    connection: Connection,
 ) -> Result<()> {
     log::info!("server_config: {:#?}", config);
 
@@ -174,7 +174,7 @@ pub fn main_loop(
                 &pool,
                 &task_sender,
                 &libdata_sender,
-                connection,
+                &connection,
                 &mut world_state,
                 &mut loop_state,
                 event,
diff --git a/docs/user/README.md b/docs/user/README.md
index c11e0fcb6d..56c2d9eb50 100644
--- a/docs/user/README.md
+++ b/docs/user/README.md
@@ -106,12 +106,35 @@ to load path and require it in `init.el`
   - Note that if you use a plugin manager other than `vim-plug`, you may need to manually
     checkout the `release` branch wherever your plugin manager cloned it. Otherwise you will
     get errors about a missing javascript file.
-* Run `:CocInstall coc-rust-analyzer` to install `coc-rust-analyzer`, this extension already implemented _almost_ all features supported in VSCode extension:
-  - same configurations as VSCode extension, `rust-analyzer.raLspServerPath`, `rust-analyzer.enableCargoWatchOnStartup` etc.
-  - same commands too, `rust-analyzer.analyzerStatus`, `rust-analyzer.startCargoWatch` etc.
-  - highlighting and inlay_hints is not works by now
+* Add rust analyzer using: [coc.nvim wiki][coc-wiki]
+  - Use `:CocConfig` in command mode to edit the config file.
+
+```jsonc
+ "languageserver": {
+  "rust": {
+    "command": "ra_lsp_server",
+    "filetypes": ["rust"],
+    "rootPatterns": ["Cargo.toml"]
+  }
+ }
+```
+
+For those not familiar with js, the whole file should be enclosed in `{` and `}`, with all of your config options in between. So for example, if rust-analyzer was your only language server, you could do the following:
+
+```jsonc
+{
+ "languageserver": {
+  "rust": {
+    "command": "ra_lsp_server",
+    "filetypes": ["rust"],
+    "rootPatterns": ["Cargo.toml"]
+  }
+ }
+}
+```
 
 [coc.nvim]: https://github.com/neoclide/coc.nvim
+[coc-wiki]: https://github.com/neoclide/coc.nvim/wiki/Language-servers#rust
 [coc-vim-conf]: https://github.com/neoclide/coc.nvim/#example-vim-configuration
 
 


Test patch:
diff --git a/crates/ra_lsp_server/tests/heavy_tests/support.rs b/crates/ra_lsp_server/tests/heavy_tests/support.rs
index 89f65cef45..86073b57df 100644
--- a/crates/ra_lsp_server/tests/heavy_tests/support.rs
+++ b/crates/ra_lsp_server/tests/heavy_tests/support.rs
@@ -118,7 +118,7 @@ impl Server {
                         experimental: None,
                     },
                     ServerConfig { with_sysroot, ..ServerConfig::default() },
-                    &connection,
+                    connection,
                 )
                 .unwrap()
             })