94 lines
2.7 KiB
Go
94 lines
2.7 KiB
Go
// Code generated by convertFourslash; DO NOT EDIT.
|
|
// To modify this test, run "npm run makemanual completionEntryForUnionProperty2"
|
|
|
|
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 TestCompletionEntryForUnionProperty2(t *testing.T) {
|
|
fourslash.SkipIfFailing(t)
|
|
t.Parallel()
|
|
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
|
const content = `// @lib: es5
|
|
interface One {
|
|
commonProperty: string;
|
|
commonFunction(): number;
|
|
anotherProperty: Record<string, number>;
|
|
}
|
|
|
|
interface Two {
|
|
commonProperty: number;
|
|
commonFunction(): number;
|
|
anotherProperty: { foo: number }
|
|
}
|
|
|
|
var x : One | Two;
|
|
|
|
x.commonProperty./*1*/;
|
|
x.anotherProperty./*2*/;`
|
|
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
|
defer done()
|
|
f.VerifyCompletions(t, "1", &fourslash.CompletionsExpectedList{
|
|
IsIncomplete: false,
|
|
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
|
CommitCharacters: &DefaultCommitCharacters,
|
|
EditRange: Ignored,
|
|
},
|
|
Items: &fourslash.CompletionsExpectedItems{
|
|
Exact: []fourslash.CompletionsExpectedItem{
|
|
&lsproto.CompletionItem{
|
|
Label: "toLocaleString",
|
|
Detail: new("(method) toLocaleString(): string (+1 overload)"),
|
|
Documentation: &lsproto.StringOrMarkupContent{
|
|
MarkupContent: &lsproto.MarkupContent{
|
|
Kind: lsproto.MarkupKindMarkdown,
|
|
Value: "Returns a date converted to a string using the current locale.",
|
|
},
|
|
},
|
|
},
|
|
&lsproto.CompletionItem{
|
|
Label: "toString",
|
|
Detail: new("(method) toString(): string (+1 overload)"),
|
|
Documentation: &lsproto.StringOrMarkupContent{
|
|
MarkupContent: &lsproto.MarkupContent{
|
|
Kind: lsproto.MarkupKindMarkdown,
|
|
Value: "Returns a string representation of a string.",
|
|
},
|
|
},
|
|
},
|
|
&lsproto.CompletionItem{
|
|
Label: "valueOf",
|
|
Detail: new("(method) valueOf(): string | number"),
|
|
Documentation: &lsproto.StringOrMarkupContent{
|
|
MarkupContent: &lsproto.MarkupContent{
|
|
Kind: lsproto.MarkupKindMarkdown,
|
|
Value: "Returns the primitive value of the specified object.",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
})
|
|
f.VerifyCompletions(t, "2", &fourslash.CompletionsExpectedList{
|
|
IsIncomplete: false,
|
|
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
|
CommitCharacters: &DefaultCommitCharacters,
|
|
EditRange: Ignored,
|
|
},
|
|
Items: &fourslash.CompletionsExpectedItems{
|
|
Includes: []fourslash.CompletionsExpectedItem{
|
|
&lsproto.CompletionItem{
|
|
Label: "foo",
|
|
},
|
|
},
|
|
},
|
|
})
|
|
}
|