vendor tsgo
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual addAllMissingImportsNoCrash"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAddAllMissingImportsNoCrash(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: file1.ts
|
||||
export interface Test1 {}
|
||||
export interface Test2 {}
|
||||
export interface Test3 {}
|
||||
export interface Test4 {}
|
||||
// @Filename: file2.ts
|
||||
import { Test1, Test4 } from './file1';
|
||||
interface Testing {
|
||||
test1: Test1;
|
||||
test2: Test2;
|
||||
test3: Test3;
|
||||
test4: Test4;
|
||||
}`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.GoToFile(t, "file2.ts")
|
||||
f.VerifyCodeFixAll(t, fourslash.VerifyCodeFixAllOptions{
|
||||
FixID: "fixMissingImport",
|
||||
NewFileContent: `import { Test1, Test2, Test3, Test4 } from './file1';
|
||||
interface Testing {
|
||||
test1: Test1;
|
||||
test2: Test2;
|
||||
test3: Test3;
|
||||
test4: Test4;
|
||||
}`,
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual addDeclareToFunction"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAddDeclareToFunction(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `/*1*/function parseInt(s/*2*/:string):number;`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.GoToMarker(t, "2")
|
||||
f.DeleteAtCaret(t, 7)
|
||||
f.GoToMarker(t, "1")
|
||||
f.Insert(t, "declare ")
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual addDeclareToModule"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAddDeclareToModule(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `/**/namespace mAmbient {
|
||||
namespace m3 { }
|
||||
}`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.GoToMarker(t, "")
|
||||
f.Insert(t, "declare ")
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual addDuplicateSetter"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAddDuplicateSetter(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `class C {
|
||||
set foo(value) { }
|
||||
/**/
|
||||
}`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.GoToMarker(t, "")
|
||||
f.Insert(t, "set foo(value) { }")
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual addFunctionAboveMultiLineLambdaExpression"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAddFunctionAboveMultiLineLambdaExpression(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `/**/
|
||||
() =>
|
||||
// do something
|
||||
0;`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.GoToMarker(t, "")
|
||||
f.Insert(t, "function Foo() { }")
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual addFunctionInDuplicatedConstructorClassBody"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAddFunctionInDuplicatedConstructorClassBody(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `class Foo {
|
||||
constructor() { }
|
||||
constructor() { }
|
||||
/**/
|
||||
}`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.GoToMarker(t, "")
|
||||
f.Insert(t, "fn() { }")
|
||||
f.VerifyNumberOfErrorsInCurrentFile(t, 2)
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual addInterfaceMemberAboveClass"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAddInterfaceMemberAboveClass(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `
|
||||
interface Intersection {
|
||||
/*insertHere*/
|
||||
}
|
||||
interface Scene { }
|
||||
class /*className*/Sphere {
|
||||
constructor() {
|
||||
}
|
||||
}`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyQuickInfoAt(t, "className", "class Sphere", "")
|
||||
f.GoToMarker(t, "insertHere")
|
||||
f.Insert(t, "ray: Ray;")
|
||||
f.VerifyQuickInfoAt(t, "className", "class Sphere", "")
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual addInterfaceToNotSatisfyConstraint"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAddInterfaceToNotSatisfyConstraint(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `interface A {
|
||||
a: number;
|
||||
}
|
||||
/**/
|
||||
interface C<T extends A> {
|
||||
x: T;
|
||||
}
|
||||
|
||||
var v2: C<B>; // should not work`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.GoToMarker(t, "")
|
||||
f.Insert(t, "interface B { b: string; }")
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual addMemberNotInNodeModulesDeclarationFile"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAddMemberNotInNodeModulesDeclarationFile(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @noImplicitReferences: true
|
||||
// @traceResolution: true
|
||||
// @Filename: /node_modules/foo/types.d.ts
|
||||
interface Response {}
|
||||
// @Filename: /node_modules/foo/package.json
|
||||
{ "types": "types.d.ts" }
|
||||
// @Filename: /foo.ts
|
||||
import { Response } from 'foo'
|
||||
declare const resp: Response
|
||||
resp.test()`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.GoToFile(t, "/foo.ts")
|
||||
f.VerifyCodeFixNotAvailable(t)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual addMemberToModule"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAddMemberToModule(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `namespace A {
|
||||
/*var*/
|
||||
}
|
||||
module /*check*/A {
|
||||
var p;
|
||||
}`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.GoToMarker(t, "check")
|
||||
f.VerifyQuickInfoExists(t)
|
||||
f.GoToMarker(t, "var")
|
||||
f.Insert(t, "var o;")
|
||||
f.GoToMarker(t, "check")
|
||||
f.VerifyQuickInfoExists(t)
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual addSignaturePartial"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAddSignaturePartial(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = ``
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.Insert(t, "interface Number { toFixed")
|
||||
f.Insert(t, "(")
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual aliasMergingWithNamespace"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAliasMergingWithNamespace(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `namespace bar { }
|
||||
import bar = bar/**/;`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyQuickInfoAt(t, "", "namespace bar\nimport bar = bar", "")
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual aliasToVarUsedAsType"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAliasToVarUsedAsType(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `/**/
|
||||
namespace A {
|
||||
export var X;
|
||||
import Z = A.X;
|
||||
var v: Z;
|
||||
}`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.GoToMarker(t, "")
|
||||
f.Insert(t, " ")
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual allowLateBoundSymbolsOverwriteEarlyBoundSymbols"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAllowLateBoundSymbolsOverwriteEarlyBoundSymbols(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `export {};
|
||||
const prop = "abc";
|
||||
function foo(): void {};
|
||||
foo.abc = 10;
|
||||
foo[prop] = 10;
|
||||
interface T0 {
|
||||
[prop]: number;
|
||||
abc: number;
|
||||
}`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyNoErrors(t)
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual ambientShorthandFindAllRefs"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAmbientShorthandFindAllRefs(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: declarations.d.ts
|
||||
declare module "jquery";
|
||||
// @Filename: user.ts
|
||||
import {/*1*/x} from "jquery";
|
||||
// @Filename: user2.ts
|
||||
import {/*2*/x} from "jquery";`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyBaselineFindAllReferences(t, "1", "2")
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual ambientShorthandGotoDefinition"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAmbientShorthandGotoDefinition(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: declarations.d.ts
|
||||
declare module /*module*/"jquery"
|
||||
// @Filename: user.ts
|
||||
///<reference path="declarations.d.ts"/>
|
||||
import [|/*importFoo*/foo|], {bar} from "jquery";
|
||||
import * as [|/*importBaz*/baz|] from "jquery";
|
||||
import [|/*importBang*/bang|] = require("jquery");
|
||||
[|foo/*useFoo*/|]([|bar/*useBar*/|], [|baz/*useBaz*/|], [|bang/*useBang*/|]);`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyQuickInfoAt(t, "useFoo", "(alias) module \"jquery\"\nimport foo", "")
|
||||
f.VerifyQuickInfoAt(t, "useBar", "(alias) module \"jquery\"\nimport bar", "")
|
||||
f.VerifyQuickInfoAt(t, "useBaz", "(alias) module \"jquery\"\nimport baz", "")
|
||||
f.VerifyQuickInfoAt(t, "useBang", "(alias) module \"jquery\"\nimport bang = require(\"jquery\")", "")
|
||||
f.VerifyBaselineGoToDefinition(t, true, "useFoo", "importFoo", "useBar", "useBaz", "importBaz", "useBang", "importBang")
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual ambientVariablesWithSameName"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAmbientVariablesWithSameName(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `declare namespace M {
|
||||
export var x: string;
|
||||
}
|
||||
declare var x: number;`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.GoToEOF(t)
|
||||
f.InsertLine(t, "")
|
||||
f.VerifyNoErrors(t)
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual annotateWithTypeFromJSDoc2"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAnnotateWithTypeFromJSDoc2(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: test123.ts
|
||||
/** @type {number} */
|
||||
var [|x|]: string;`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifySuggestionDiagnostics(t, nil)
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual argumentsAreAvailableAfterEditsAtEndOfFunction"
|
||||
|
||||
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 TestArgumentsAreAvailableAfterEditsAtEndOfFunction(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `namespace Test1 {
|
||||
class Person {
|
||||
children: string[];
|
||||
constructor(public name: string, children: string[]) {
|
||||
/**/
|
||||
}
|
||||
}
|
||||
}`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.GoToMarker(t, "")
|
||||
f.Insert(t, "this.children = ch")
|
||||
f.VerifyCompletions(t, nil, &fourslash.CompletionsExpectedList{
|
||||
IsIncomplete: false,
|
||||
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
||||
CommitCharacters: &[]string{},
|
||||
EditRange: Ignored,
|
||||
},
|
||||
Items: &fourslash.CompletionsExpectedItems{
|
||||
Includes: []fourslash.CompletionsExpectedItem{
|
||||
&lsproto.CompletionItem{
|
||||
Label: "children",
|
||||
Detail: new("(parameter) children: string[]"),
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual argumentsIndexExpression"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestArgumentsIndexExpression(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `function f() {
|
||||
var x = /**/arguments[0];
|
||||
}`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.GoToMarker(t, "")
|
||||
f.VerifyQuickInfoExists(t)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual arityErrorAfterSignatureHelp"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestArityErrorAfterSignatureHelp(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @strict: true
|
||||
|
||||
declare function f(x: string, y: number): any;
|
||||
|
||||
/*1*/f/*2*/(/*3*/)`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.GoToMarker(t, "3")
|
||||
f.VerifySignatureHelp(t, fourslash.VerifySignatureHelpOptions{})
|
||||
f.Insert(t, "\"")
|
||||
f.Insert(t, "\"")
|
||||
f.VerifySignatureHelp(t, fourslash.VerifySignatureHelpOptions{})
|
||||
f.VerifyCodeFixNotAvailable(t)
|
||||
f.VerifyErrorExistsBetweenMarkers(t, "1", "2")
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual arityErrorAfterStringCompletions"
|
||||
|
||||
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/testutil"
|
||||
)
|
||||
|
||||
func TestArityErrorAfterStringCompletions(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @strict: true
|
||||
|
||||
interface Events {
|
||||
click: any;
|
||||
drag: any;
|
||||
}
|
||||
|
||||
declare function addListener<K extends keyof Events>(type: K, listener: (ev: Events[K]) => any): void;
|
||||
|
||||
/*1*/addListener/*2*/("/*3*/")`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyCompletions(t, []string{"3"}, &fourslash.CompletionsExpectedList{
|
||||
IsIncomplete: false,
|
||||
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
||||
CommitCharacters: &DefaultCommitCharacters,
|
||||
EditRange: Ignored,
|
||||
},
|
||||
Items: &fourslash.CompletionsExpectedItems{
|
||||
Exact: []fourslash.CompletionsExpectedItem{
|
||||
"click",
|
||||
"drag",
|
||||
},
|
||||
},
|
||||
})
|
||||
f.VerifyErrorExistsBetweenMarkers(t, "1", "2")
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual arrayCallAndConstructTypings"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestArrayCallAndConstructTypings(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `var a/*1*/1 = new Array();
|
||||
var a/*2*/2 = new Array(1);
|
||||
var a/*3*/3 = new Array<boolean>();
|
||||
var a/*4*/4 = new Array<boolean>(1);
|
||||
var a/*5*/5 = new Array("s");
|
||||
var a/*6*/6 = Array();
|
||||
var a/*7*/7 = Array(1);
|
||||
var a/*8*/8 = Array<boolean>();
|
||||
var a/*9*/9 = Array<boolean>(1);
|
||||
var a/*10*/10 = Array("s");`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyQuickInfoAt(t, "1", "var a1: any[]", "")
|
||||
f.VerifyQuickInfoAt(t, "2", "var a2: any[]", "")
|
||||
f.VerifyQuickInfoAt(t, "3", "var a3: boolean[]", "")
|
||||
f.VerifyQuickInfoAt(t, "4", "var a4: boolean[]", "")
|
||||
f.VerifyQuickInfoAt(t, "5", "var a5: string[]", "")
|
||||
f.VerifyQuickInfoAt(t, "6", "var a6: any[]", "")
|
||||
f.VerifyQuickInfoAt(t, "7", "var a7: any[]", "")
|
||||
f.VerifyQuickInfoAt(t, "8", "var a8: boolean[]", "")
|
||||
f.VerifyQuickInfoAt(t, "9", "var a9: boolean[]", "")
|
||||
f.VerifyQuickInfoAt(t, "10", "var a10: string[]", "")
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual asConstRefsNoErrors1"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAsConstRefsNoErrors1(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `class Tex {
|
||||
type = 'Text' as /**/const;
|
||||
}`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyBaselineGoToDefinition(t, true, "")
|
||||
f.VerifyNoErrors(t)
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual asConstRefsNoErrors2"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAsConstRefsNoErrors2(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `class Tex {
|
||||
type = </**/const>'Text';
|
||||
}`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyBaselineGoToDefinition(t, true, "")
|
||||
f.VerifyNoErrors(t)
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual asConstRefsNoErrors3"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAsConstRefsNoErrors3(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @checkJs: true
|
||||
// @Filename: file.js
|
||||
class Tex {
|
||||
type = (/** @type {/**/const} */'Text');
|
||||
}`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyBaselineGoToDefinition(t, true, "")
|
||||
f.VerifyNoErrors(t)
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual asOperatorCompletion2"
|
||||
|
||||
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/testutil"
|
||||
)
|
||||
|
||||
func TestAsOperatorCompletion2(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `type T = number;
|
||||
var x;
|
||||
var y = x as /**/
|
||||
`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
|
||||
IsIncomplete: false,
|
||||
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
||||
CommitCharacters: &DefaultCommitCharacters,
|
||||
EditRange: Ignored,
|
||||
},
|
||||
Items: &fourslash.CompletionsExpectedItems{
|
||||
Includes: []fourslash.CompletionsExpectedItem{
|
||||
"T",
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual asOperatorCompletion3"
|
||||
|
||||
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/testutil"
|
||||
)
|
||||
|
||||
func TestAsOperatorCompletion3(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `type T = number;
|
||||
var x;
|
||||
var y = x as /**/ // comment`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
|
||||
IsIncomplete: false,
|
||||
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
||||
CommitCharacters: &DefaultCommitCharacters,
|
||||
EditRange: Ignored,
|
||||
},
|
||||
Items: &fourslash.CompletionsExpectedItems{
|
||||
Includes: []fourslash.CompletionsExpectedItem{
|
||||
"T",
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual asOperatorCompletion"
|
||||
|
||||
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/testutil"
|
||||
)
|
||||
|
||||
func TestAsOperatorCompletion(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `type T = number;
|
||||
var x;
|
||||
var y = x as /**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
|
||||
IsIncomplete: false,
|
||||
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
||||
CommitCharacters: &DefaultCommitCharacters,
|
||||
EditRange: Ignored,
|
||||
},
|
||||
Items: &fourslash.CompletionsExpectedItems{
|
||||
Includes: []fourslash.CompletionsExpectedItem{
|
||||
"T",
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual asOperatorFormatting"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAsOperatorFormatting(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `/**/var x = 3 as number;`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.GoToMarker(t, "")
|
||||
f.FormatDocument(t, "")
|
||||
f.VerifyCurrentLineContent(t, `var x = 3 as number;`)
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual assertContextualType"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAssertContextualType(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `<(aa: number) =>void >(function myFn(b/**/b) { });`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyQuickInfoAt(t, "", "(parameter) bb: number", "")
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual augmentedTypesClass1"
|
||||
|
||||
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 TestAugmentedTypesClass1(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `class c5b { public foo() { } }
|
||||
namespace c5b { export var y = 2; } // should be ok
|
||||
c5b./*1*/
|
||||
var r = new c5b();
|
||||
r./*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{
|
||||
Includes: []fourslash.CompletionsExpectedItem{
|
||||
&lsproto.CompletionItem{
|
||||
Label: "prototype",
|
||||
Detail: new("(property) c5b.prototype: c5b"),
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
f.Insert(t, "y;")
|
||||
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",
|
||||
Detail: new("(method) c5b.foo(): void"),
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual augmentedTypesClass3Fourslash"
|
||||
|
||||
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 TestAugmentedTypesClass3Fourslash(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `class c/*1*/5b { public foo() { } }
|
||||
namespace c/*2*/5b { export var y = 2; } // should be ok
|
||||
/*3*/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyQuickInfoAt(t, "1", "class c5b\nnamespace c5b", "")
|
||||
f.VerifyQuickInfoAt(t, "2", "class c5b\nnamespace c5b", "")
|
||||
f.VerifyCompletions(t, "3", &fourslash.CompletionsExpectedList{
|
||||
IsIncomplete: false,
|
||||
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
||||
CommitCharacters: &DefaultCommitCharacters,
|
||||
EditRange: Ignored,
|
||||
},
|
||||
Items: &fourslash.CompletionsExpectedItems{
|
||||
Includes: []fourslash.CompletionsExpectedItem{
|
||||
&lsproto.CompletionItem{
|
||||
Label: "c5b",
|
||||
Detail: new("class c5b\nnamespace c5b"),
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual augmentedTypesModule1"
|
||||
|
||||
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/testutil"
|
||||
)
|
||||
|
||||
func TestAugmentedTypesModule1(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `namespace m1c {
|
||||
export interface I { foo(): void; }
|
||||
}
|
||||
var m1c = 1; // Should be allowed
|
||||
var x: m1c./*1*/;
|
||||
var /*2*/r = m1c;`
|
||||
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{
|
||||
"I",
|
||||
},
|
||||
},
|
||||
})
|
||||
f.VerifyQuickInfoAt(t, "2", "var r: number", "")
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual augmentedTypesModule3"
|
||||
|
||||
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/testutil"
|
||||
)
|
||||
|
||||
func TestAugmentedTypesModule3(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `function m2g() { };
|
||||
namespace m2g { export class C { foo(x: number) { } } }
|
||||
var x: m2g./*1*/;
|
||||
var /*2*/r = m2g/*3*/;`
|
||||
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{
|
||||
"C",
|
||||
},
|
||||
},
|
||||
})
|
||||
f.Insert(t, "C.")
|
||||
f.VerifyCompletions(t, nil, nil)
|
||||
f.Backspace(t, 1)
|
||||
f.VerifyQuickInfoAt(t, "2", "var r: typeof m2g", "")
|
||||
f.GoToMarker(t, "3")
|
||||
f.Insert(t, "(")
|
||||
f.VerifySignatureHelp(t, fourslash.VerifySignatureHelpOptions{Text: "m2g(): void"})
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual augmentedTypesModule4"
|
||||
|
||||
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/testutil"
|
||||
)
|
||||
|
||||
func TestAugmentedTypesModule4(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `namespace m3d { export var y = 2; }
|
||||
declare class m3d { foo(): void }
|
||||
var /*1*/r = new m3d();
|
||||
r./*2*/
|
||||
var /*4*/r2 = m3d./*3*/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyQuickInfoAt(t, "1", "var r: m3d", "")
|
||||
f.VerifyCompletions(t, "2", &fourslash.CompletionsExpectedList{
|
||||
IsIncomplete: false,
|
||||
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
||||
CommitCharacters: &DefaultCommitCharacters,
|
||||
EditRange: Ignored,
|
||||
},
|
||||
Items: &fourslash.CompletionsExpectedItems{
|
||||
Exact: []fourslash.CompletionsExpectedItem{
|
||||
"foo",
|
||||
},
|
||||
},
|
||||
})
|
||||
f.Insert(t, "foo();")
|
||||
f.VerifyCompletions(t, "3", &fourslash.CompletionsExpectedList{
|
||||
IsIncomplete: false,
|
||||
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
||||
CommitCharacters: &DefaultCommitCharacters,
|
||||
EditRange: Ignored,
|
||||
},
|
||||
Items: &fourslash.CompletionsExpectedItems{
|
||||
Includes: []fourslash.CompletionsExpectedItem{
|
||||
"y",
|
||||
},
|
||||
},
|
||||
})
|
||||
f.Insert(t, "y;")
|
||||
f.VerifyQuickInfoAt(t, "4", "var r2: number", "")
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual augmentedTypesModule5"
|
||||
|
||||
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/testutil"
|
||||
)
|
||||
|
||||
func TestAugmentedTypesModule5(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `declare class m3e { foo(): void }
|
||||
namespace m3e { export var y = 2; }
|
||||
var /*1*/r = new m3e();
|
||||
r./*2*/
|
||||
var /*4*/r2 = m3e./*3*/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyQuickInfoAt(t, "1", "var r: m3e", "")
|
||||
f.VerifyCompletions(t, "2", &fourslash.CompletionsExpectedList{
|
||||
IsIncomplete: false,
|
||||
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
||||
CommitCharacters: &DefaultCommitCharacters,
|
||||
EditRange: Ignored,
|
||||
},
|
||||
Items: &fourslash.CompletionsExpectedItems{
|
||||
Exact: []fourslash.CompletionsExpectedItem{
|
||||
"foo",
|
||||
},
|
||||
},
|
||||
})
|
||||
f.Insert(t, "foo();")
|
||||
f.VerifyCompletions(t, "3", &fourslash.CompletionsExpectedList{
|
||||
IsIncomplete: false,
|
||||
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
||||
CommitCharacters: &DefaultCommitCharacters,
|
||||
EditRange: Ignored,
|
||||
},
|
||||
Items: &fourslash.CompletionsExpectedItems{
|
||||
Includes: []fourslash.CompletionsExpectedItem{
|
||||
"y",
|
||||
},
|
||||
},
|
||||
})
|
||||
f.Insert(t, "y;")
|
||||
f.VerifyQuickInfoAt(t, "4", "var r2: number", "")
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual augmentedTypesModule6"
|
||||
|
||||
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/testutil"
|
||||
)
|
||||
|
||||
func TestAugmentedTypesModule6(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `declare class m3f { foo(x: number): void }
|
||||
namespace m3f { export interface I { foo(): void } }
|
||||
var x: m3f./*1*/
|
||||
var /*4*/r = new /*2*/m3f(/*3*/);
|
||||
r./*5*/
|
||||
var r2: m3f.I = r;
|
||||
r2./*6*/`
|
||||
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{
|
||||
Includes: []fourslash.CompletionsExpectedItem{
|
||||
"I",
|
||||
},
|
||||
Excludes: []string{
|
||||
"foo",
|
||||
},
|
||||
},
|
||||
})
|
||||
f.Insert(t, "I;")
|
||||
f.VerifyCompletions(t, "2", &fourslash.CompletionsExpectedList{
|
||||
IsIncomplete: false,
|
||||
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
||||
CommitCharacters: &DefaultCommitCharacters,
|
||||
EditRange: Ignored,
|
||||
},
|
||||
Items: &fourslash.CompletionsExpectedItems{
|
||||
Includes: []fourslash.CompletionsExpectedItem{
|
||||
"m3f",
|
||||
},
|
||||
},
|
||||
})
|
||||
f.GoToMarker(t, "3")
|
||||
f.VerifySignatureHelp(t, fourslash.VerifySignatureHelpOptions{Text: "m3f(): m3f"})
|
||||
f.VerifyQuickInfoAt(t, "4", "var r: m3f", "")
|
||||
f.VerifyCompletions(t, "5", &fourslash.CompletionsExpectedList{
|
||||
IsIncomplete: false,
|
||||
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
||||
CommitCharacters: &DefaultCommitCharacters,
|
||||
EditRange: Ignored,
|
||||
},
|
||||
Items: &fourslash.CompletionsExpectedItems{
|
||||
Includes: []fourslash.CompletionsExpectedItem{
|
||||
"foo",
|
||||
},
|
||||
},
|
||||
})
|
||||
f.Insert(t, "foo(1)")
|
||||
f.VerifyCompletions(t, "6", &fourslash.CompletionsExpectedList{
|
||||
IsIncomplete: false,
|
||||
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
||||
CommitCharacters: &DefaultCommitCharacters,
|
||||
EditRange: Ignored,
|
||||
},
|
||||
Items: &fourslash.CompletionsExpectedItems{
|
||||
Includes: []fourslash.CompletionsExpectedItem{
|
||||
"foo",
|
||||
},
|
||||
},
|
||||
})
|
||||
f.Insert(t, "foo(")
|
||||
f.VerifySignatureHelp(t, fourslash.VerifySignatureHelpOptions{Text: "foo(): void"})
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoFormattingOnPasting"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoFormattingOnPasting(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `namespace TestModule {
|
||||
/**/
|
||||
}`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.GoToMarker(t, "")
|
||||
f.Paste(t, " class TestClass{\nprivate foo;\npublic testMethod( )\n{}\n}")
|
||||
f.VerifyCurrentFileContent(t, `namespace TestModule {
|
||||
class TestClass {
|
||||
private foo;
|
||||
public testMethod() { }
|
||||
}
|
||||
}`)
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportAllowImportingTsExtensionsPackageJsonImports1"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportAllowImportingTsExtensionsPackageJsonImports1(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @lib: es5
|
||||
// @module: node18
|
||||
// @allowImportingTsExtensions: true
|
||||
// @Filename: /node_modules/pkg/package.json
|
||||
{
|
||||
"name": "pkg",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
"./*": {
|
||||
"types": "./types/*",
|
||||
"default": "./dist/*"
|
||||
}
|
||||
}
|
||||
}
|
||||
// @Filename: /node_modules/pkg/types/external.d.ts
|
||||
export declare function external(name: string): any;
|
||||
// @Filename: /package.json
|
||||
{
|
||||
"name": "self",
|
||||
"type": "module",
|
||||
"imports": {
|
||||
"#*": "./src/*"
|
||||
},
|
||||
"dependencies": {
|
||||
"pkg": "*"
|
||||
}
|
||||
}
|
||||
// @Filename: /src/add.ts
|
||||
export function add(a: number, b: number) {}
|
||||
// @Filename: /src/index.ts
|
||||
add/*imports*/;
|
||||
external/*exports*/;`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "imports", []string{"#add.ts"}, nil /*preferences*/)
|
||||
f.VerifyImportFixModuleSpecifiers(t, "exports", []string{"pkg/external.js"}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportAllowImportingTsExtensionsPackageJsonImports2"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportAllowImportingTsExtensionsPackageJsonImports2(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: /tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "nodenext",
|
||||
"allowImportingTsExtensions": true,
|
||||
"rootDir": "src",
|
||||
"outDir": "dist",
|
||||
"declarationDir": "types",
|
||||
"declaration": true
|
||||
}
|
||||
}
|
||||
// @Filename: /package.json
|
||||
{
|
||||
"name": "self",
|
||||
"type": "module",
|
||||
"imports": {
|
||||
"#*": {
|
||||
"types": "./types/*",
|
||||
"default": "./dist/*"
|
||||
}
|
||||
}
|
||||
}
|
||||
// @Filename: /src/add.ts
|
||||
export function add(a: number, b: number) {}
|
||||
// @Filename: /src/index.ts
|
||||
add/*imports*/;
|
||||
external/*exports*/;`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "imports", []string{"#add.js"}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportBundlerBlockRelativeNodeModulesPaths"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportBundlerBlockRelativeNodeModulesPaths(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: esnext
|
||||
// @moduleResolution: bundler
|
||||
// @Filename: /node_modules/dep/package.json
|
||||
{
|
||||
"name": "dep",
|
||||
"version": "1.0.0",
|
||||
"exports": "./dist/index.js"
|
||||
}
|
||||
// @Filename: /node_modules/dep/dist/utils.d.ts
|
||||
export const util: () => void;
|
||||
// @Filename: /node_modules/dep/dist/index.d.ts
|
||||
export * from "./utils";
|
||||
// @Filename: /index.ts
|
||||
util/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"dep"}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportBundlerExports"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportBundlerExports(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: esnext
|
||||
// @moduleResolution: bundler
|
||||
// @Filename: /node_modules/dep/package.json
|
||||
{
|
||||
"name": "dep",
|
||||
"version": "1.0.0",
|
||||
"exports": {
|
||||
".": "./dist/index.js"
|
||||
}
|
||||
}
|
||||
// @Filename: /node_modules/dep/dist/index.d.ts
|
||||
export const dep: number;
|
||||
// @Filename: /index.ts
|
||||
dep/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"dep"}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
// 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"];
|
||||
}`),
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportCompletionExportEqualsWithDefault1"
|
||||
|
||||
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 TestAutoImportCompletionExportEqualsWithDefault1(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @strict: true
|
||||
// @module: commonjs
|
||||
// @esModuleInterop: false
|
||||
// @allowSyntheticDefaultImports: false
|
||||
// @filename: node.ts
|
||||
import Container from "./container.js";
|
||||
import Document from "./document.js";
|
||||
|
||||
declare namespace Node {
|
||||
class Node extends Node_ {}
|
||||
|
||||
export { Node as default };
|
||||
}
|
||||
|
||||
declare abstract class Node_ {
|
||||
parent: Container | Document | undefined;
|
||||
}
|
||||
|
||||
declare class Node extends Node_ {}
|
||||
|
||||
export = Node;
|
||||
// @filename: document.ts
|
||||
import Container from "./container.js";
|
||||
|
||||
declare namespace Document {
|
||||
export { Document_ as default };
|
||||
}
|
||||
|
||||
declare class Document_ extends Container {}
|
||||
|
||||
declare class Document extends Document_ {}
|
||||
|
||||
export = Document;
|
||||
// @filename: container.ts
|
||||
import Node from "./node.js";
|
||||
|
||||
declare namespace Container {
|
||||
export { Container_ as default };
|
||||
}
|
||||
|
||||
declare abstract class Container_ extends Node {
|
||||
p/*1*/
|
||||
}
|
||||
|
||||
declare class Container extends Container_ {}
|
||||
|
||||
export = Container;`
|
||||
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: "parent",
|
||||
InsertText: new("parent: Container_ | Document_ | undefined;"),
|
||||
FilterText: new("parent"),
|
||||
AdditionalTextEdits: fourslash.AnyTextEdits,
|
||||
Data: &lsproto.CompletionItemData{
|
||||
Source: "ClassMemberSnippet/",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
f.VerifyApplyCodeActionFromCompletion(t, new("1"), &fourslash.ApplyCodeActionFromCompletionOptions{
|
||||
Name: "parent",
|
||||
Source: "ClassMemberSnippet/",
|
||||
Description: "Includes imports of types referenced by 'parent'",
|
||||
NewFileContent: new(`import Document_ from "./document.js";
|
||||
import Node from "./node.js";
|
||||
|
||||
declare namespace Container {
|
||||
export { Container_ as default };
|
||||
}
|
||||
|
||||
declare abstract class Container_ extends Node {
|
||||
p
|
||||
}
|
||||
|
||||
declare class Container extends Container_ {}
|
||||
|
||||
export = Container;`),
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportCompletionExportListAugmentation1"
|
||||
|
||||
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 TestAutoImportCompletionExportListAugmentation1(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: node18
|
||||
// @Filename: /node_modules/@sapphire/pieces/index.d.ts
|
||||
interface Container {
|
||||
stores: unknown;
|
||||
}
|
||||
|
||||
declare class Piece {
|
||||
container: Container;
|
||||
}
|
||||
|
||||
export { Piece, type Container };
|
||||
// @FileName: /augmentation.ts
|
||||
declare module "@sapphire/pieces" {
|
||||
interface Container {
|
||||
client: unknown;
|
||||
}
|
||||
export { Container };
|
||||
}
|
||||
// @Filename: /index.ts
|
||||
import { Piece } from "@sapphire/pieces";
|
||||
class FullPiece extends Piece {
|
||||
/*1*/
|
||||
}`
|
||||
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: "container",
|
||||
InsertText: new("container: Container;"),
|
||||
FilterText: new("container"),
|
||||
AdditionalTextEdits: fourslash.AnyTextEdits,
|
||||
Data: &lsproto.CompletionItemData{
|
||||
Source: "ClassMemberSnippet/",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
f.VerifyApplyCodeActionFromCompletion(t, new("1"), &fourslash.ApplyCodeActionFromCompletionOptions{
|
||||
Name: "container",
|
||||
Source: "ClassMemberSnippet/",
|
||||
Description: "Includes imports of types referenced by 'container'",
|
||||
NewFileContent: new(`import { Container, Piece } from "@sapphire/pieces";
|
||||
class FullPiece extends Piece {
|
||||
|
||||
}`),
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportCompletionExportListAugmentation2"
|
||||
|
||||
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 TestAutoImportCompletionExportListAugmentation2(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: node18
|
||||
// @Filename: /node_modules/@sapphire/pieces/index.d.ts
|
||||
interface Container {
|
||||
stores: unknown;
|
||||
}
|
||||
|
||||
declare class Piece {
|
||||
get container(): Container;
|
||||
}
|
||||
|
||||
declare class AliasPiece extends Piece {}
|
||||
|
||||
export { AliasPiece, type Container };
|
||||
// @Filename: /node_modules/@sapphire/framework/index.d.ts
|
||||
import { AliasPiece } from "@sapphire/pieces";
|
||||
|
||||
declare class Command extends AliasPiece {}
|
||||
|
||||
declare module "@sapphire/pieces" {
|
||||
interface Container {
|
||||
client: unknown;
|
||||
}
|
||||
}
|
||||
|
||||
export { Command };
|
||||
// @Filename: /index.ts
|
||||
import "@sapphire/pieces";
|
||||
import { Command } from "@sapphire/framework";
|
||||
class PingCommand extends Command {
|
||||
/*1*/
|
||||
}`
|
||||
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: "container",
|
||||
InsertText: new("get container(): Container {\n}"),
|
||||
FilterText: new("container"),
|
||||
AdditionalTextEdits: fourslash.AnyTextEdits,
|
||||
Data: &lsproto.CompletionItemData{
|
||||
Source: "ClassMemberSnippet/",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
f.VerifyApplyCodeActionFromCompletion(t, new("1"), &fourslash.ApplyCodeActionFromCompletionOptions{
|
||||
Name: "container",
|
||||
Source: "ClassMemberSnippet/",
|
||||
Description: "Includes imports of types referenced by 'container'",
|
||||
NewFileContent: new(`import "@sapphire/pieces";
|
||||
import { Command } from "@sapphire/framework";
|
||||
import { Container } from "@sapphire/pieces";
|
||||
class PingCommand extends Command {
|
||||
|
||||
}`),
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportCompletionExportListAugmentation3"
|
||||
|
||||
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 TestAutoImportCompletionExportListAugmentation3(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: node18
|
||||
// @Filename: /node_modules/@sapphire/pieces/index.d.ts
|
||||
export interface Container {
|
||||
stores: unknown;
|
||||
}
|
||||
|
||||
declare class Piece {
|
||||
container: Container;
|
||||
}
|
||||
|
||||
export { Piece };
|
||||
// @FileName: /augmentation.ts
|
||||
declare module "@sapphire/pieces" {
|
||||
interface Container {
|
||||
client: unknown;
|
||||
}
|
||||
}
|
||||
// @Filename: /index.ts
|
||||
import { Piece } from "@sapphire/pieces";
|
||||
class FullPiece extends Piece {
|
||||
/*1*/
|
||||
}`
|
||||
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: "container",
|
||||
InsertText: new("container: Container;"),
|
||||
FilterText: new("container"),
|
||||
AdditionalTextEdits: fourslash.AnyTextEdits,
|
||||
Data: &lsproto.CompletionItemData{
|
||||
Source: "ClassMemberSnippet/",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
f.VerifyApplyCodeActionFromCompletion(t, new("1"), &fourslash.ApplyCodeActionFromCompletionOptions{
|
||||
Name: "container",
|
||||
Source: "ClassMemberSnippet/",
|
||||
Description: "Includes imports of types referenced by 'container'",
|
||||
NewFileContent: new(`import { Container, Piece } from "@sapphire/pieces";
|
||||
class FullPiece extends Piece {
|
||||
|
||||
}`),
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportCompletionExportListAugmentation4"
|
||||
|
||||
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 TestAutoImportCompletionExportListAugmentation4(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: node18
|
||||
// @Filename: /node_modules/@sapphire/pieces/index.d.ts
|
||||
interface Container {
|
||||
stores: unknown;
|
||||
}
|
||||
|
||||
declare class Piece {
|
||||
get container(): Container;
|
||||
}
|
||||
|
||||
export { Piece as Alias, type Container };
|
||||
// @Filename: /node_modules/@sapphire/framework/index.d.ts
|
||||
import { Alias } from "@sapphire/pieces";
|
||||
|
||||
declare class Command extends Alias {}
|
||||
|
||||
declare module "@sapphire/pieces" {
|
||||
interface Container {
|
||||
client: unknown;
|
||||
}
|
||||
}
|
||||
|
||||
export { Command as CommandAlias };
|
||||
// @Filename: /index.ts
|
||||
import "@sapphire/pieces";
|
||||
import { CommandAlias } from "@sapphire/framework";
|
||||
class PingCommand extends CommandAlias {
|
||||
/*1*/
|
||||
}`
|
||||
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: "container",
|
||||
InsertText: new("get container(): Container {\n}"),
|
||||
FilterText: new("container"),
|
||||
AdditionalTextEdits: fourslash.AnyTextEdits,
|
||||
Data: &lsproto.CompletionItemData{
|
||||
Source: "ClassMemberSnippet/",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
f.VerifyApplyCodeActionFromCompletion(t, new("1"), &fourslash.ApplyCodeActionFromCompletionOptions{
|
||||
Name: "container",
|
||||
Source: "ClassMemberSnippet/",
|
||||
Description: "Includes imports of types referenced by 'container'",
|
||||
NewFileContent: new(`import "@sapphire/pieces";
|
||||
import { CommandAlias } from "@sapphire/framework";
|
||||
import { Container } from "@sapphire/pieces";
|
||||
class PingCommand extends CommandAlias {
|
||||
|
||||
}`),
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportCrossPackage_pathsAndSymlink"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportCrossPackage_pathsAndSymlink(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: /home/src/workspaces/project/packages/common/package.json
|
||||
{
|
||||
"name": "@company/common",
|
||||
"version": "1.0.0",
|
||||
"main": "./lib/index.tsx"
|
||||
}
|
||||
// @Filename: /home/src/workspaces/project/packages/common/lib/index.tsx
|
||||
export function Tooltip {};
|
||||
// @Filename: /home/src/workspaces/project/packages/app/package.json
|
||||
{
|
||||
"name": "@company/app",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"@company/common": "1.0.0"
|
||||
}
|
||||
}
|
||||
// @Filename: /home/src/workspaces/project/packages/app/tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"lib": ["es5"],
|
||||
"module": "esnext",
|
||||
"moduleResolution": "bundler",
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
// @Filename: /home/src/workspaces/project/packages/app/lib/index.ts
|
||||
Tooltip/**/
|
||||
// @link: /home/src/workspaces/project/packages/common -> /home/src/workspaces/project/node_modules/@company/common`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.MarkTestAsStradaServer()
|
||||
f.GoToMarker(t, "")
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"@company/common"}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportCrossProject_baseUrl_toDist"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/ls/lsutil"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportCrossProject_baseUrl_toDist(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: /home/src/workspaces/project/common/tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["es5"],
|
||||
"module": "commonjs",
|
||||
"outDir": "dist",
|
||||
"composite": true
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
// @Filename: /home/src/workspaces/project/common/src/MyModule.ts
|
||||
export function square(n: number) {
|
||||
return n * 2;
|
||||
}
|
||||
// @Filename: /home/src/workspaces/project/web/tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["es5"],
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"noEmit": true,
|
||||
"baseUrl": "."
|
||||
},
|
||||
"include": ["src"],
|
||||
"references": [{ "path": "../common" }]
|
||||
}
|
||||
// @Filename: /home/src/workspaces/project/web/src/MyApp.ts
|
||||
import { square } from "../../common/dist/src/MyModule";
|
||||
// @Filename: /home/src/workspaces/project/web/src/Helper.ts
|
||||
export function saveMe() {
|
||||
square/**/(2);
|
||||
}`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.MarkTestAsStradaServer()
|
||||
f.GoToFile(t, "/home/src/workspaces/project/web/src/Helper.ts")
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"../../common/src/MyModule"}, &lsutil.UserPreferences{ImportModuleSpecifierPreference: "non-relative"})
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportCrossProject_paths_sharedOutDir"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportCrossProject_paths_sharedOutDir(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: /home/src/workspaces/project/tsconfig.base.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["es5"],
|
||||
"module": "commonjs",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"packages/*": ["./packages/*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
// @Filename: /home/src/workspaces/project/packages/app/tsconfig.json
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": { "outDir": "../../dist/packages/app" },
|
||||
"references": [{ "path": "../dep" }]
|
||||
}
|
||||
// @Filename: /home/src/workspaces/project/packages/app/index.ts
|
||||
dep/**/
|
||||
// @Filename: /home/src/workspaces/project/packages/app/utils.ts
|
||||
import "packages/dep";
|
||||
// @Filename: /home/src/workspaces/project/packages/dep/tsconfig.json
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": { "outDir": "../../dist/packages/dep" }
|
||||
}
|
||||
// @Filename: /home/src/workspaces/project/packages/dep/index.ts
|
||||
import "./sub/folder";
|
||||
// @Filename: /home/src/workspaces/project/packages/dep/sub/folder/index.ts
|
||||
export const dep = 0;`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.MarkTestAsStradaServer()
|
||||
f.GoToMarker(t, "")
|
||||
f.VerifyImportFixAtPosition(t, []string{
|
||||
`import { dep } from "packages/dep/sub/folder";
|
||||
|
||||
dep`,
|
||||
}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportCrossProject_paths_stripSrc"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportCrossProject_paths_stripSrc(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: /home/src/workspaces/project/packages/app/package.json
|
||||
{ "name": "app", "dependencies": { "dep": "*" } }
|
||||
// @Filename: /home/src/workspaces/project/packages/app/tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["es5"],
|
||||
"module": "commonjs",
|
||||
"outDir": "dist",
|
||||
"rootDir": "src",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"dep": ["../dep/src/main"],
|
||||
"dep/*": ["../dep/src/*"]
|
||||
}
|
||||
}
|
||||
"references": [{ "path": "../dep" }]
|
||||
}
|
||||
// @Filename: /home/src/workspaces/project/packages/app/src/index.ts
|
||||
dep1/*1*/;
|
||||
// @Filename: /home/src/workspaces/project/packages/app/src/utils.ts
|
||||
dep2/*2*/;
|
||||
// @Filename: /home/src/workspaces/project/packages/app/src/a.ts
|
||||
import "dep";
|
||||
// @Filename: /home/src/workspaces/project/packages/dep/package.json
|
||||
{ "name": "dep", "main": "dist/main.js", "types": "dist/main.d.ts" }
|
||||
// @Filename: /home/src/workspaces/project/packages/dep/tsconfig.json
|
||||
{
|
||||
"compilerOptions": { "lib": ["es5"], "outDir": "dist", "rootDir": "src", "module": "commonjs" }
|
||||
}
|
||||
// @Filename: /home/src/workspaces/project/packages/dep/src/main.ts
|
||||
import "./sub/folder";
|
||||
export const dep1 = 0;
|
||||
// @Filename: /home/src/workspaces/project/packages/dep/src/sub/folder/index.ts
|
||||
export const dep2 = 0;`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.MarkTestAsStradaServer()
|
||||
f.GoToMarker(t, "1")
|
||||
f.VerifyImportFixAtPosition(t, []string{
|
||||
`import { dep1 } from "dep";
|
||||
|
||||
dep1;`,
|
||||
}, nil /*preferences*/)
|
||||
f.GoToMarker(t, "2")
|
||||
f.VerifyImportFixAtPosition(t, []string{
|
||||
`import { dep2 } from "dep/sub/folder";
|
||||
|
||||
dep2;`,
|
||||
}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportCrossProject_paths_toDist2"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/ls/lsutil"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportCrossProject_paths_toDist2(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: /home/src/workspaces/project/common/tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["es5"],
|
||||
"module": "commonjs",
|
||||
"outDir": "dist",
|
||||
"composite": true
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
// @Filename: /home/src/workspaces/project/common/src/MyModule.ts
|
||||
export function square(n: number) {
|
||||
return n * 2;
|
||||
}
|
||||
// @Filename: /home/src/workspaces/project/web/tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["es5"],
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"noEmit": true,
|
||||
"paths": {
|
||||
"@common/*": ["../common/dist/src/*"]
|
||||
}
|
||||
},
|
||||
"include": ["src"],
|
||||
"references": [{ "path": "../common" }]
|
||||
}
|
||||
// @Filename: /home/src/workspaces/project/web/src/MyApp.ts
|
||||
import { square } from "@common/MyModule";
|
||||
// @Filename: /home/src/workspaces/project/web/src/Helper.ts
|
||||
export function saveMe() {
|
||||
square/**/(2);
|
||||
}`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.MarkTestAsStradaServer()
|
||||
f.GoToFile(t, "/home/src/workspaces/project/web/src/Helper.ts")
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"@common/MyModule"}, &lsutil.UserPreferences{ImportModuleSpecifierPreference: "non-relative"})
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportCrossProject_paths_toDist"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportCrossProject_paths_toDist(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: /home/src/workspaces/project/packages/app/package.json
|
||||
{ "name": "app", "dependencies": { "dep": "*" } }
|
||||
// @Filename: /home/src/workspaces/project/packages/app/tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["es5"],
|
||||
"module": "commonjs",
|
||||
"outDir": "dist",
|
||||
"rootDir": "src",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"dep": ["../dep/src/main"],
|
||||
"dep/dist/*": ["../dep/src/*"]
|
||||
}
|
||||
}
|
||||
"references": [{ "path": "../dep" }]
|
||||
}
|
||||
// @Filename: /home/src/workspaces/project/packages/app/src/index.ts
|
||||
dep1/*1*/;
|
||||
// @Filename: /home/src/workspaces/project/packages/app/src/utils.ts
|
||||
dep2/*2*/;
|
||||
// @Filename: /home/src/workspaces/project/packages/app/src/a.ts
|
||||
import "dep";
|
||||
// @Filename: /home/src/workspaces/project/packages/dep/package.json
|
||||
{ "name": "dep", "main": "dist/main.js", "types": "dist/main.d.ts" }
|
||||
// @Filename: /home/src/workspaces/project/packages/dep/tsconfig.json
|
||||
{
|
||||
"compilerOptions": { "lib": ["es5"], "outDir": "dist", "rootDir": "src", "module": "commonjs" }
|
||||
}
|
||||
// @Filename: /home/src/workspaces/project/packages/dep/src/main.ts
|
||||
import "./sub/folder";
|
||||
export const dep1 = 0;
|
||||
// @Filename: /home/src/workspaces/project/packages/dep/src/sub/folder/index.ts
|
||||
export const dep2 = 0;`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.MarkTestAsStradaServer()
|
||||
f.GoToMarker(t, "1")
|
||||
f.VerifyImportFixAtPosition(t, []string{
|
||||
`import { dep1 } from "dep";
|
||||
|
||||
dep1;`,
|
||||
}, nil /*preferences*/)
|
||||
f.GoToMarker(t, "2")
|
||||
f.VerifyImportFixAtPosition(t, []string{
|
||||
`import { dep2 } from "dep/dist/sub/folder";
|
||||
|
||||
dep2;`,
|
||||
}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportCrossProject_paths_toSrc"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportCrossProject_paths_toSrc(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: /home/src/workspaces/project/packages/app/package.json
|
||||
{ "name": "app", "dependencies": { "dep": "*" } }
|
||||
// @Filename: /home/src/workspaces/project/packages/app/tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["es5"],
|
||||
"module": "commonjs",
|
||||
"outDir": "dist",
|
||||
"rootDir": "src",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"dep": ["../dep/src/main"],
|
||||
"dep/*": ["../dep/*"]
|
||||
}
|
||||
}
|
||||
"references": [{ "path": "../dep" }]
|
||||
}
|
||||
// @Filename: /home/src/workspaces/project/packages/app/src/index.ts
|
||||
dep1/*1*/;
|
||||
// @Filename: /home/src/workspaces/project/packages/app/src/utils.ts
|
||||
dep2/*2*/;
|
||||
// @Filename: /home/src/workspaces/project/packages/app/src/a.ts
|
||||
import "dep";
|
||||
// @Filename: /home/src/workspaces/project/packages/dep/package.json
|
||||
{ "name": "dep", "main": "dist/main.js", "types": "dist/main.d.ts" }
|
||||
// @Filename: /home/src/workspaces/project/packages/dep/tsconfig.json
|
||||
{
|
||||
"compilerOptions": { "lib": ["es5"], "outDir": "dist", "rootDir": "src", "module": "commonjs" }
|
||||
}
|
||||
// @Filename: /home/src/workspaces/project/packages/dep/src/main.ts
|
||||
import "./sub/folder";
|
||||
export const dep1 = 0;
|
||||
// @Filename: /home/src/workspaces/project/packages/dep/src/sub/folder/index.ts
|
||||
export const dep2 = 0;`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.MarkTestAsStradaServer()
|
||||
f.GoToMarker(t, "1")
|
||||
f.VerifyImportFixAtPosition(t, []string{
|
||||
`import { dep1 } from "dep";
|
||||
|
||||
dep1;`,
|
||||
}, nil /*preferences*/)
|
||||
f.GoToMarker(t, "2")
|
||||
f.VerifyImportFixAtPosition(t, []string{
|
||||
`import { dep2 } from "dep/src/sub/folder";
|
||||
|
||||
dep2;`,
|
||||
}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportCrossProject_symlinks_stripSrc"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportCrossProject_symlinks_stripSrc(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: /home/src/workspaces/project/packages/app/package.json
|
||||
{ "name": "app", "dependencies": { "dep": "*" } }
|
||||
// @Filename: /home/src/workspaces/project/packages/app/tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["es5"],
|
||||
"module": "commonjs",
|
||||
"outDir": "dist",
|
||||
"rootDir": "src",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"dep/*": ["../dep/src/*"]
|
||||
}
|
||||
}
|
||||
"references": [{ "path": "../dep" }]
|
||||
}
|
||||
// @Filename: /home/src/workspaces/project/packages/app/src/index.ts
|
||||
dep/**/
|
||||
// @Filename: /home/src/workspaces/project/packages/dep/package.json
|
||||
{ "name": "dep", "main": "dist/index.js", "types": "dist/index.d.ts" }
|
||||
// @Filename: /home/src/workspaces/project/packages/dep/tsconfig.json
|
||||
{
|
||||
"compilerOptions": { "lib": ["es5"], "outDir": "dist", "rootDir": "src", "module": "commonjs" }
|
||||
}
|
||||
// @Filename: /home/src/workspaces/project/packages/dep/src/index.ts
|
||||
import "./sub/folder";
|
||||
// @Filename: /home/src/workspaces/project/packages/dep/src/sub/folder/index.ts
|
||||
export const dep = 0;
|
||||
// @link: /home/src/workspaces/project/packages/dep -> /home/src/workspaces/project/packages/app/node_modules/dep`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.MarkTestAsStradaServer()
|
||||
f.GoToMarker(t, "")
|
||||
f.VerifyImportFixAtPosition(t, []string{
|
||||
`import { dep } from "dep/sub/folder";
|
||||
|
||||
dep`,
|
||||
}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportCrossProject_symlinks_toDist"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportCrossProject_symlinks_toDist(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: /home/src/workspaces/project/packages/app/package.json
|
||||
{ "name": "app", "dependencies": { "dep": "*" } }
|
||||
// @Filename: /home/src/workspaces/project/packages/app/tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["es5"],
|
||||
"module": "commonjs",
|
||||
"outDir": "dist",
|
||||
"rootDir": "src",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"dep/dist/*": ["../dep/src/*"]
|
||||
}
|
||||
}
|
||||
"references": [{ "path": "../dep" }]
|
||||
}
|
||||
// @Filename: /home/src/workspaces/project/packages/app/src/index.ts
|
||||
dep/**/
|
||||
// @Filename: /home/src/workspaces/project/packages/dep/package.json
|
||||
{ "name": "dep", "main": "dist/index.js", "types": "dist/index.d.ts" }
|
||||
// @Filename: /home/src/workspaces/project/packages/dep/tsconfig.json
|
||||
{
|
||||
"compilerOptions": { "lib": ["es5"], "outDir": "dist", "rootDir": "src", "module": "commonjs" }
|
||||
}
|
||||
// @Filename: /home/src/workspaces/project/packages/dep/src/index.ts
|
||||
import "./sub/folder";
|
||||
// @Filename: /home/src/workspaces/project/packages/dep/src/sub/folder/index.ts
|
||||
export const dep = 0;
|
||||
// @link: /home/src/workspaces/project/packages/dep -> /home/src/workspaces/project/packages/app/node_modules/dep`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.MarkTestAsStradaServer()
|
||||
f.GoToMarker(t, "")
|
||||
f.VerifyImportFixAtPosition(t, []string{
|
||||
`import { dep } from "dep/dist/sub/folder";
|
||||
|
||||
dep`,
|
||||
}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportFileExcludePatterns10"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/ls/lsutil"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportFileExcludePatterns10(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: /src/vs/test.ts
|
||||
import { Parts } from './parts';
|
||||
export class /**/Extended implements Parts {
|
||||
}
|
||||
// @Filename: /src/vs/parts.ts
|
||||
import { Event } from '../event/event';
|
||||
|
||||
export interface Parts {
|
||||
readonly options: Event;
|
||||
}
|
||||
// @Filename: /src/event/event.ts
|
||||
export interface Event {
|
||||
(): string;
|
||||
}
|
||||
// @Filename: /src/thing.ts
|
||||
import { Event } from './event/event';
|
||||
export { Event };
|
||||
// @Filename: /src/a.ts
|
||||
import './thing'
|
||||
declare module './thing' {
|
||||
interface Event {
|
||||
c: string;
|
||||
}
|
||||
}`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyCodeFix(t, fourslash.VerifyCodeFixOptions{
|
||||
Description: "Implement interface 'Parts'",
|
||||
NewFileContent: `import { Event } from '../event/event';
|
||||
import { Parts } from './parts';
|
||||
export class Extended implements Parts {
|
||||
options: Event;
|
||||
}`,
|
||||
Index: 0,
|
||||
UserPreferences: &lsutil.UserPreferences{AutoImportFileExcludePatterns: []string{"src/thing.ts"}},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportFileExcludePatterns11"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/ls/lsutil"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportFileExcludePatterns11(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: /src/vs/test.ts
|
||||
import { Parts } from './parts';
|
||||
export class /**/Extended implements Parts {
|
||||
}
|
||||
// @Filename: /src/vs/parts.ts
|
||||
import { Event } from '../thing';
|
||||
export interface Parts {
|
||||
readonly options: Event;
|
||||
}
|
||||
// @Filename: /src/event/event.ts
|
||||
export interface Event {
|
||||
(): string;
|
||||
}
|
||||
// @Filename: /src/thing.ts
|
||||
import { Event } from './event/event';
|
||||
export { Event };
|
||||
// @Filename: /src/a.ts
|
||||
import './thing'
|
||||
declare module './thing' {
|
||||
interface Event {
|
||||
c: string;
|
||||
}
|
||||
}`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyCodeFix(t, fourslash.VerifyCodeFixOptions{
|
||||
Description: "Implement interface 'Parts'",
|
||||
NewFileContent: `import { Event } from '../event/event';
|
||||
import { Parts } from './parts';
|
||||
export class Extended implements Parts {
|
||||
options: Event;
|
||||
}`,
|
||||
Index: 0,
|
||||
UserPreferences: &lsutil.UserPreferences{AutoImportFileExcludePatterns: []string{"src/thing.ts"}},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportFileExcludePatterns12"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/ls/lsutil"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportFileExcludePatterns12(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: /src/vs/test.ts
|
||||
import { Parts } from './parts';
|
||||
export class /**/Extended implements Parts {
|
||||
}
|
||||
// @Filename: /src/vs/parts.ts
|
||||
import { Event } from '../thing';
|
||||
export interface Parts {
|
||||
readonly options: Event;
|
||||
}
|
||||
// @Filename: /src/event/event.ts
|
||||
export interface Event {
|
||||
(): string;
|
||||
}
|
||||
// @Filename: /src/thing.ts
|
||||
import { Event } from '../event/event';
|
||||
export { Event };
|
||||
// @Filename: /src/a.ts
|
||||
import './thing'
|
||||
declare module './thing' {
|
||||
interface Event {
|
||||
c: string;
|
||||
}
|
||||
}`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyCodeFix(t, fourslash.VerifyCodeFixOptions{
|
||||
Description: "Implement interface 'Parts'",
|
||||
NewFileContent: `import { Parts } from './parts';
|
||||
export class Extended implements Parts {
|
||||
options: Event;
|
||||
}`,
|
||||
Index: 0,
|
||||
UserPreferences: &lsutil.UserPreferences{AutoImportFileExcludePatterns: []string{"src/thing.ts"}},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportFileExcludePatterns13"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/ls/lsutil"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportFileExcludePatterns13(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: /src/vs/test.ts
|
||||
import { Parts } from './parts';
|
||||
export class /**/Extended implements Parts {
|
||||
}
|
||||
// @Filename: /src/vs/parts.ts
|
||||
import { Event } from '../event/event';
|
||||
|
||||
export interface Parts {
|
||||
readonly options: Event;
|
||||
}
|
||||
// @Filename: /src/event/event.ts
|
||||
export interface Event {
|
||||
(): string;
|
||||
}
|
||||
// @Filename: /src/thing.ts
|
||||
import { Event } from '../event/event';
|
||||
export { Event };
|
||||
// @Filename: /src/a.ts
|
||||
import './thing'
|
||||
declare module './thing' {
|
||||
interface Event {
|
||||
c: string;
|
||||
}
|
||||
}`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyCodeFix(t, fourslash.VerifyCodeFixOptions{
|
||||
Description: "Implement interface 'Parts'",
|
||||
NewFileContent: `import { Event } from '../event/event';
|
||||
import { Parts } from './parts';
|
||||
export class Extended implements Parts {
|
||||
options: Event;
|
||||
}`,
|
||||
Index: 0,
|
||||
UserPreferences: &lsutil.UserPreferences{AutoImportFileExcludePatterns: []string{"src/thing.ts"}},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportFileExcludePatterns2"
|
||||
|
||||
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/ls/lsutil"
|
||||
"github.com/microsoft/typescript-go/internal/lsp/lsproto"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportFileExcludePatterns2(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @lib: es5
|
||||
// @Filename: /lib/components/button/Button.ts
|
||||
export function Button() {}
|
||||
// @Filename: /lib/components/button/index.ts
|
||||
export * from "./Button";
|
||||
// @Filename: /lib/components/index.ts
|
||||
export * from "./button";
|
||||
// @Filename: /lib/main.ts
|
||||
export { Button } from "./components";
|
||||
// @Filename: /lib/index.ts
|
||||
export * from "./main";
|
||||
// @Filename: /i-hate-index-files.ts
|
||||
Button/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
|
||||
IsIncomplete: false,
|
||||
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
||||
CommitCharacters: &DefaultCommitCharacters,
|
||||
EditRange: Ignored,
|
||||
},
|
||||
Items: &fourslash.CompletionsExpectedItems{
|
||||
Exact: CompletionGlobalsPlus(
|
||||
[]fourslash.CompletionsExpectedItem{
|
||||
&lsproto.CompletionItem{
|
||||
Label: "Button",
|
||||
Data: &lsproto.CompletionItemData{
|
||||
AutoImport: &lsproto.AutoImportFix{
|
||||
ModuleSpecifier: "./lib/main",
|
||||
},
|
||||
},
|
||||
AdditionalTextEdits: fourslash.AnyTextEdits,
|
||||
SortText: new(string(ls.SortTextAutoImportSuggestions)),
|
||||
},
|
||||
}, false,
|
||||
),
|
||||
},
|
||||
UserPreferences: &lsutil.UserPreferences{AutoImportFileExcludePatterns: []string{"/**/index.*"}},
|
||||
})
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"./lib/main", "./lib/components/button/Button"}, &lsutil.UserPreferences{AutoImportFileExcludePatterns: []string{"/**/index.*"}})
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportFileExcludePatterns3"
|
||||
|
||||
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/ls/lsutil"
|
||||
"github.com/microsoft/typescript-go/internal/lsp/lsproto"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportFileExcludePatterns3(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @lib: es5
|
||||
// @module: commonjs
|
||||
// @Filename: /ambient1.d.ts
|
||||
declare module "foo" {
|
||||
export const x = 1;
|
||||
}
|
||||
// @Filename: /ambient2.d.ts
|
||||
declare module "foo" {
|
||||
export const y = 2;
|
||||
}
|
||||
// @Filename: /index.ts
|
||||
/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
|
||||
IsIncomplete: false,
|
||||
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
||||
CommitCharacters: &DefaultCommitCharacters,
|
||||
EditRange: Ignored,
|
||||
},
|
||||
Items: &fourslash.CompletionsExpectedItems{
|
||||
Exact: CompletionGlobalsPlus(
|
||||
[]fourslash.CompletionsExpectedItem{
|
||||
&lsproto.CompletionItem{
|
||||
Label: "x",
|
||||
Data: &lsproto.CompletionItemData{
|
||||
AutoImport: &lsproto.AutoImportFix{
|
||||
ModuleSpecifier: "foo",
|
||||
},
|
||||
},
|
||||
AdditionalTextEdits: fourslash.AnyTextEdits,
|
||||
SortText: new(string(ls.SortTextAutoImportSuggestions)),
|
||||
},
|
||||
&lsproto.CompletionItem{
|
||||
Label: "y",
|
||||
Data: &lsproto.CompletionItemData{
|
||||
AutoImport: &lsproto.AutoImportFix{
|
||||
ModuleSpecifier: "foo",
|
||||
},
|
||||
},
|
||||
AdditionalTextEdits: fourslash.AnyTextEdits,
|
||||
SortText: new(string(ls.SortTextAutoImportSuggestions)),
|
||||
},
|
||||
}, false,
|
||||
),
|
||||
},
|
||||
UserPreferences: &lsutil.UserPreferences{AutoImportFileExcludePatterns: []string{"/**/ambient1.d.ts"}},
|
||||
})
|
||||
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
|
||||
IsIncomplete: false,
|
||||
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
||||
CommitCharacters: &DefaultCommitCharacters,
|
||||
EditRange: Ignored,
|
||||
},
|
||||
Items: &fourslash.CompletionsExpectedItems{
|
||||
Exact: CompletionGlobals,
|
||||
},
|
||||
UserPreferences: &lsutil.UserPreferences{AutoImportFileExcludePatterns: []string{"/**/ambient*"}},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportFileExcludePatterns4"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/ls/lsutil"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportFileExcludePatterns4(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: /src/vs/workbench/test.ts
|
||||
import { Parts } from './parts';
|
||||
export class /**/EditorParts implements Parts { }
|
||||
// @Filename: /src/vs/event/event.ts
|
||||
export interface Event {
|
||||
(): string;
|
||||
}
|
||||
// @Filename: /src/vs/workbench/parts.ts
|
||||
import { Event } from '../event/event';
|
||||
export interface Parts {
|
||||
readonly options: Event;
|
||||
}
|
||||
// @Filename: /src/vs/workbench/workbench.ts
|
||||
import { Event } from '../event/event';
|
||||
export { Event };`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyCodeFix(t, fourslash.VerifyCodeFixOptions{
|
||||
Description: "Implement interface 'Parts'",
|
||||
NewFileContent: `import { Event } from '../event/event';
|
||||
import { Parts } from './parts';
|
||||
export class EditorParts implements Parts {
|
||||
options: Event;
|
||||
}`,
|
||||
Index: 0,
|
||||
UserPreferences: &lsutil.UserPreferences{AutoImportFileExcludePatterns: []string{"src/vs/workbench/workbench.ts"}},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportFileExcludePatterns5"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/ls/lsutil"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportFileExcludePatterns5(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: /src/vs/workbench/test.ts
|
||||
import { Parts } from './parts';
|
||||
export class /**/EditorParts implements Parts { }
|
||||
// @Filename: /src/vs/event/event.ts
|
||||
export interface Event {
|
||||
(): string;
|
||||
}
|
||||
// @Filename: /src/vs/workbench/parts.ts
|
||||
import { Event } from '../event/event';
|
||||
export interface Parts {
|
||||
readonly options: Event;
|
||||
}
|
||||
// @Filename: /src/vs/workbench/workbench.ts
|
||||
import { Event } from '../event/event';
|
||||
export { Event };
|
||||
// @Filename: /src/vs/workbench/canImport.ts
|
||||
import { Event } from '../event/event';
|
||||
export { Event };`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyCodeFix(t, fourslash.VerifyCodeFixOptions{
|
||||
Description: "Implement interface 'Parts'",
|
||||
NewFileContent: `import { Event } from './canImport';
|
||||
import { Parts } from './parts';
|
||||
export class EditorParts implements Parts {
|
||||
options: Event;
|
||||
}`,
|
||||
Index: 0,
|
||||
UserPreferences: &lsutil.UserPreferences{AutoImportFileExcludePatterns: []string{"src/vs/workbench/workbench.ts"}},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportFileExcludePatterns6"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/ls/lsutil"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportFileExcludePatterns6(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: /src/vs/workbench/test.ts
|
||||
import { Parts } from './parts';
|
||||
export class /**/EditorParts implements Parts { }
|
||||
// @Filename: /src/vs/event/event.ts
|
||||
export interface Event {
|
||||
(): string;
|
||||
}
|
||||
// @Filename: /src/vs/workbench/parts.ts
|
||||
import { Event } from '../event/event';
|
||||
export interface Parts {
|
||||
readonly options: Event;
|
||||
}
|
||||
// @Filename: /src/vs/workbench/workbench.ts
|
||||
import { Event } from './canImport';
|
||||
export { Event };
|
||||
// @Filename: /src/vs/workbench/canImport.ts
|
||||
import { Event } from '../event/event';
|
||||
export { Event };`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyCodeFix(t, fourslash.VerifyCodeFixOptions{
|
||||
Description: "Implement interface 'Parts'",
|
||||
NewFileContent: `import { Event } from './canImport';
|
||||
import { Parts } from './parts';
|
||||
export class EditorParts implements Parts {
|
||||
options: Event;
|
||||
}`,
|
||||
Index: 0,
|
||||
UserPreferences: &lsutil.UserPreferences{AutoImportFileExcludePatterns: []string{"src/vs/workbench/workbench.ts"}},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportFileExcludePatterns7"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/ls/lsutil"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportFileExcludePatterns7(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: /src/vs/workbench/test.ts
|
||||
import { Parts } from './parts';
|
||||
export class /**/EditorParts implements Parts { }
|
||||
// @Filename: /src/vs/event/event.ts
|
||||
export interface Event {
|
||||
(): string;
|
||||
}
|
||||
// @Filename: /src/vs/workbench/parts.ts
|
||||
import { Event } from '../event/event';
|
||||
export interface Parts {
|
||||
readonly options: Event;
|
||||
}
|
||||
// @Filename: /src/vs/workbench/workbench.ts
|
||||
import { Event } from '../event/event';
|
||||
export { Event };
|
||||
// @Filename: /src/vs/workbench/workbench2.ts
|
||||
import { Event } from '../event/event';
|
||||
export { Event };`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyCodeFix(t, fourslash.VerifyCodeFixOptions{
|
||||
Description: "Implement interface 'Parts'",
|
||||
NewFileContent: `import { Event } from '../event/event';
|
||||
import { Parts } from './parts';
|
||||
export class EditorParts implements Parts {
|
||||
options: Event;
|
||||
}`,
|
||||
Index: 0,
|
||||
UserPreferences: &lsutil.UserPreferences{AutoImportFileExcludePatterns: []string{"src/vs/workbench/workbench*"}},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportFileExcludePatterns8"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/ls/lsutil"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportFileExcludePatterns8(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: /src/vs/workbench/test.ts
|
||||
import { Parts } from './parts';
|
||||
export class /**/EditorParts implements Parts { }
|
||||
// @Filename: /src/vs/event/event.ts
|
||||
export interface Event {
|
||||
(): string;
|
||||
}
|
||||
// @Filename: /src/vs/workbench/parts.ts
|
||||
import { Event } from '../event/event';
|
||||
export interface Parts {
|
||||
readonly options: Event;
|
||||
}
|
||||
// @Filename: /src/vs/workbench/workbench.ts
|
||||
import { Event } from './workbench2';
|
||||
export { Event };
|
||||
// @Filename: /src/vs/workbench/workbench2.ts
|
||||
import { Event } from '../event/event';
|
||||
export { Event };`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyCodeFix(t, fourslash.VerifyCodeFixOptions{
|
||||
Description: "Implement interface 'Parts'",
|
||||
NewFileContent: `import { Event } from '../event/event';
|
||||
import { Parts } from './parts';
|
||||
export class EditorParts implements Parts {
|
||||
options: Event;
|
||||
}`,
|
||||
Index: 0,
|
||||
UserPreferences: &lsutil.UserPreferences{AutoImportFileExcludePatterns: []string{"src/vs/workbench/workbench*"}},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportFileExcludePatterns9"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/ls/lsutil"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportFileExcludePatterns9(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: /src/vs/workbench/test.ts
|
||||
import { Parts } from './parts';
|
||||
export class /**/EditorParts implements Parts { }
|
||||
// @Filename: /src/vs/event/event.ts
|
||||
export interface Event {
|
||||
(): string;
|
||||
}
|
||||
// @Filename: /src/vs/workbench/parts.ts
|
||||
import { Event } from '../event/event';
|
||||
export interface Parts {
|
||||
readonly options: Event;
|
||||
}
|
||||
// @Filename: /src/vs/workbench/workbench.ts
|
||||
import { Event } from '../event/event';
|
||||
export { Event };
|
||||
// @Filename: /src/vs/test.ts
|
||||
import { Event } from './event/event';
|
||||
export { Event };`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyCodeFix(t, fourslash.VerifyCodeFixOptions{
|
||||
Description: "Implement interface 'Parts'",
|
||||
NewFileContent: `import { Event } from '../test';
|
||||
import { Parts } from './parts';
|
||||
export class EditorParts implements Parts {
|
||||
options: Event;
|
||||
}`,
|
||||
Index: 0,
|
||||
UserPreferences: &lsutil.UserPreferences{AutoImportFileExcludePatterns: []string{"src/vs/workbench/workbench*"}},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportJsDocImport1"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportJsDocImport1(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @verbatimModuleSyntax: true
|
||||
// @target: esnext
|
||||
// @allowJs: true
|
||||
// @checkJs: true
|
||||
// @Filename: /foo.ts
|
||||
export const A = 1;
|
||||
export type B = { x: number };
|
||||
export type C = 1;
|
||||
export class D { y: string }
|
||||
// @Filename: /test.js
|
||||
/**
|
||||
* @import { A, D, C } from "./foo"
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param { typeof A } a
|
||||
* @param { B/**/ | C } b
|
||||
* @param { C } c
|
||||
* @param { D } d
|
||||
*/
|
||||
export function f(a, b, c, d) { }`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.GoToMarker(t, "")
|
||||
f.VerifyImportFixAtPosition(t, []string{
|
||||
`/**
|
||||
* @import { A, D, C, B } from "./foo"
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param { typeof A } a
|
||||
* @param { B | C } b
|
||||
* @param { C } c
|
||||
* @param { D } d
|
||||
*/
|
||||
export function f(a, b, c, d) { }`,
|
||||
}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportModuleNone2"
|
||||
|
||||
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 TestAutoImportModuleNone2(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: none
|
||||
// @moduleResolution: bundler
|
||||
// @target: es2015
|
||||
// @Filename: /node_modules/dep/index.d.ts
|
||||
export const x: number;
|
||||
// @Filename: /index.ts
|
||||
x/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
|
||||
IsIncomplete: false,
|
||||
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
||||
CommitCharacters: &DefaultCommitCharacters,
|
||||
EditRange: Ignored,
|
||||
},
|
||||
Items: &fourslash.CompletionsExpectedItems{
|
||||
Includes: []fourslash.CompletionsExpectedItem{
|
||||
&lsproto.CompletionItem{
|
||||
Label: "x",
|
||||
Data: &lsproto.CompletionItemData{
|
||||
AutoImport: &lsproto.AutoImportFix{
|
||||
ModuleSpecifier: "dep",
|
||||
},
|
||||
},
|
||||
AdditionalTextEdits: fourslash.AnyTextEdits,
|
||||
SortText: new(string(ls.SortTextAutoImportSuggestions)),
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
f.ReplaceLine(t, 0, "import { x } from 'dep'; x;")
|
||||
f.VerifyNonSuggestionDiagnostics(t, nil)
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportNodeModuleSymlinkRenamed"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportNodeModuleSymlinkRenamed(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: /home/src/workspaces/solution/package.json
|
||||
{
|
||||
"name": "monorepo",
|
||||
"workspaces": ["packages/*"]
|
||||
}
|
||||
// @Filename: /home/src/workspaces/solution/packages/utils/package.json
|
||||
{
|
||||
"name": "utils",
|
||||
"version": "1.0.0",
|
||||
"exports": "./dist/index.js"
|
||||
}
|
||||
// @Filename: /home/src/workspaces/solution/packages/utils/tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["es5"],
|
||||
"composite": true,
|
||||
"module": "nodenext",
|
||||
"rootDir": "src",
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
// @Filename: /home/src/workspaces/solution/packages/utils/src/index.ts
|
||||
export function gainUtility() { return 0; }
|
||||
// @Filename: /home/src/workspaces/solution/packages/web/package.json
|
||||
{
|
||||
"name": "web",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"@monorepo/utils": "file:../utils"
|
||||
}
|
||||
}
|
||||
// @Filename: /home/src/workspaces/solution/packages/web/tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["es5"],
|
||||
"composite": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "bundler",
|
||||
"rootDir": "src",
|
||||
"outDir": "dist",
|
||||
"emitDeclarationOnly": true
|
||||
},
|
||||
"include": ["src"],
|
||||
"references": [
|
||||
{ "path": "../utils" }
|
||||
]
|
||||
}
|
||||
// @Filename: /home/src/workspaces/solution/packages/web/src/index.ts
|
||||
gainUtility/**/
|
||||
// @link: /home/src/workspaces/solution/packages/utils -> /home/src/workspaces/solution/node_modules/utils
|
||||
// @link: /home/src/workspaces/solution/packages/utils -> /home/src/workspaces/solution/node_modules/@monorepo/utils
|
||||
// @link: /home/src/workspaces/solution/packages/web -> /home/src/workspaces/solution/node_modules/web`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.MarkTestAsStradaServer()
|
||||
f.GoToMarker(t, "")
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"@monorepo/utils"}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportNodeNextJSRequire"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportNodeNextJSRequire(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: node18
|
||||
// @allowJs: true
|
||||
// @checkJs: true
|
||||
// @noEmit: true
|
||||
// @Filename: /matrix.js
|
||||
exports.variants = [];
|
||||
// @Filename: /main.js
|
||||
exports.dedupeLines = data => {
|
||||
variants/**/
|
||||
}
|
||||
// @Filename: /totally-irrelevant-no-way-this-changes-things-right.js
|
||||
export default 0;`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.GoToFile(t, "/main.js")
|
||||
f.VerifyImportFixAtPosition(t, []string{
|
||||
`const { variants } = require("./matrix")
|
||||
|
||||
exports.dedupeLines = data => {
|
||||
variants
|
||||
}`,
|
||||
}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPackageJsonExportsSpecifierEndsInTs"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportPackageJsonExportsSpecifierEndsInTs(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: node18
|
||||
// @Filename: /node_modules/pkg/package.json
|
||||
{
|
||||
"name": "pkg",
|
||||
"version": "1.0.0",
|
||||
"exports": {
|
||||
"./something.ts": "./a.js"
|
||||
}
|
||||
}
|
||||
// @Filename: /node_modules/pkg/a.d.ts
|
||||
export function foo(): void;
|
||||
// @Filename: /package.json
|
||||
{
|
||||
"dependencies": {
|
||||
"pkg": "*"
|
||||
}
|
||||
}
|
||||
// @Filename: /index.ts
|
||||
foo/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"pkg/something.ts"}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPackageJsonFilterExistingImport2"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportPackageJsonFilterExistingImport2(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @lib: es5
|
||||
// @module: preserve
|
||||
// @Filename: /home/src/workspaces/project/node_modules/@types/react/index.d.ts
|
||||
export declare function useMemo(): void;
|
||||
export declare function useState(): void;
|
||||
// @Filename: /home/src/workspaces/project/package.json
|
||||
{}
|
||||
// @Filename: /home/src/workspaces/project/index.ts
|
||||
useMemo/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.MarkTestAsStradaServer()
|
||||
f.GoToMarker(t, "")
|
||||
f.VerifyImportFixAtPosition(t, []string{}, nil /*preferences*/)
|
||||
f.GoToBOF(t)
|
||||
f.InsertLine(t, "import { useState } from \"react\";")
|
||||
f.GoToMarker(t, "")
|
||||
f.VerifyImportFixAtPosition(t, []string{
|
||||
`import { useMemo, useState } from "react";
|
||||
useMemo`,
|
||||
}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPackageJsonFilterExistingImport3"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportPackageJsonFilterExistingImport3(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: /home/src/workspaces/project/tsconfig.json
|
||||
{ "compilerOptions": { "lib": ["es5"], "module": "preserve", "types": ["*"] } }
|
||||
// @Filename: /home/src/workspaces/project/node_modules/@types/node/index.d.ts
|
||||
declare module "node:fs" {
|
||||
export function readFile(): void;
|
||||
export function writeFile(): void;
|
||||
}
|
||||
// @Filename: /home/src/workspaces/project/package.json
|
||||
{}
|
||||
// @Filename: /home/src/workspaces/project/index.ts
|
||||
readFile/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.MarkTestAsStradaServer()
|
||||
f.GoToMarker(t, "")
|
||||
f.VerifyImportFixAtPosition(t, []string{}, nil /*preferences*/)
|
||||
f.GoToBOF(t)
|
||||
f.InsertLine(t, "import { writeFile } from \"node:fs\";")
|
||||
f.GoToMarker(t, "")
|
||||
f.VerifyImportFixAtPosition(t, []string{
|
||||
`import { readFile, writeFile } from "node:fs";
|
||||
readFile`,
|
||||
}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPackageJsonImportsCaseSensitivity"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/ls/lsutil"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportPackageJsonImportsCaseSensitivity(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: node18
|
||||
// @allowImportingTsExtensions: true
|
||||
// @Filename: /package.json
|
||||
{
|
||||
"type": "module",
|
||||
"imports": {
|
||||
"#src/*": "./SRC/*"
|
||||
}
|
||||
}
|
||||
// @Filename: /src/add.ts
|
||||
export function add(a: number, b: number) {}
|
||||
// @Filename: /src/index.ts
|
||||
add/*imports*/;`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "imports", []string{"#src/add.ts"}, &lsutil.UserPreferences{ImportModuleSpecifierPreference: "non-relative"})
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPackageJsonImportsConditions"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportPackageJsonImportsConditions(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: node18
|
||||
// @Filename: /package.json
|
||||
{
|
||||
"imports": {
|
||||
"#thing": {
|
||||
"types": { "import": "./types-esm/thing.d.mts", "require": "./types/thing.d.ts" },
|
||||
"default": { "import": "./esm/thing.mjs", "require": "./dist/thing.js" }
|
||||
}
|
||||
}
|
||||
}
|
||||
// @Filename: /src/.ts
|
||||
something/*a*/
|
||||
// @Filename: /types/thing.d.ts
|
||||
export function something(name: string): any;`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "a", []string{"#thing"}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPackageJsonImportsLength1"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportPackageJsonImportsLength1(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: node18
|
||||
// @Filename: /package.json
|
||||
{
|
||||
"imports": {
|
||||
"#*": "./src/*.ts"
|
||||
}
|
||||
}
|
||||
// @Filename: /src/a/b/c/something.ts
|
||||
export function something(name: string): any;
|
||||
// @Filename: /src/a/b/c/d.ts
|
||||
something/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"./something"}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPackageJsonImportsLength2"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportPackageJsonImportsLength2(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: node18
|
||||
// @Filename: /package.json
|
||||
{
|
||||
"imports": {
|
||||
"#*": "./src/*.ts"
|
||||
}
|
||||
}
|
||||
// @Filename: /src/a/b/c/something.ts
|
||||
export function something(name: string): any;
|
||||
// @Filename: /a.ts
|
||||
something/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"#a/b/c/something"}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPackageJsonImportsPattern_js"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportPackageJsonImportsPattern_js(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: node18
|
||||
// @Filename: /package.json
|
||||
{
|
||||
"imports": {
|
||||
"#*": "./src/*.js"
|
||||
}
|
||||
}
|
||||
// @Filename: /src/something.ts
|
||||
export function something(name: string): any;
|
||||
// @Filename: /a.ts
|
||||
something/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"#something"}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPackageJsonImportsPattern_js_ts"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportPackageJsonImportsPattern_js_ts(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: node18
|
||||
// @Filename: /package.json
|
||||
{
|
||||
"imports": {
|
||||
"#*.js": "./src/*.ts"
|
||||
}
|
||||
}
|
||||
// @Filename: /src/something.ts
|
||||
export function something(name: string): any;
|
||||
// @Filename: /a.ts
|
||||
something/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"#something.js"}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPackageJsonImportsPattern"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportPackageJsonImportsPattern(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: node18
|
||||
// @Filename: /package.json
|
||||
{
|
||||
"imports": {
|
||||
"#*": "./src/*"
|
||||
}
|
||||
}
|
||||
// @Filename: /src/something.ts
|
||||
export function something(name: string): any;
|
||||
// @Filename: /a.ts
|
||||
something/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"#something.js"}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPackageJsonImportsPattern_ts_js"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportPackageJsonImportsPattern_ts_js(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: node18
|
||||
// @Filename: /package.json
|
||||
{
|
||||
"imports": {
|
||||
"#*.ts": "./src/*.js"
|
||||
}
|
||||
}
|
||||
// @Filename: /src/something.ts
|
||||
export function something(name: string): any;
|
||||
// @Filename: /a.ts
|
||||
something/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"#something.ts"}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPackageJsonImportsPattern_ts"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportPackageJsonImportsPattern_ts(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: node18
|
||||
// @Filename: /package.json
|
||||
{
|
||||
"imports": {
|
||||
"#*": "./src/*.ts"
|
||||
}
|
||||
}
|
||||
// @Filename: /src/something.ts
|
||||
export function something(name: string): any;
|
||||
// @Filename: /a.ts
|
||||
something/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"#something"}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPackageJsonImportsPattern_ts_ts"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportPackageJsonImportsPattern_ts_ts(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: node18
|
||||
// @Filename: /package.json
|
||||
{
|
||||
"imports": {
|
||||
"#*.ts": "./src/*.ts"
|
||||
}
|
||||
}
|
||||
// @Filename: /src/something.ts
|
||||
export function something(name: string): any;
|
||||
// @Filename: /a.ts
|
||||
something/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"#something.ts"}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPackageJsonImportsPreference1"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/ls/lsutil"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportPackageJsonImportsPreference1(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: node18
|
||||
// @Filename: /package.json
|
||||
{
|
||||
"imports": {
|
||||
"#*": "./src/*.ts"
|
||||
}
|
||||
}
|
||||
// @Filename: /src/a/b/c/something.ts
|
||||
export function something(name: string): any;
|
||||
// @Filename: /a.ts
|
||||
something/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"./src/a/b/c/something"}, &lsutil.UserPreferences{ImportModuleSpecifierPreference: "relative"})
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPackageJsonImportsPreference2"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/ls/lsutil"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportPackageJsonImportsPreference2(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: node18
|
||||
// @Filename: /package.json
|
||||
{
|
||||
"imports": {
|
||||
"#*": "./src/*.ts"
|
||||
}
|
||||
}
|
||||
// @Filename: /src/a/b/c/something.ts
|
||||
export function something(name: string): any;
|
||||
// @Filename: /a.ts
|
||||
something/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"./src/a/b/c/something"}, &lsutil.UserPreferences{ImportModuleSpecifierPreference: "project-relative"})
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPackageJsonImportsPreference3"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/ls/lsutil"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportPackageJsonImportsPreference3(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: node18
|
||||
// @Filename: /package.json
|
||||
{
|
||||
"imports": {
|
||||
"#*": "./src/*.ts"
|
||||
}
|
||||
}
|
||||
// @Filename: /src/a/b/c/something.ts
|
||||
export function something(name: string): any;
|
||||
// @Filename: /src/a/b/c/d.ts
|
||||
something/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"#a/b/c/something"}, &lsutil.UserPreferences{ImportModuleSpecifierPreference: "non-relative"})
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPackageJsonImports_capsInPath1"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportPackageJsonImports_capsInPath1(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: node18
|
||||
// @Filename: /Dev/package.json
|
||||
{
|
||||
"imports": {
|
||||
"#thing": "./src/something.js"
|
||||
}
|
||||
}
|
||||
// @Filename: /Dev/src/something.ts
|
||||
export function something(name: string): any;
|
||||
// @Filename: /Dev/a.ts
|
||||
something/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"#thing"}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPackageJsonImports_capsInPath2"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportPackageJsonImports_capsInPath2(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: node18
|
||||
// @Filename: /Dev/package.json
|
||||
{
|
||||
"imports": {
|
||||
"#thing/*": "./src/*.js"
|
||||
}
|
||||
}
|
||||
// @Filename: /Dev/src/something.ts
|
||||
export function something(name: string): any;
|
||||
// @Filename: /Dev/a.ts
|
||||
something/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"#thing/something"}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPackageJsonImports_js"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportPackageJsonImports_js(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: node18
|
||||
// @Filename: /package.json
|
||||
{
|
||||
"imports": {
|
||||
"#thing": "./src/something.js"
|
||||
}
|
||||
}
|
||||
// @Filename: /src/something.ts
|
||||
export function something(name: string): any;
|
||||
// @Filename: /a.ts
|
||||
something/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"#thing"}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPackageJsonImports_ts"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportPackageJsonImports_ts(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @module: node18
|
||||
// @Filename: /package.json
|
||||
{
|
||||
"imports": {
|
||||
"#thing": "./src/something.ts"
|
||||
}
|
||||
}
|
||||
// @Filename: /src/something.ts
|
||||
export function something(name: string): any;
|
||||
// @Filename: /a.ts
|
||||
something/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"#thing"}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPackageRootPath"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportPackageRootPath(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @allowJs: true
|
||||
// @Filename: /node_modules/pkg/package.json
|
||||
{
|
||||
"name": "pkg",
|
||||
"version": "1.0.0",
|
||||
"main": "lib",
|
||||
"module": "lib"
|
||||
}
|
||||
// @Filename: /node_modules/pkg/lib/index.js
|
||||
export function foo() {};
|
||||
// @Filename: /package.json
|
||||
{
|
||||
"dependencies": {
|
||||
"pkg": "*"
|
||||
}
|
||||
}
|
||||
// @Filename: /index.ts
|
||||
foo/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"pkg"}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPathsAliasesAndBarrels"
|
||||
|
||||
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 TestAutoImportPathsAliasesAndBarrels(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: /tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"paths": {
|
||||
"~/*": ["src/*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
// @Filename: /src/dirA/index.ts
|
||||
export * from "./thing1A";
|
||||
export * from "./thing2A";
|
||||
// @Filename: /src/dirA/thing1A.ts
|
||||
export class Thing1A {}
|
||||
Thing/**/
|
||||
// @Filename: /src/dirA/thing2A.ts
|
||||
export class Thing2A {}
|
||||
// @Filename: /src/dirB/index.ts
|
||||
export * from "./thing1B";
|
||||
export * from "./thing2B";
|
||||
// @Filename: /src/dirB/thing1B.ts
|
||||
export class Thing1B {}
|
||||
// @Filename: /src/dirB/thing2B.ts
|
||||
export class Thing2B {}`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
|
||||
IsIncomplete: false,
|
||||
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
|
||||
CommitCharacters: &DefaultCommitCharacters,
|
||||
EditRange: Ignored,
|
||||
},
|
||||
Items: &fourslash.CompletionsExpectedItems{
|
||||
Includes: []fourslash.CompletionsExpectedItem{
|
||||
&lsproto.CompletionItem{
|
||||
Label: "Thing2A",
|
||||
Data: &lsproto.CompletionItemData{
|
||||
AutoImport: &lsproto.AutoImportFix{
|
||||
ModuleSpecifier: "./thing2A",
|
||||
},
|
||||
},
|
||||
AdditionalTextEdits: fourslash.AnyTextEdits,
|
||||
SortText: new(string(ls.SortTextAutoImportSuggestions)),
|
||||
},
|
||||
&lsproto.CompletionItem{
|
||||
Label: "Thing1B",
|
||||
Data: &lsproto.CompletionItemData{
|
||||
AutoImport: &lsproto.AutoImportFix{
|
||||
ModuleSpecifier: "~/dirB",
|
||||
},
|
||||
},
|
||||
AdditionalTextEdits: fourslash.AnyTextEdits,
|
||||
SortText: new(string(ls.SortTextAutoImportSuggestions)),
|
||||
},
|
||||
&lsproto.CompletionItem{
|
||||
Label: "Thing2B",
|
||||
Data: &lsproto.CompletionItemData{
|
||||
AutoImport: &lsproto.AutoImportFix{
|
||||
ModuleSpecifier: "~/dirB",
|
||||
},
|
||||
},
|
||||
AdditionalTextEdits: fourslash.AnyTextEdits,
|
||||
SortText: new(string(ls.SortTextAutoImportSuggestions)),
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPathsConfigDir"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportPathsConfigDir(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
"@root/*": ["${configDir}/src/*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
// @Filename: src/one.ts
|
||||
export const one = 1;
|
||||
// @Filename: src/foo/two.ts
|
||||
one/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"@root/one"}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPathsNodeModules"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportPathsNodeModules(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "amd",
|
||||
"moduleResolution": "node",
|
||||
"rootDir": "ts",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"*": ["node_modules/@woltlab/wcf/ts/*"]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"ts",
|
||||
"node_modules/@woltlab/wcf/ts",
|
||||
]
|
||||
}
|
||||
// @Filename: node_modules/@woltlab/wcf/ts/WoltLabSuite/Core/Component/Dialog.ts
|
||||
export class Dialog {}
|
||||
// @Filename: ts/main.ts
|
||||
Dialog/**/`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"WoltLabSuite/Core/Component/Dialog"}, nil /*preferences*/)
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPaths"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/ls/lsutil"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportPaths(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: /package1/jsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
checkJs: true,
|
||||
"paths": {
|
||||
"package1/*": ["./*"],
|
||||
"package2/*": ["../package2/*"]
|
||||
},
|
||||
"baseUrl": "."
|
||||
},
|
||||
"include": [
|
||||
".",
|
||||
"../package2"
|
||||
]
|
||||
}
|
||||
// @Filename: /package1/file1.js
|
||||
bar/**/
|
||||
// @Filename: /package2/file1.js
|
||||
export const bar = 0;`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.VerifyImportFixModuleSpecifiers(t, "", []string{"package2/file1"}, &lsutil.UserPreferences{ImportModuleSpecifierPreference: "shortest"})
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// Code generated by convertFourslash; DO NOT EDIT.
|
||||
// To modify this test, run "npm run makemanual autoImportPnpm"
|
||||
|
||||
package fourslash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/microsoft/typescript-go/internal/fourslash"
|
||||
"github.com/microsoft/typescript-go/internal/testutil"
|
||||
)
|
||||
|
||||
func TestAutoImportPnpm(t *testing.T) {
|
||||
fourslash.SkipIfFailing(t)
|
||||
t.Parallel()
|
||||
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
||||
const content = `// @Filename: /tsconfig.json
|
||||
{ "compilerOptions": { "module": "commonjs" } }
|
||||
// @Filename: /node_modules/.pnpm/mobx@6.0.4/node_modules/mobx/package.json
|
||||
{ "types": "dist/mobx.d.ts" }
|
||||
// @Filename: /node_modules/.pnpm/mobx@6.0.4/node_modules/mobx/dist/mobx.d.ts
|
||||
export declare function autorun(): void;
|
||||
// @Filename: /index.ts
|
||||
autorun/**/
|
||||
// @Filename: /utils.ts
|
||||
import "mobx";
|
||||
// @link: /node_modules/.pnpm/mobx@6.0.4/node_modules/mobx -> /node_modules/mobx
|
||||
// @link: /node_modules/.pnpm/mobx@6.0.4/node_modules/mobx -> /node_modules/.pnpm/cool-mobx-dependent@1.2.3/node_modules/mobx`
|
||||
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
||||
defer done()
|
||||
f.GoToMarker(t, "")
|
||||
f.VerifyImportFixAtPosition(t, []string{
|
||||
`import { autorun } from "mobx";
|
||||
|
||||
autorun`,
|
||||
}, nil /*preferences*/)
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user