|
| 1 | +/// <reference path="fourslash.ts" /> |
| 2 | + |
| 3 | +// @strict: true |
| 4 | +// @module: commonjs |
| 5 | + |
| 6 | +// @filename: /node_modules/@types/vscode/index.d.ts |
| 7 | +//// declare module "vscode" { |
| 8 | +//// export class Position { |
| 9 | +//// readonly line: number; |
| 10 | +//// readonly character: number; |
| 11 | +//// } |
| 12 | +//// } |
| 13 | + |
| 14 | +// @filename: src/motion.ts |
| 15 | +//// import { Position } from "vscode"; |
| 16 | +//// |
| 17 | +//// export abstract class MoveQuoteMatch { |
| 18 | +//// public override async execActionWithCount( |
| 19 | +//// position: Position, |
| 20 | +//// ): Promise<void> {} |
| 21 | +//// } |
| 22 | +//// |
| 23 | +//// declare module "vscode" { |
| 24 | +//// interface Position { |
| 25 | +//// toString(): string; |
| 26 | +//// } |
| 27 | +//// } |
| 28 | + |
| 29 | +// @filename: src/smartQuotes.ts |
| 30 | +//// import { MoveQuoteMatch } from "./motion"; |
| 31 | +//// |
| 32 | +//// export class MoveInsideNextQuote extends MoveQuoteMatch {/*1*/ |
| 33 | +//// keys = ["i", "n", "q"]; |
| 34 | +//// } |
| 35 | + |
| 36 | +const preferences = { |
| 37 | + includeCompletionsWithInsertText: true, |
| 38 | + includeCompletionsWithClassMemberSnippets: true, |
| 39 | +}; |
| 40 | + |
| 41 | +verify.completions({ |
| 42 | + marker: "1", |
| 43 | + includes: [ |
| 44 | + { |
| 45 | + name: "execActionWithCount", |
| 46 | + insertText: "public execActionWithCount(position: Position): Promise<void> {\n}", |
| 47 | + filterText: "execActionWithCount", |
| 48 | + hasAction: true, |
| 49 | + source: "ClassMemberSnippet/", |
| 50 | + }, |
| 51 | + ], |
| 52 | + preferences, |
| 53 | + isNewIdentifierLocation: true, |
| 54 | +}); |
| 55 | + |
| 56 | +verify.applyCodeActionFromCompletion("1", { |
| 57 | + name: "execActionWithCount", |
| 58 | + source: "ClassMemberSnippet/", |
| 59 | + description: `Includes imports of types referenced by 'execActionWithCount'`, |
| 60 | + newFileContent: `import { Position } from "vscode"; |
| 61 | +import { MoveQuoteMatch } from "./motion"; |
| 62 | +
|
| 63 | +export class MoveInsideNextQuote extends MoveQuoteMatch { |
| 64 | + keys = ["i", "n", "q"]; |
| 65 | +}`, |
| 66 | + preferences, |
| 67 | +}); |
0 commit comments