]> git.lizzy.rs Git - rust.git/commitdiff
document feature flags
authorAleksey Kladov <aleksey.kladov@gmail.com>
Fri, 25 Oct 2019 06:00:30 +0000 (09:00 +0300)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Fri, 25 Oct 2019 06:00:30 +0000 (09:00 +0300)
crates/ra_lsp_server/src/config.rs
docs/user/README.md
editors/code/package.json
editors/code/src/config.ts
editors/code/src/server.ts

index 579d4c6926b52cacac0d33d73647a3033e3381dd..9871a3b37f3958ece204a6b07248c13041e81e8c 100644 (file)
@@ -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 @@ fn deserialize_init_options_defaults() {
         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()
         );
     }
 }
index f1628d6a424cc127e885659221d8100d2f8211b0..a1cef22cc6a3f4a905b8cea9c862ed7dae95d502 100644 (file)
@@ -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
index 4b719aadaf266539a326ad0546bcc40cfedf754c..ee997e58f5d09c099f63210215e65efd1419c345 100644 (file)
                     "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",
index 331936b5ece8deada79ed57091dcccae7b437a36..95c3f42e50ff42a6b7084a9c67b5e5e4fb81478f 100644 (file)
@@ -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();
         }
index ff50fcd994cf3e72a7979463e41ee480b0a79ca6..a3ef21a1671949dec48dfe8ff7c409be8a34c1e6 100644 (file)
@@ -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,