aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 579d4c692..9871a3b37 100644
--- a/crates/ra_lsp_server/src/config.rs
+++ b/crates/ra_lsp_server/src/config.rs
@@ -1,4 +1,11 @@
1//! FIXME: write short doc here 1//! Config used by the language server.
2//!
3//! We currently get this config from `initialize` LSP request, which is not the
4//! best way to do it, but was the simplest thing we could implement.
5//!
6//! Of particular interest is the `feature_flags` hash map: while other fields
7//! configure the server itself, feature flags are passed into analysis, and
8//! tweak things like automatic insertion of `()` in completions.
2 9
3use rustc_hash::FxHashMap; 10use rustc_hash::FxHashMap;
4 11
@@ -72,10 +79,7 @@ mod test {
72 assert_eq!(default, serde_json::from_str(r#"{}"#).unwrap()); 79 assert_eq!(default, serde_json::from_str(r#"{}"#).unwrap());
73 assert_eq!( 80 assert_eq!(
74 default, 81 default,
75 serde_json::from_str( 82 serde_json::from_str(r#"{"publishDecorations":null, "lruCapacity":null}"#).unwrap()
76 r#"{"publishDecorations":null, "showWorkspaceLoaded":null, "lruCapacity":null}"#
77 )
78 .unwrap()
79 ); 83 );
80 } 84 }
81} 85}
diff --git a/docs/user/README.md b/docs/user/README.md
index f1628d6a4..a1cef22cc 100644
--- a/docs/user/README.md
+++ b/docs/user/README.md
@@ -83,8 +83,6 @@ host.
83### Settings 83### Settings
84 84
85* `rust-analyzer.highlightingOn`: enables experimental syntax highlighting 85* `rust-analyzer.highlightingOn`: enables experimental syntax highlighting
86* `rust-analyzer.showWorkspaceLoadedNotification`: to ease troubleshooting, a
87 notification is shown by default when a workspace is loaded
88* `rust-analyzer.enableEnhancedTyping`: by default, rust-analyzer intercepts 86* `rust-analyzer.enableEnhancedTyping`: by default, rust-analyzer intercepts
89 `Enter` key to make it easier to continue comments. Note that it may conflict with VIM emulation plugin. 87 `Enter` key to make it easier to continue comments. Note that it may conflict with VIM emulation plugin.
90* `rust-analyzer.raLspServerPath`: path to `ra_lsp_server` executable 88* `rust-analyzer.raLspServerPath`: path to `ra_lsp_server` executable
@@ -102,6 +100,17 @@ host.
102* `rust-analyzer.trace.server`: enables internal logging 100* `rust-analyzer.trace.server`: enables internal logging
103* `rust-analyzer.trace.cargo-watch`: enables cargo-watch logging 101* `rust-analyzer.trace.cargo-watch`: enables cargo-watch logging
104* `RUST_SRC_PATH`: environment variable that overwrites the sysroot 102* `RUST_SRC_PATH`: environment variable that overwrites the sysroot
103* `rust-analyzer.featureFlags` -- a JSON object to tweak fine-grained behavior:
104 ```js
105 {
106 // Show diagnostics produced by rust-analyzer itself.
107 "lsp.diagnostics": true,
108 // Automatically insert `()` and `<>` when completing functions and types.
109 "completion.insertion.add-call-parenthesis": true,
110 // Show notification when workspace is fully loaded
111 "notifications.workspace-loaded": true,
112 }
113 ```
105 114
106 115
107## Emacs 116## Emacs
diff --git a/editors/code/package.json b/editors/code/package.json
index 4b719aada..ee997e58f 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -229,11 +229,6 @@
229 "description": "A list of patterns for cargo-watch to ignore (will be passed as `--ignore`)", 229 "description": "A list of patterns for cargo-watch to ignore (will be passed as `--ignore`)",
230 "default": [] 230 "default": []
231 }, 231 },
232 "rust-analyzer.showWorkspaceLoadedNotification": {
233 "type": "boolean",
234 "description": "Controls whether rust-analyzer displays a notification when a project is loaded.",
235 "default": false
236 },
237 "rust-analyzer.trace.server": { 232 "rust-analyzer.trace.server": {
238 "type": "string", 233 "type": "string",
239 "scope": "window", 234 "scope": "window",
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts
index 331936b5e..95c3f42e5 100644
--- a/editors/code/src/config.ts
+++ b/editors/code/src/config.ts
@@ -20,7 +20,6 @@ export class Config {
20 public rainbowHighlightingOn = false; 20 public rainbowHighlightingOn = false;
21 public enableEnhancedTyping = true; 21 public enableEnhancedTyping = true;
22 public raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server'; 22 public raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server';
23 public showWorkspaceLoadedNotification = true;
24 public lruCapacity: null | number = null; 23 public lruCapacity: null | number = null;
25 public displayInlayHints = true; 24 public displayInlayHints = true;
26 public maxInlayHintLength: null | number = null; 25 public maxInlayHintLength: null | number = null;
@@ -56,12 +55,6 @@ export class Config {
56 ) as boolean; 55 ) as boolean;
57 } 56 }
58 57
59 if (config.has('showWorkspaceLoadedNotification')) {
60 this.showWorkspaceLoadedNotification = config.get(
61 'showWorkspaceLoadedNotification'
62 ) as boolean;
63 }
64
65 if (!this.highlightingOn && Server) { 58 if (!this.highlightingOn && Server) {
66 Server.highlighter.removeHighlights(); 59 Server.highlighter.removeHighlights();
67 } 60 }
diff --git a/editors/code/src/server.ts b/editors/code/src/server.ts
index ff50fcd99..a3ef21a16 100644
--- a/editors/code/src/server.ts
+++ b/editors/code/src/server.ts
@@ -42,8 +42,6 @@ export class Server {
42 documentSelector: [{ scheme: 'file', language: 'rust' }], 42 documentSelector: [{ scheme: 'file', language: 'rust' }],
43 initializationOptions: { 43 initializationOptions: {
44 publishDecorations: true, 44 publishDecorations: true,
45 showWorkspaceLoaded:
46 Server.config.showWorkspaceLoadedNotification,
47 lruCapacity: Server.config.lruCapacity, 45 lruCapacity: Server.config.lruCapacity,
48 excludeGlobs: Server.config.excludeGlobs, 46 excludeGlobs: Server.config.excludeGlobs,
49 useClientWatching: Server.config.useClientWatching, 47 useClientWatching: Server.config.useClientWatching,