Skip to content
Merged
2 changes: 0 additions & 2 deletions internal/fourslash/_scripts/failingTests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ TestAutoImportSortCaseSensitivity1
TestAutoImportTypeImport4
TestAutoImportTypeOnlyPreferred3
TestAutoImportVerbatimTypeOnly1
TestCalledUnionsOfDissimilarTyeshaveGoodDisplay
Comment thread
jakebailey marked this conversation as resolved.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where did TestQualifyModuleTypeNames go?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm running these tests again to check

TestCloduleTypeOf1
TestCodeCompletionEscaping
TestCodeFixAddParameterNames1
Expand Down Expand Up @@ -338,7 +337,6 @@ TestNoQuickInfoForLabel
TestNoQuickInfoInWhitespace
TestOverloadQuickInfo
TestProtoVarVisibleWithOuterScopeUnderscoreProto
TestQualifyModuleTypeNames
TestQuickfixImplementInterfaceUnreachableTypeUsesRelativeImport
TestQuickInfo_notInsideComment
TestQuickinfo01
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package fourslash_test

import (
"testing"

"github.com/microsoft/typescript-go/internal/fourslash"
"github.com/microsoft/typescript-go/internal/lsp/lsproto"
"github.com/microsoft/typescript-go/internal/testutil"
)

func TestJsDocDontBreakWithNamespacesVS(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @allowJs: true
// @Filename: jsDocDontBreakWithNamespaces.js
/**
* @returns {module:@nodefuel/web~Webserver~wsServer#hello} Websocket server object
*/
function foo() { }
foo(''/*foo*/);

/**
* @type {module:xxxxx} */
*/
function bar() { }
bar(''/*bar*/);

/** @type {function(module:xxxx, module:xxxx): module:xxxxx} */
function zee() { }
zee(''/*zee*/);`
f, done := fourslash.NewFourslash(t, &lsproto.ClientCapabilities{VSSupportsVisualStudioExtensions: new(true)}, content)
defer done()
f.VerifyBaselineSignatureHelp(t)
}
32 changes: 32 additions & 0 deletions internal/fourslash/tests/manual/jsDocFunctionSignatures5VS_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package fourslash_test

import (
"testing"

"github.com/microsoft/typescript-go/internal/fourslash"
"github.com/microsoft/typescript-go/internal/lsp/lsproto"
"github.com/microsoft/typescript-go/internal/testutil"
)

func TestJsDocFunctionSignatures5VS(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @strict: true
// @allowJs: true
// @Filename: Foo.js
/**
* Filters a path based on a regexp or glob pattern.
* @param {String} basePath The base path where the search will be performed.
* @param {String} pattern A string defining a regexp of a glob pattern.
* @param {String} type The search pattern type, can be a regexp or a glob.
* @param {Object} options A object containing options to the search.
* @return {Array} A list containing the filtered paths.
*/
function pathFilter(basePath, pattern, type, options){
//...
}
pathFilter(/**/'foo', 'bar', 'baz', {});`
f, done := fourslash.NewFourslash(t, &lsproto.ClientCapabilities{VSSupportsVisualStudioExtensions: new(true)}, content)
defer done()
f.VerifyBaselineSignatureHelp(t)
}
27 changes: 27 additions & 0 deletions internal/fourslash/tests/manual/jsDocFunctionSignatures6VS_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package fourslash_test

import (
"testing"

"github.com/microsoft/typescript-go/internal/fourslash"
"github.com/microsoft/typescript-go/internal/lsp/lsproto"
"github.com/microsoft/typescript-go/internal/testutil"
)

func TestJsDocFunctionSignatures6VS(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @allowJs: true
// @Filename: Foo.js
/**
* @param {string} p1 - A string param
* @param {string?} p2 - An optional param
* @param {string} [p3] - Another optional param
* @param {string} [p4="test"] - An optional param with a default value
*/
function f1(p1, p2, p3, p4){}
f1(/*1*/'foo', /*2*/'bar', /*3*/'baz', /*4*/'qux');`
f, done := fourslash.NewFourslash(t, &lsproto.ClientCapabilities{VSSupportsVisualStudioExtensions: new(true)}, content)
defer done()
f.VerifyBaselineSignatureHelp(t)
}
29 changes: 29 additions & 0 deletions internal/fourslash/tests/manual/jsdocReturnsTagVS_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package fourslash_test

import (
"testing"

"github.com/microsoft/typescript-go/internal/fourslash"
"github.com/microsoft/typescript-go/internal/lsp/lsproto"
"github.com/microsoft/typescript-go/internal/testutil"
)

func TestJsdocReturnsTagVS(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @allowJs: true
// @Filename: dummy.js
/**
* Find an item
* @template T
* @param {T[]} l
* @param {T} x
* @returns {?T} The names of the found item(s).
*/
function find(l, x) {
}
find(''/**/);`
f, done := fourslash.NewFourslash(t, &lsproto.ClientCapabilities{VSSupportsVisualStudioExtensions: new(true)}, content)
defer done()
f.VerifyBaselineSignatureHelp(t)
}
42 changes: 42 additions & 0 deletions internal/fourslash/tests/manual/quickInfoJsDocTags13VS_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package fourslash_test

import (
"testing"

"github.com/microsoft/typescript-go/internal/fourslash"
"github.com/microsoft/typescript-go/internal/lsp/lsproto"
"github.com/microsoft/typescript-go/internal/testutil"
)

