Skip to content

Commit 3fb6462

Browse files
Style and test fixes
1 parent 15411d4 commit 3fb6462

File tree

2 files changed

+45
-34
lines changed

2 files changed

+45
-34
lines changed

crates/ra_ide_api/src/inlay_hints.rs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -216,52 +216,52 @@ fn main() {
216216
assert_debug_snapshot_matches!(analysis.inlay_hints(file_id).unwrap(), @r#"[
217217
InlayHint {
218218
range: [193; 197),
219-
kind: LetBindingType,
219+
kind: TypeHint,
220220
label: "i32",
221221
},
222222
InlayHint {
223223
range: [236; 244),
224-
kind: LetBindingType,
224+
kind: TypeHint,
225225
label: "i32",
226226
},
227227
InlayHint {
228228
range: [275; 279),
229-
kind: LetBindingType,
229+
kind: TypeHint,
230230
label: "&str",
231231
},
232232
InlayHint {
233233
range: [539; 543),
234-
kind: LetBindingType,
234+
kind: TypeHint,
235235
label: "(i32, char)",
236236
},
237237
InlayHint {
238238
range: [566; 567),
239-
kind: LetBindingType,
239+
kind: TypeHint,
240240
label: "i32",
241241
},
242242
InlayHint {
243243
range: [570; 571),
244-
kind: LetBindingType,
244+
kind: TypeHint,
245245
label: "i32",
246246
},
247247
InlayHint {
248248
range: [573; 574),
249-
kind: LetBindingType,
249+
kind: TypeHint,
250250
label: "i32",
251251
},
252252
InlayHint {
253253
range: [584; 585),
254-
kind: LetBindingType,
254+
kind: TypeHint,
255255
label: "i32",
256256
},
257257
InlayHint {
258258
range: [577; 578),
259-
kind: LetBindingType,
259+
kind: TypeHint,
260260
label: "f64",
261261
},
262262
InlayHint {
263263
range: [580; 581),
264-
kind: LetBindingType,
264+
kind: TypeHint,
265265
label: "f64",
266266
},
267267
]"#
@@ -283,12 +283,12 @@ fn main() {
283283
assert_debug_snapshot_matches!(analysis.inlay_hints(file_id).unwrap(), @r#"[
284284
InlayHint {
285285
range: [21; 30),
286-
kind: LetBindingType,
286+
kind: TypeHint,
287287
label: "i32",
288288
},
289289
InlayHint {
290290
range: [57; 66),
291-
kind: ClosureParameterType,
291+
kind: TypeHint,
292292
label: "i32",
293293
},
294294
]"#
@@ -310,12 +310,12 @@ fn main() {
310310
assert_debug_snapshot_matches!(analysis.inlay_hints(file_id).unwrap(), @r#"[
311311
InlayHint {
312312
range: [21; 30),
313-
kind: LetBindingType,
313+
kind: TypeHint,
314314
label: "i32",
315315
},
316316
InlayHint {
317317
range: [44; 53),
318-
kind: ForExpressionBindingType,
318+
kind: TypeHint,
319319
label: "i32",
320320
},
321321
]"#
@@ -356,27 +356,27 @@ fn main() {
356356
assert_debug_snapshot_matches!(analysis.inlay_hints(file_id).unwrap(), @r#"[
357357
InlayHint {
358358
range: [166; 170),
359-
kind: LetBindingType,
359+
kind: TypeHint,
360360
label: "CustomOption<Test>",
361361
},
362362
InlayHint {
363363
range: [334; 338),
364-
kind: IfExpressionType,
364+
kind: TypeHint,
365365
label: "&Test",
366366
},
367367
InlayHint {
368368
range: [389; 390),
369-
kind: IfExpressionType,
369+
kind: TypeHint,
370370
label: "&CustomOption<u32>",
371371
},
372372
InlayHint {
373373
range: [392; 393),
374-
kind: IfExpressionType,
374+
kind: TypeHint,
375375
label: "&u8",
376376
},
377377
InlayHint {
378378
range: [531; 532),
379-
kind: IfExpressionType,
379+
kind: TypeHint,
380380
label: "&u32",
381381
},
382382
]"#
@@ -417,7 +417,7 @@ fn main() {
417417
assert_debug_snapshot_matches!(analysis.inlay_hints(file_id).unwrap(), @r#"[
418418
InlayHint {
419419
range: [166; 170),
420-
kind: LetBindingType,
420+
kind: TypeHint,
421421
label: "CustomOption<Test>",
422422
},
423423
]"#
@@ -457,23 +457,23 @@ fn main() {
457457

458458
assert_debug_snapshot_matches!(analysis.inlay_hints(file_id).unwrap(), @r#"[
459459
InlayHint {
460-
range: [312; 316),
461-
kind: MatchArmType,
460+
range: [311; 315),
461+
kind: TypeHint,
462462
label: "Test",
463463
},
464464
InlayHint {
465-
range: [359; 360),
466-
kind: MatchArmType,
465+
range: [358; 359),
466+
kind: TypeHint,
467467
label: "CustomOption<u32>",
468468
},
469469
InlayHint {
470-
range: [362; 363),
471-
kind: MatchArmType,
470+
range: [361; 362),
471+
kind: TypeHint,
472472
label: "u8",
473473
},
474474
InlayHint {
475-
range: [485; 486),
476-
kind: MatchArmType,
475+
range: [484; 485),
476+
kind: TypeHint,
477477
label: "u32",
478478
},
479479
]"#

editors/code/src/commands/inlay_hints.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,19 @@ export class HintsUpdater {
2727
if (this.displayHints) {
2828
const documentUri = this.getEditorDocumentUri(editor);
2929
if (documentUri !== null) {
30-
const latestDecorations = this.drawnDecorations.get(documentUri);
30+
const latestDecorations = this.drawnDecorations.get(
31+
documentUri
32+
);
3133
if (latestDecorations === undefined) {
3234
await this.updateDecorationsFromServer(
3335
documentUri,
3436
editor!
3537
);
3638
} else {
37-
await editor!.setDecorations(typeHintDecorationType, latestDecorations);
39+
await editor!.setDecorations(
40+
typeHintDecorationType,
41+
latestDecorations
42+
);
3843
}
3944
}
4045
}
@@ -48,9 +53,12 @@ export class HintsUpdater {
4853
if (displayHints) {
4954
return this.updateHints();
5055
} else {
51-
const editor = vscode.window.activeTextEditor;
52-
if (this.getEditorDocumentUri(editor) !== null) {
53-
return editor!.setDecorations(typeHintDecorationType, []);
56+
const currentEditor = vscode.window.activeTextEditor;
57+
if (this.getEditorDocumentUri(currentEditor) !== null) {
58+
return currentEditor!.setDecorations(
59+
typeHintDecorationType,
60+
[]
61+
);
5462
}
5563
}
5664
}
@@ -92,7 +100,10 @@ export class HintsUpdater {
92100

93101
this.drawnDecorations.set(documentUri, newDecorations);
94102

95-
if (this.getEditorDocumentUri(vscode.window.activeTextEditor) === documentUri) {
103+
if (
104+
this.getEditorDocumentUri(vscode.window.activeTextEditor) ===
105+
documentUri
106+
) {
96107
return editor.setDecorations(
97108
typeHintDecorationType,
98109
newDecorations

0 commit comments

Comments
 (0)