about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-10-25 06:01:00 +0000
committerGitHub <noreply@github.com>2019-10-25 06:01:00 +0000
commit518f99e16b993e3414a81181c8bad7a89e590ece (patch)
tree6239cfcafd1d0a579b4f51e4e875cc0a8e85efb4
parentc02f1165ca4099ea6c3706a670513f7904630615 (diff)
parentdc65219ae1216e747215fe937b248ebf2469f33f (diff)
downloadrust-518f99e16b993e3414a81181c8bad7a89e590ece.tar.gz
rust-518f99e16b993e3414a81181c8bad7a89e590ece.zip
Merge #2065
2065: document feature flags r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
-rw-r--r--crates/ra_lsp_server/src/config.rs14
-rw-r--r--docs/user/README.md13
-rw-r--r--editors/code/package.json5
-rw-r--r--editors/code/src/config.ts7
-rw-r--r--editors/code/src/server.ts2
5 files changed, 20 insertions, 21 deletions
diff --git a/crates/ra_lsp_server/src/config.rs b/crates/ra_lsp_server/src/config.rs
index 579d4c6926b..9871a3b37f3 100644
--- a/crates/ra_lsp_server/src/config.rs
+++ b/crates/ra_lsp_server/src/config.rs
@@ -1,4 +1,11 @@
-//! FIXME: write short doc here
+//! Config used by the language server.
+//!
+//! We currently get this config from `initialize` LSP request, which is not the
+//! best way to do it, but was the simplest thing we could implement.
+//!
+//! Of particular interest is the `feature_flags` hash map: while other fields
+//! configure the server itself, feature flags are passed into analysis, and
+//! tweak things like automatic insertion of `()` in completions.
 
 use rustc_hash::FxHashMap;
 
@@ -72,10 +79,7 @@ mod test {
         assert_eq!(default, serde_json::from_str(r#"{}"#).unwrap());
         assert_eq!(
             default,
-            serde_json::from_str(
-                r#"{"publishDecorations":null, "showWorkspaceLoaded":null, "lruCapacity":null}"#
-            )
-            .unwrap()
+            serde_json::from_str(r#"{"publishDecorations":null, "lruCapacity":null}"#).unwrap()
         );
     }
 }
diff --git a/docs/user/README.md b/docs/user/README.md
index f1628d6a424..a1cef22cc6a 100644
--- a/docs/user/README.md
+++ b/docs/user/README.md
@@ -83,8 +83,6 @@ host.
 ### Settings
 
 * `rust-analyzer.highlightingOn`: enables experimental syntax highlighting
-* `rust-analyzer.showWorkspaceLoadedNotification`: to ease troubleshooting, a
-  notification is shown by default when a workspace is loaded
 * `rust-analyzer.enableEnhancedTyping`: by default, rust-analyzer intercepts
   `Enter` key to make it easier to continue comments. Note that it may conflict with VIM emulation plugin.
 * `rust-analyzer.raLspServerPath`: path to `ra_lsp_server` executable
@@ -102,6 +100,17 @@ host.
 * `rust-analyzer.trace.server`: enables internal logging
 * `rust-analyzer.trace.cargo-watch`: enables cargo-watch logging
 * `RUST_SRC_PATH`: environment variable that overwrites the sysroot
+* `rust-analyzer.featureFlags` -- a JSON object to tweak fine-grained behavior:
+   ```js
+   {
+       // Show diagnostics produced by rust-analyzer itself.
+       "lsp.diagnostics": true,
+       // Automatically insert `()` and `<>` when completing functions and types.
+       "completion.insertion.add-call-parenthesis": true,
+       // Show notification when workspace is fully loaded
+       "notifications.workspace-loaded": true,
+   }
+   ```
 
 
 ## Emacs
diff --git a/editors/code/package.json b/editors/code/package.json
index 4b719aadaf2..ee997e58f5d 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -229,11 +229,6 @@
                     "description": "A list of patterns for cargo-watch to ignore (will be passed as `--ignore`)",
                     "default": []
                 },
-                "rust-analyzer.showWorkspaceLoadedNotification": {
-                    "type": "boolean",
-                    "description": "Controls whether rust-analyzer displays a notification when a project is loaded.",
-                    "default": false
-                },
                 "rust-analyzer.trace.server": {
                     "type": "string",
                     "scope": "window",
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts
index 331936b5ece..95c3f42e50f 100644
--- a/editors/code/src/config.ts
+++ b/editors/code/src/config.ts
@@ -20,7 +20,6 @@ export class Config {
     public rainbowHighlightingOn = false;
     public enableEnhancedTyping = true;
     public raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server';
-    public showWorkspaceLoadedNotification = true;
     public lruCapacity: null | number = null;
     public displayInlayHints = true;
     public maxInlayHintLength: null | number = null;
@@ -56,12 +55,6 @@ export class Config {
             ) as boolean;
         }
 
-        if (config.has('showWorkspaceLoadedNotification')) {
-            this.showWorkspaceLoadedNotification = config.get(
-                'showWorkspaceLoadedNotification'
-            ) as boolean;
-        }
-
         if (!this.highlightingOn && Server) {
             Server.highlighter.removeHighlights();
         }
diff --git a/editors/code/src/server.ts b/editors/code/src/server.ts
index ff50fcd994c..a3ef21a1671 100644
--- a/editors/code/src/server.ts
+++ b/editors/code/src/server.ts
@@ -42,8 +42,6 @@ export class Server {
             documentSelector: [{ scheme: 'file', language: 'rust' }],
             initializationOptions: {
                 publishDecorations: true,
-                showWorkspaceLoaded:
-                    Server.config.showWorkspaceLoadedNotification,
                 lruCapacity: Server.config.lruCapacity,
                 excludeGlobs: Server.config.excludeGlobs,
                 useClientWatching: Server.config.useClientWatching,