|
| 1 | +/// <reference path="fourslash.ts" /> |
| 2 | + |
| 3 | +// @module: esnext |
| 4 | +// @moduleResolution: node |
| 5 | + |
| 6 | +// @Filename: /node_modules/vue/package.json |
| 7 | +//// { |
| 8 | +//// "name": "vue", |
| 9 | +//// "types": "dist/vue.d.ts" |
| 10 | +//// } |
| 11 | + |
| 12 | +// @Filename: /node_modules/vue/dist/vue.d.ts |
| 13 | +//// export * from "@vue/runtime-dom" |
| 14 | + |
| 15 | +// @Filename: /node_modules/@vue/runtime-dom/package.json |
| 16 | +//// { |
| 17 | +//// "name": "@vue/runtime-dom", |
| 18 | +//// "types": "dist/runtime-dom.d.ts" |
| 19 | +//// } |
| 20 | + |
| 21 | +// @Filename: /node_modules/@vue/runtime-dom/dist/runtime-dom.d.ts |
| 22 | +//// export * from "@vue/runtime-core"; |
| 23 | +//// export {} |
| 24 | +//// declare module '@vue/reactivity' { |
| 25 | +//// export interface RefUnwrapBailTypes { |
| 26 | +//// runtimeDOMBailTypes: any |
| 27 | +//// } |
| 28 | +//// } |
| 29 | + |
| 30 | +// @Filename: /node_modules/@vue/runtime-core/package.json |
| 31 | +//// { |
| 32 | +//// "name": "@vue/runtime-core", |
| 33 | +//// "types": "dist/runtime-core.d.ts" |
| 34 | +//// } |
| 35 | + |
| 36 | +// @Filename: /node_modules/@vue/runtime-core/dist/runtime-core.d.ts |
| 37 | +//// import { ref } from '@vue/reactivity'; |
| 38 | +//// export { ref }; |
| 39 | +//// declare module '@vue/reactivity' { |
| 40 | +//// export interface RefUnwrapBailTypes { |
| 41 | +//// runtimeCoreBailTypes: any |
| 42 | +//// } |
| 43 | +//// } |
| 44 | + |
| 45 | +// @Filename: /node_modules/@vue/reactivity/package.json |
| 46 | +//// { |
| 47 | +//// "name": "@vue/reactivity", |
| 48 | +//// "types": "dist/reactivity.d.ts" |
| 49 | +//// } |
| 50 | + |
| 51 | +// @Filename: /node_modules/@vue/reactivity/dist/reactivity.d.ts |
| 52 | +//// export declare function ref<T = any>(): T; |
| 53 | + |
| 54 | +// @Filename: /package.json |
| 55 | +//// { |
| 56 | +//// "dependencies": { |
| 57 | +//// "vue": "*" |
| 58 | +//// } |
| 59 | +//// } |
| 60 | + |
| 61 | +// @Filename: /index.ts |
| 62 | +//// import {} from "vue"; |
| 63 | +//// ref/**/ |
| 64 | + |
| 65 | +verify.completions({ |
| 66 | + marker: "", |
| 67 | + includes: [{ |
| 68 | + name: "ref", |
| 69 | + source: "vue", |
| 70 | + sourceDisplay: "vue", |
| 71 | + hasAction: true, |
| 72 | + sortText: completion.SortText.AutoImportSuggestions, |
| 73 | + }], |
| 74 | + preferences: { |
| 75 | + includeCompletionsForModuleExports: true, |
| 76 | + allowIncompleteCompletions: true, |
| 77 | + }, |
| 78 | +}); |
| 79 | + |
| 80 | +verify.applyCodeActionFromCompletion("", { |
| 81 | + name: "ref", |
| 82 | + source: "vue", |
| 83 | + description: `Add 'ref' to existing import declaration from "vue"`, |
| 84 | + data: { |
| 85 | + exportName: "ref", |
| 86 | + fileName: "/node_modules/vue/dist/vue.d.ts", |
| 87 | + }, |
| 88 | + preferences: { |
| 89 | + includeCompletionsForModuleExports: true, |
| 90 | + allowIncompleteCompletions: true, |
| 91 | + }, |
| 92 | + newFileContent: `import { ref } from "vue";\nref` |
| 93 | +}); |
0 commit comments