86 lines
2.4 KiB
Go
86 lines
2.4 KiB
Go
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 TestPathCompletionsPackageJsonImportsSrcNoDistWildcard5(t *testing.T) {
|
|
t.Parallel()
|
|
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
|
const content = `// @Filename: /home/src/workspaces/project/tsconfig.json
|
|
{
|
|
"compilerOptions": {
|
|
"module": "nodenext",
|
|
"rootDir": "src",
|
|
"outDir": "dist/esm",
|
|
"declarationDir": "dist/types"
|
|
}
|
|
}
|
|
// @Filename: /home/src/workspaces/project/package.json
|
|
{
|
|
"name": "foo",
|
|
"main": "dist/index.js",
|
|
"module": "dist/index.mjs",
|
|
"types": "dist/index.d.ts",
|
|
"imports": {
|
|
"#*": {
|
|
"import": {
|
|
"types": "./dist/types/*.d.mts",
|
|
"default": "./dist/esm/*.mjs"
|
|
},
|
|
"default": {
|
|
"types": "./dist/types/*.d.ts",
|
|
"default": "./dist/cjs/*.js"
|
|
}
|
|
},
|
|
"#only-in-cjs": {
|
|
"require": {
|
|
"types": "./dist/types/only-in-cjs/index.d.ts",
|
|
"default": "./dist/cjs/only-in-cjs/index.js"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// @Filename: /home/src/workspaces/project/src/index.mts
|
|
export const index = 0;
|
|
// @Filename: /home/src/workspaces/project/src/index.ts
|
|
export const index = 0;
|
|
// @Filename: /home/src/workspaces/project/src/blah.mts
|
|
export const blah = 0;
|
|
// @Filename: /home/src/workspaces/project/src/blah.ts
|
|
export const blah = 0;
|
|
// @Filename: /home/src/workspaces/project/src/only-in-cjs/index.ts
|
|
export const onlyInCjs = 0;
|
|
// @Filename: /home/src/workspaces/project/src/index.mts
|
|
import { } from "/**/";`
|
|
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
|
defer done()
|
|
f.MarkTestAsStradaServer()
|
|
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
|
|
IsIncomplete: false,
|
|
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
|
CommitCharacters: &[]string{},
|
|
EditRange: Ignored,
|
|
},
|
|
Items: &fourslash.CompletionsExpectedItems{
|
|
Exact: []fourslash.CompletionsExpectedItem{
|
|
&lsproto.CompletionItem{
|
|
Label: "#blah",
|
|
Kind: new(lsproto.CompletionItemKindFile),
|
|
Detail: new("#blah.mts"),
|
|
},
|
|
&lsproto.CompletionItem{
|
|
Label: "#index",
|
|
Kind: new(lsproto.CompletionItemKindFile),
|
|
Detail: new("#index.mts"),
|
|
},
|
|
},
|
|
},
|
|
})
|
|
}
|