|
| 1 | +///<reference path="fourslash.ts" /> |
| 2 | + |
| 3 | +// Testing that quickInfo gets information with a corresponding meaning: values to values, types to types. |
| 4 | +// For quick info purposes, we don't resolve past aliases. |
| 5 | +// However, when we have an alias for a type, the quickInfo for a value with the same should skip the alias, and vice versa. |
| 6 | +// goToDefinition should work the same way. |
| 7 | + |
| 8 | +// @Filename: foo.d.ts |
| 9 | +////declare const /*foo_value_declaration*/foo: number; |
| 10 | +////declare module "foo_module" { |
| 11 | +//// interface I { x: number; y: number } |
| 12 | +//// export = I; |
| 13 | +////} |
| 14 | + |
| 15 | +// @Filename: foo_user.ts |
| 16 | +///////<reference path="foo.d.ts" /> |
| 17 | +/////*foo_type_declaration*/import foo = require("foo_module"); |
| 18 | +////const x = foo/*foo_value*/; |
| 19 | +////const i: foo/*foo_type*/ = { x: 1, y: 2 }; |
| 20 | + |
| 21 | +verify.numberOfErrorsInCurrentFile(0); |
| 22 | + |
| 23 | +verify.navigationItemsListCount(2, "foo", "exact"); |
| 24 | +verify.navigationItemsListContains("foo", "alias", "foo", "exact"); |
| 25 | +verify.navigationItemsListContains("foo", "const", "foo", "exact"); |
| 26 | + |
| 27 | +goTo.marker("foo_value"); |
| 28 | +verify.quickInfoIs("const foo: number"); |
| 29 | +goTo.definition(); |
| 30 | +verify.caretAtMarker("foo_value_declaration"); |
| 31 | + |
| 32 | +goTo.marker("foo_type"); |
| 33 | +verify.quickInfoIs("import foo = require(\"foo_module\")"); |
| 34 | +goTo.definition(); |
| 35 | +verify.caretAtMarker("foo_type_declaration"); |
| 36 | + |
| 37 | + |
| 38 | +// Above tested for global const and imported interface. Now test with global interface and imported const. |
| 39 | + |
| 40 | + |
| 41 | +// @Filename: bar.d.ts |
| 42 | +/////*bar_type_declaration*/declare interface bar { x: number; y: number } |
| 43 | +////declare module "bar_module" { |
| 44 | +//// const x: number; |
| 45 | +//// export = x; |
| 46 | +////} |
| 47 | + |
| 48 | +// @Filename: bar_user.ts |
| 49 | +///////<reference path="bar.d.ts" /> |
| 50 | +/////*bar_value_declaration*/import bar = require("bar_module"); |
| 51 | +////const x = bar/*bar_value*/; |
| 52 | +////const i: bar/*bar_type*/ = { x: 1, y: 2 }; |
| 53 | + |
| 54 | +verify.numberOfErrorsInCurrentFile(0); |
| 55 | +verify.navigationItemsListCount(2, "bar", "exact"); |
| 56 | +verify.navigationItemsListContains("bar", "alias", "bar", "exact"); |
| 57 | +verify.navigationItemsListContains("bar", "interface", "bar", "exact"); |
| 58 | + |
| 59 | +goTo.marker("bar_value"); |
| 60 | +verify.quickInfoIs("import bar = require(\"bar_module\")"); |
| 61 | +goTo.definition(); |
| 62 | +verify.caretAtMarker("bar_value_declaration"); |
| 63 | + |
| 64 | +goTo.marker("bar_type"); |
| 65 | +verify.quickInfoIs("interface bar"); |
| 66 | +goTo.definition(); |
| 67 | +verify.caretAtMarker("bar_type_declaration"); |
0 commit comments