aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
Diffstat (limited to 'editors')
-rw-r--r--editors/code/package.json13
-rw-r--r--editors/code/src/client.ts7
-rw-r--r--editors/code/src/config.ts18
-rw-r--r--editors/code/src/inlay_hints.ts2
4 files changed, 31 insertions, 9 deletions
diff --git a/editors/code/package.json b/editors/code/package.json
index 1fe8e9f8a..3aaae357a 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -261,7 +261,7 @@
261 "rust-analyzer.cargo-watch.enable": { 261 "rust-analyzer.cargo-watch.enable": {
262 "type": "boolean", 262 "type": "boolean",
263 "default": true, 263 "default": true,
264 "markdownDescription": "Run `cargo check` for diagnostics on save" 264 "markdownDescription": "Run specified `cargo-watch` command for diagnostics on save"
265 }, 265 },
266 "rust-analyzer.cargo-watch.arguments": { 266 "rust-analyzer.cargo-watch.arguments": {
267 "type": "array", 267 "type": "array",
@@ -312,12 +312,17 @@
312 "exclusiveMinimum": true, 312 "exclusiveMinimum": true,
313 "description": "Number of syntax trees rust-analyzer keeps in memory" 313 "description": "Number of syntax trees rust-analyzer keeps in memory"
314 }, 314 },
315 "rust-analyzer.displayInlayHints": { 315 "rust-analyzer.inlayHints.typeHints": {
316 "type": "boolean", 316 "type": "boolean",
317 "default": true, 317 "default": true,
318 "description": "Display additional type and parameter information in the editor" 318 "description": "Whether to show inlay type hints"
319 }, 319 },
320 "rust-analyzer.maxInlayHintLength": { 320 "rust-analyzer.inlayHints.parameterHints": {
321 "type": "boolean",
322 "default": true,
323 "description": "Whether to show function parameter name inlay hints at the call site"
324 },
325 "rust-analyzer.inlayHints.maxLength": {
321 "type": [ 326 "type": [
322 "null", 327 "null",
323 "integer" 328 "integer"
diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts
index 99c9c5ae7..d65454275 100644
--- a/editors/code/src/client.ts
+++ b/editors/code/src/client.ts
@@ -29,11 +29,16 @@ export async function createClient(config: Config, serverPath: string): Promise<
29 initializationOptions: { 29 initializationOptions: {
30 publishDecorations: !config.highlightingSemanticTokens, 30 publishDecorations: !config.highlightingSemanticTokens,
31 lruCapacity: config.lruCapacity, 31 lruCapacity: config.lruCapacity,
32 maxInlayHintLength: config.maxInlayHintLength, 32
33 inlayHintsType: config.inlayHints.typeHints,
34 inlayHintsParameter: config.inlayHints.parameterHints,
35 inlayHintsMaxLength: config.inlayHints.maxLength,
36
33 cargoWatchEnable: cargoWatchOpts.enable, 37 cargoWatchEnable: cargoWatchOpts.enable,
34 cargoWatchArgs: cargoWatchOpts.arguments, 38 cargoWatchArgs: cargoWatchOpts.arguments,
35 cargoWatchCommand: cargoWatchOpts.command, 39 cargoWatchCommand: cargoWatchOpts.command,
36 cargoWatchAllTargets: cargoWatchOpts.allTargets, 40 cargoWatchAllTargets: cargoWatchOpts.allTargets,
41
37 excludeGlobs: config.excludeGlobs, 42 excludeGlobs: config.excludeGlobs,
38 useClientWatching: config.useClientWatching, 43 useClientWatching: config.useClientWatching,
39 featureFlags: config.featureFlags, 44 featureFlags: config.featureFlags,
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts
index 3ade7e900..6db073bec 100644
--- a/editors/code/src/config.ts
+++ b/editors/code/src/config.ts
@@ -5,6 +5,12 @@ import { log } from "./util";
5 5
6const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; 6const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG;
7 7
8export interface InlayHintOptions {
9 typeHints: boolean;
10 parameterHints: boolean;
11 maxLength: number | null;
12}
13
8export interface CargoWatchOptions { 14export interface CargoWatchOptions {
9 enable: boolean; 15 enable: boolean;
10 arguments: string[]; 16 arguments: string[];
@@ -22,7 +28,8 @@ export class Config {
22 private static readonly requiresReloadOpts = [ 28 private static readonly requiresReloadOpts = [
23 "cargoFeatures", 29 "cargoFeatures",
24 "cargo-watch", 30 "cargo-watch",
25 "highlighting.semanticTokens" 31 "highlighting.semanticTokens",
32 "inlayHints",
26 ] 33 ]
27 .map(opt => `${Config.rootSection}.${opt}`); 34 .map(opt => `${Config.rootSection}.${opt}`);
28 35
@@ -149,8 +156,13 @@ export class Config {
149 get highlightingOn() { return this.cfg.get("highlightingOn") as boolean; } 156 get highlightingOn() { return this.cfg.get("highlightingOn") as boolean; }
150 get rainbowHighlightingOn() { return this.cfg.get("rainbowHighlightingOn") as boolean; } 157 get rainbowHighlightingOn() { return this.cfg.get("rainbowHighlightingOn") as boolean; }
151 get lruCapacity() { return this.cfg.get("lruCapacity") as null | number; } 158 get lruCapacity() { return this.cfg.get("lruCapacity") as null | number; }
152 get displayInlayHints() { return this.cfg.get("displayInlayHints") as boolean; } 159 get inlayHints(): InlayHintOptions {
153 get maxInlayHintLength() { return this.cfg.get("maxInlayHintLength") as number; } 160 return {
161 typeHints: this.cfg.get("inlayHints.typeHints") as boolean,
162 parameterHints: this.cfg.get("inlayHints.parameterHints") as boolean,
163 maxLength: this.cfg.get("inlayHints.maxLength") as null | number,
164 };
165 }
154 get excludeGlobs() { return this.cfg.get("excludeGlobs") as string[]; } 166 get excludeGlobs() { return this.cfg.get("excludeGlobs") as string[]; }
155 get useClientWatching() { return this.cfg.get("useClientWatching") as boolean; } 167 get useClientWatching() { return this.cfg.get("useClientWatching") as boolean; }
156 get featureFlags() { return this.cfg.get("featureFlags") as Record<string, boolean>; } 168 get featureFlags() { return this.cfg.get("featureFlags") as Record<string, boolean>; }
diff --git a/editors/code/src/inlay_hints.ts b/editors/code/src/inlay_hints.ts
index e1a82e03e..b19b09ad5 100644
--- a/editors/code/src/inlay_hints.ts
+++ b/editors/code/src/inlay_hints.ts
@@ -10,7 +10,7 @@ export function activateInlayHints(ctx: Ctx) {
10 const maybeUpdater = { 10 const maybeUpdater = {
11 updater: null as null | HintsUpdater, 11 updater: null as null | HintsUpdater,
12 onConfigChange() { 12 onConfigChange() {
13 if (!ctx.config.displayInlayHints) { 13 if (!ctx.config.inlayHints.typeHints && !ctx.config.inlayHints.parameterHints) {
14 return this.dispose(); 14 return this.dispose();
15 } 15 }
16 if (!this.updater) this.updater = new HintsUpdater(ctx); 16 if (!this.updater) this.updater = new HintsUpdater(ctx);