]> git.lizzy.rs Git - rust.git/commitdiff
Style and test fixes
authorKirill Bulatov <mail4score@gmail.com>
Sun, 4 Aug 2019 21:47:14 +0000 (00:47 +0300)
committerKirill Bulatov <mail4score@gmail.com>
Sun, 4 Aug 2019 22:02:36 +0000 (01:02 +0300)
crates/ra_ide_api/src/inlay_hints.rs
editors/code/src/commands/inlay_hints.ts

index 60a2c7cf57bf95d8f7dd92a87570e8955571c0b6..7b919031411086e228d2cfed765cb046a0d2496f 100644 (file)
@@ -216,52 +216,52 @@ struct InnerStruct {}
         assert_debug_snapshot_matches!(analysis.inlay_hints(file_id).unwrap(), @r#"[
     InlayHint {
         range: [193; 197),
-        kind: LetBindingType,
+        kind: TypeHint,
         label: "i32",
     },
     InlayHint {
         range: [236; 244),
-        kind: LetBindingType,
+        kind: TypeHint,
         label: "i32",
     },
     InlayHint {
         range: [275; 279),
-        kind: LetBindingType,
+        kind: TypeHint,
         label: "&str",
     },
     InlayHint {
         range: [539; 543),
-        kind: LetBindingType,
+        kind: TypeHint,
         label: "(i32, char)",
     },
     InlayHint {
         range: [566; 567),
-        kind: LetBindingType,
+        kind: TypeHint,
         label: "i32",
     },
     InlayHint {
         range: [570; 571),
-        kind: LetBindingType,
+        kind: TypeHint,
         label: "i32",
     },
     InlayHint {
         range: [573; 574),
-        kind: LetBindingType,
+        kind: TypeHint,
         label: "i32",
     },
     InlayHint {
         range: [584; 585),
-        kind: LetBindingType,
+        kind: TypeHint,
         label: "i32",
     },
     InlayHint {
         range: [577; 578),
-        kind: LetBindingType,
+        kind: TypeHint,
         label: "f64",
     },
     InlayHint {
         range: [580; 581),
-        kind: LetBindingType,
+        kind: TypeHint,
         label: "f64",
     },
 ]"#
@@ -283,12 +283,12 @@ fn main() {
         assert_debug_snapshot_matches!(analysis.inlay_hints(file_id).unwrap(), @r#"[
     InlayHint {
         range: [21; 30),
-        kind: LetBindingType,
+        kind: TypeHint,
         label: "i32",
     },
     InlayHint {
         range: [57; 66),
-        kind: ClosureParameterType,
+        kind: TypeHint,
         label: "i32",
     },
 ]"#
@@ -310,12 +310,12 @@ fn main() {
         assert_debug_snapshot_matches!(analysis.inlay_hints(file_id).unwrap(), @r#"[
     InlayHint {
         range: [21; 30),
-        kind: LetBindingType,
+        kind: TypeHint,
         label: "i32",
     },
     InlayHint {
         range: [44; 53),
-        kind: ForExpressionBindingType,
+        kind: TypeHint,
         label: "i32",
     },
 ]"#
@@ -356,27 +356,27 @@ fn main() {
         assert_debug_snapshot_matches!(analysis.inlay_hints(file_id).unwrap(), @r#"[
     InlayHint {
         range: [166; 170),
-        kind: LetBindingType,
+        kind: TypeHint,
         label: "CustomOption<Test>",
     },
     InlayHint {
         range: [334; 338),
-        kind: IfExpressionType,
+        kind: TypeHint,
         label: "&Test",
     },
     InlayHint {
         range: [389; 390),
-        kind: IfExpressionType,
+        kind: TypeHint,
         label: "&CustomOption<u32>",
     },
     InlayHint {
         range: [392; 393),
-        kind: IfExpressionType,
+        kind: TypeHint,
         label: "&u8",
     },
     InlayHint {
         range: [531; 532),
-        kind: IfExpressionType,
+        kind: TypeHint,
         label: "&u32",
     },
 ]"#
@@ -417,7 +417,7 @@ fn main() {
         assert_debug_snapshot_matches!(analysis.inlay_hints(file_id).unwrap(), @r#"[
     InlayHint {
         range: [166; 170),
-        kind: LetBindingType,
+        kind: TypeHint,
         label: "CustomOption<Test>",
     },
 ]"#
@@ -457,23 +457,23 @@ fn main() {
 
         assert_debug_snapshot_matches!(analysis.inlay_hints(file_id).unwrap(), @r#"[
     InlayHint {
-        range: [312; 316),
-        kind: MatchArmType,
+        range: [311; 315),
+        kind: TypeHint,
         label: "Test",
     },
     InlayHint {
-        range: [359; 360),
-        kind: MatchArmType,
+        range: [358; 359),
+        kind: TypeHint,
         label: "CustomOption<u32>",
     },
     InlayHint {
-        range: [362; 363),
-        kind: MatchArmType,
+        range: [361; 362),
+        kind: TypeHint,
         label: "u8",
     },
     InlayHint {
-        range: [485; 486),
-        kind: MatchArmType,
+        range: [484; 485),
+        kind: TypeHint,
         label: "u32",
     },
 ]"#
index 5af3a69bcbfcd2aedf1746c1c73bc55c86eceab9..11a2cfac5bc00ab78f33f9d86bb8de0eee83b394 100644 (file)
@@ -27,14 +27,19 @@ export class HintsUpdater {
         if (this.displayHints) {
             const documentUri = this.getEditorDocumentUri(editor);
             if (documentUri !== null) {
-                const latestDecorations = this.drawnDecorations.get(documentUri);
+                const latestDecorations = this.drawnDecorations.get(
+                    documentUri
+                );
                 if (latestDecorations === undefined) {
                     await this.updateDecorationsFromServer(
                         documentUri,
                         editor!
                     );
                 } else {
-                    await editor!.setDecorations(typeHintDecorationType, latestDecorations);
+                    await editor!.setDecorations(
+                        typeHintDecorationType,
+                        latestDecorations
+                    );
                 }
             }
         }
@@ -48,9 +53,12 @@ export class HintsUpdater {
             if (displayHints) {
                 return this.updateHints();
             } else {
-                const editor = vscode.window.activeTextEditor;
-                if (this.getEditorDocumentUri(editor) !== null) {
-                    return editor!.setDecorations(typeHintDecorationType, []);
+                const currentEditor = vscode.window.activeTextEditor;
+                if (this.getEditorDocumentUri(currentEditor) !== null) {
+                    return currentEditor!.setDecorations(
+                        typeHintDecorationType,
+                        []
+                    );
                 }
             }
         }
@@ -92,7 +100,10 @@ export class HintsUpdater {
 
             this.drawnDecorations.set(documentUri, newDecorations);
 
-            if (this.getEditorDocumentUri(vscode.window.activeTextEditor) === documentUri) {
+            if (
+                this.getEditorDocumentUri(vscode.window.activeTextEditor) ===
+                documentUri
+            ) {
                 return editor.setDecorations(
                     typeHintDecorationType,
                     newDecorations