func TestQuickInfoJsDocTags13VS(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @allowJs: true
// @checkJs: true
// @filename: ./a.js
/**
* First overload
* @overload
* @param {number} a
* @returns {void}
*/

/**
* Second overload
* @overload
* @param {string} a
* @returns {void}
*/

/**
* @param {string | number} a
* @returns {void}
*/
function f(a) {}

f(/*a*/1);
f(/*b*/"");`
f, done := fourslash.NewFourslash(t, &lsproto.ClientCapabilities{VSSupportsVisualStudioExtensions: new(true)}, content)
defer done()
f.VerifyBaselineSignatureHelp(t)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package fourslash_test

import (
"testing"

"github.com/microsoft/typescript-go/internal/fourslash"
"github.com/microsoft/typescript-go/internal/lsp/lsproto"
"github.com/microsoft/typescript-go/internal/testutil"
)

func TestQuickInfoJsDocTextFormatting1VS(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `/**
* @param {number} var1 **Highlighted text**
* @param {string} var2 Another **Highlighted text**
*/
function f1(var1, var2) { }

/**
* @param {number} var1 *Regular text with an asterisk
* @param {string} var2 Another *Regular text with an asterisk
*/
function f2(var1, var2) { }

/**
* @param {number} var1
* *Regular text with an asterisk
* @param {string} var2
* Another *Regular text with an asterisk
*/
function f3(var1, var2) { }

/**
* @param {number} var1
* **Highlighted text**
* @param {string} var2
* Another **Highlighted text**
*/
function f4(var1, var2) { }

/**
* @param {number} var1
**Highlighted text**
* @param {string} var2
Another **Highlighted text**
*/
function f5(var1, var2) { }

f1(/*1*/);
f2(/*2*/);
f3(/*3*/);
f4(/*4*/);
f5(/*5*/);`
f, done := fourslash.NewFourslash(t, &lsproto.ClientCapabilities{VSSupportsVisualStudioExtensions: new(true)}, content)
defer done()
f.VerifyBaselineSignatureHelp(t)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package fourslash_test

import (
"testing"

"github.com/microsoft/typescript-go/internal/fourslash"
"github.com/microsoft/typescript-go/internal/lsp/lsproto"
"github.com/microsoft/typescript-go/internal/testutil"
)

func TestSignatureHelpAfterParameterVS(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `type Type = (a, b, c) => void
const a: Type = (a/*1*/, b/*2*/) => {}
const b: Type = function (a/*3*/, b/*4*/) {}
const c: Type = ({ /*5*/a: { b/*6*/ }}/*7*/ = { }/*8*/, [b/*9*/]/*10*/, .../*11*/c/*12*/) => {}`
f, done := fourslash.NewFourslash(t, &lsproto.ClientCapabilities{VSSupportsVisualStudioExtensions: new(true)}, content)
defer done()
f.VerifyBaselineSignatureHelp(t)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package fourslash_test

import (
"testing"

"github.com/microsoft/typescript-go/internal/fourslash"
"github.com/microsoft/typescript-go/internal/lsp/lsproto"
"github.com/microsoft/typescript-go/internal/testutil"
)

func TestSignatureHelpAnonymousTypeVS(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `const comparers: Array<(a: any, b: any) => boolean> = [];

comparers.push((a,/**/ b) => true);`
f, done := fourslash.NewFourslash(t, &lsproto.ClientCapabilities{VSSupportsVisualStudioExtensions: new(true)}, content)
defer done()
f.VerifyBaselineSignatureHelp(t)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package fourslash_test

import (
"testing"

"github.com/microsoft/typescript-go/internal/fourslash"
"github.com/microsoft/typescript-go/internal/lsp/lsproto"
"github.com/microsoft/typescript-go/internal/testutil"
)

func TestSignatureHelpBindingPatternVS(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `
/**
* @param options An empty object binding pattern.
*/
function emptyObj({}) {}
emptyObj(/*emptyObj*/)

/**
* @param items An empty array binding pattern.
*/
function emptyArr([]) {}
emptyArr(/*emptyArr*/)

/**
* @param param An object with a and b properties.
*/
function nonEmptyObj({a, b}: {a: number, b: string}) {}
nonEmptyObj(/*nonEmptyObj*/)

/**
* @param tuple A tuple with two elements.
*/
function nonEmptyArr([x, y]: [number, string]) {}
nonEmptyArr(/*nonEmptyArr*/)

/**
* @param first The first number parameter.
* @param second An object with a and b properties.
*/
function idLeading(first: number, {a, b}: {a: number, b: string}) {}
idLeading(123/*idLeading*/, { a: 1, b: 2 }/*bindingTrailing*/)

/**
* @param first An object with a and b properties.
* @param last The last number parameter.
*/
function bindingLeading({a, b}: {a: number, b: string}, last: number) {}
bindingLeading(/*bindingLeading*/{ a: 1, b: 2 }, 123 /*idTrailing*/)

/**
* @param param1 {Object} The first parameter
* @param param1.a {number} Comment a
* @param param1.b {string} Comment b
* @param param2 {Object} The second parameter
* @param param2.c {boolean} Comment c
* @param param2.d {unknown} Comment d
*/
function multipleBindings({ a, b }, { c, d }) {}
multipleBindings({ a: 0, b: "" }/*firstObjParam*/, { c: true, d: "" }/*secondObjParam*/)
`
f, done := fourslash.NewFourslash(t, &lsproto.ClientCapabilities{VSSupportsVisualStudioExtensions: new(true)}, content)
defer done()
f.VerifyBaselineSignatureHelp(t)
}
Loading
Loading