aboutsummaryrefslogtreecommitdiff
path: root/editors/code
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code')
-rw-r--r--editors/code/package.json32
-rw-r--r--editors/code/src/client.ts2
-rw-r--r--editors/code/src/config.ts13
-rw-r--r--editors/code/src/inlay_hints.ts2
4 files changed, 20 insertions, 29 deletions
diff --git a/editors/code/package.json b/editors/code/package.json
index 6f2275062..296d6fe8e 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -307,28 +307,18 @@
307 "exclusiveMinimum": true, 307 "exclusiveMinimum": true,
308 "description": "Number of syntax trees rust-analyzer keeps in memory" 308 "description": "Number of syntax trees rust-analyzer keeps in memory"
309 }, 309 },
310 "rust-analyzer.inlayHintOpts.displayType": { 310 "rust-analyzer.inlayHints.typeHints": {
311 "type": "string", 311 "type": "boolean",
312 "enum": [ 312 "default": true,
313 "off", 313 "description": "Whether to show inlay type hints"
314 "typeHints",
315 "parameterHints",
316 "full"
317 ],
318 "enumDescriptions": [
319 "No type inlay hints",
320 "Type inlays hints only",
321 "Parameter inlays hints only",
322 "All inlay hints types"
323 ],
324 "default": "full",
325 "description": "Display additional type and parameter information in the editor"
326 }, 314 },
327 "rust-analyzer.inlayHintOpts.maxLength": { 315 "rust-analyzer.inlayHints.parameterHints": {
328 "type": [ 316 "type": "boolean",
329 "null", 317 "default": true,
330 "integer" 318 "description": "Whether to show function parameter name inlay hints at the call site"
331 ], 319 },
320 "rust-analyzer.inlayHints.maxLength": {
321 "type": "integer",
332 "default": 20, 322 "default": 20,
333 "minimum": 0, 323 "minimum": 0,
334 "exclusiveMinimum": true, 324 "exclusiveMinimum": true,
diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts
index ac4417c61..3b8ea6f77 100644
--- a/editors/code/src/client.ts
+++ b/editors/code/src/client.ts
@@ -29,7 +29,7 @@ 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 inlayHintOpts: config.inlayHintOpts, 32 inlayHints: config.inlayHints,
33 cargoWatchEnable: cargoWatchOpts.enable, 33 cargoWatchEnable: cargoWatchOpts.enable,
34 cargoWatchArgs: cargoWatchOpts.arguments, 34 cargoWatchArgs: cargoWatchOpts.arguments,
35 cargoWatchCommand: cargoWatchOpts.command, 35 cargoWatchCommand: cargoWatchOpts.command,
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts
index b26bf10da..2668c9640 100644
--- a/editors/code/src/config.ts
+++ b/editors/code/src/config.ts
@@ -6,7 +6,8 @@ import { log } from "./util";
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 { 8export interface InlayHintOptions {
9 displayType: string; 9 typeHints: boolean;
10 parameterHints: boolean;
10 maxLength: number; 11 maxLength: number;
11} 12}
12 13
@@ -28,8 +29,7 @@ export class Config {
28 "cargoFeatures", 29 "cargoFeatures",
29 "cargo-watch", 30 "cargo-watch",
30 "highlighting.semanticTokens", 31 "highlighting.semanticTokens",
31 "inlayHintOpts.maxLength", 32 "inlayHints",
32 "inlayHintOpts.displayType",
33 ] 33 ]
34 .map(opt => `${Config.rootSection}.${opt}`); 34 .map(opt => `${Config.rootSection}.${opt}`);
35 35
@@ -156,10 +156,11 @@ export class Config {
156 get highlightingOn() { return this.cfg.get("highlightingOn") as boolean; } 156 get highlightingOn() { return this.cfg.get("highlightingOn") as boolean; }
157 get rainbowHighlightingOn() { return this.cfg.get("rainbowHighlightingOn") as boolean; } 157 get rainbowHighlightingOn() { return this.cfg.get("rainbowHighlightingOn") as boolean; }
158 get lruCapacity() { return this.cfg.get("lruCapacity") as null | number; } 158 get lruCapacity() { return this.cfg.get("lruCapacity") as null | number; }
159 get inlayHintOpts(): InlayHintOptions { 159 get inlayHints(): InlayHintOptions {
160 return { 160 return {
161 displayType: this.cfg.get("inlayHintOpts.displayType") as string, 161 typeHints: this.cfg.get("inlayHints.typeHints") as boolean,
162 maxLength: this.cfg.get("inlayHintOpts.maxLength") as number, 162 parameterHints: this.cfg.get("inlayHints.parameterHints") as boolean,
163 maxLength: this.cfg.get("inlayHints.maxLength") as number,
163 }; 164 };
164 } 165 }
165 get excludeGlobs() { return this.cfg.get("excludeGlobs") as string[]; } 166 get excludeGlobs() { return this.cfg.get("excludeGlobs") as string[]; }
diff --git a/editors/code/src/inlay_hints.ts b/editors/code/src/inlay_hints.ts
index 8d291406d..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.inlayHintOpts.displayType === 'off') { 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);