vendor tsgo
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
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/ls"
|
||||
"github.com/microsoft/typescript-go/internal/lsp/lsproto"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportCssModule(t *testing.T) {
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `
|
||||
// @Filename: /tsconfig.json
|
||||
{ "compilerOptions": { "module": "nodenext", "moduleResolution": "nodenext" } }
|
||||
|
||||
// @Filename: /package.json
|
||||
{ "type": "module" }
|
||||
|
||||
// @Filename: /augmentations.ts
|
||||
export {};
|
||||
declare module "./styles.css" {
|
||||
export const myClass: string;
|
||||
}
|
||||
|
||||
// @Filename: /index.ts
|
||||
myClass/**/
|
||||
`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
// Verify auto-import completions don't panic when importing from .css module augmentation
|
||||
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
|
||||
IsIncomplete: false,
|
||||
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
||||
CommitCharacters: &DefaultCommitCharacters,
|
||||
EditRange: Ignored,
|
||||
},
|
||||
Items: &fourslash.CompletionsExpectedItems{
|
||||
Includes: []fourslash.CompletionsExpectedItem{
|
||||
&lsproto.CompletionItem{
|
||||
Label: "myClass",
|
||||
Data: &lsproto.CompletionItemData{
|
||||
AutoImport: &lsproto.AutoImportFix{
|
||||
ModuleSpecifier: "./styles.css",
|
||||
},
|
||||
},
|
||||
AdditionalTextEdits: fourslash.AnyTextEdits,
|
||||
SortText: new(string(ls.SortTextAutoImportSuggestions)),
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user