82 lines
2.5 KiB
Go
82 lines
2.5 KiB
Go
// Code generated by convertFourslash; DO NOT EDIT.
|
|
// To modify this test, run "npm run makemanual autoImportCompletionAmbientMergedModule1"
|
|
|
|
package fourslash_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/microsoft/typescript-go/internal/fourslash"
|
|
. "github.com/microsoft/typescript-go/internal/fourslash/tests/util"
|
|
"github.com/microsoft/typescript-go/internal/lsp/lsproto"
|
|
"github.com/microsoft/typescript-go/internal/testutil"
|
|
)
|
|
|
|
func TestAutoImportCompletionAmbientMergedModule1(t *testing.T) {
|
|
fourslash.SkipIfFailing(t)
|
|
t.Parallel()
|
|
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
|
const content = `// @strict: true
|
|
// @module: commonjs
|
|
// @filename: /node_modules/@types/vscode/index.d.ts
|
|
declare module "vscode" {
|
|
export class Position {
|
|
readonly line: number;
|
|
readonly character: number;
|
|
}
|
|
}
|
|
// @filename: src/motion.ts
|
|
import { Position } from "vscode";
|
|
|
|
export abstract class MoveQuoteMatch {
|
|
public override async execActionWithCount(
|
|
position: Position,
|
|
): Promise<void> {}
|
|
}
|
|
|
|
declare module "vscode" {
|
|
interface Position {
|
|
toString(): string;
|
|
}
|
|
}
|
|
// @filename: src/smartQuotes.ts
|
|
import { MoveQuoteMatch } from "./motion";
|
|
|
|
export class MoveInsideNextQuote extends MoveQuoteMatch {/*1*/
|
|
keys = ["i", "n", "q"];
|
|
}`
|
|
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
|
defer done()
|
|
f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{
|
|
IsIncomplete: false,
|
|
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
|
CommitCharacters: &[]string{},
|
|
EditRange: Ignored,
|
|
},
|
|
Items: &fourslash.CompletionsExpectedItems{
|
|
Includes: []fourslash.CompletionsExpectedItem{
|
|
&lsproto.CompletionItem{
|
|
Label: "execActionWithCount",
|
|
InsertText: new("public execActionWithCount(position: Position): Promise<void> {\n}"),
|
|
FilterText: new("execActionWithCount"),
|
|
AdditionalTextEdits: fourslash.AnyTextEdits,
|
|
Data: &lsproto.CompletionItemData{
|
|
Source: "ClassMemberSnippet/",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
})
|
|
f.VerifyApplyCodeActionFromCompletion(t, new("1"), &fourslash.ApplyCodeActionFromCompletionOptions{
|
|
Name: "execActionWithCount",
|
|
Source: "ClassMemberSnippet/",
|
|
Description: "Includes imports of types referenced by 'execActionWithCount'",
|
|
NewFileContent: new(`import { Position } from "vscode";
|
|
import { MoveQuoteMatch } from "./motion";
|
|
|
|
export class MoveInsideNextQuote extends MoveQuoteMatch {
|
|
keys = ["i", "n", "q"];
|
|
}`),
|
|
})
|
|
}
|