Added tests for syntactic context.
This commit is contained in:
parent
53a0f2374a
commit
a3b2237437
36
tests/cases/fourslash/signatureHelpFilteredTriggers02.ts
Normal file
36
tests/cases/fourslash/signatureHelpFilteredTriggers02.ts
Normal file
|
@ -0,0 +1,36 @@
|
|||
/// <reference path="fourslash.ts" />
|
||||
|
||||
////function foo<T>(x: T): T {
|
||||
//// throw null;
|
||||
////}
|
||||
////
|
||||
////foo(/*1*/"");
|
||||
////foo(` ${100/*2*/}`);
|
||||
////foo(/*3*/);
|
||||
////foo(100 /*4*/)
|
||||
////foo([/*5*/])
|
||||
////foo({ hello: "hello"/*6*/})
|
||||
|
||||
const charMap = {
|
||||
1: "(",
|
||||
2: ",",
|
||||
3: "(",
|
||||
4: "<",
|
||||
5: ",",
|
||||
6: ",",
|
||||
}
|
||||
|
||||
for (const markerName of Object.keys(charMap)) {
|
||||
const triggerCharacter = charMap[markerName];
|
||||
goTo.marker(markerName);
|
||||
edit.insert(triggerCharacter);
|
||||
verify.noSignatureHelpForTriggerReason({
|
||||
kind: "characterTyped",
|
||||
triggerCharacter,
|
||||
});
|
||||
verify.signatureHelpPresentForTriggerReason({
|
||||
kind: "retrigger",
|
||||
triggerCharacter,
|
||||
});
|
||||
edit.backspace(triggerCharacter.length);
|
||||
}
|
23
tests/cases/fourslash/signatureHelpFilteredTriggers03.ts
Normal file
23
tests/cases/fourslash/signatureHelpFilteredTriggers03.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
/// <reference path="fourslash.ts" />
|
||||
|
||||
////declare class ViewJayEss {
|
||||
//// constructor(obj: object);
|
||||
////}
|
||||
////new ViewJayEss({
|
||||
//// methods: {
|
||||
//// sayHello/**/
|
||||
//// }
|
||||
////});
|
||||
|
||||
goTo.marker();
|
||||
edit.insert("(");
|
||||
verify.noSignatureHelpForTriggerReason({
|
||||
kind: "characterTyped",
|
||||
triggerCharacter: "(",
|
||||
});
|
||||
|
||||
edit.insert(") {},");
|
||||
verify.noSignatureHelpForTriggerReason({
|
||||
kind: "characterTyped",
|
||||
triggerCharacter: ",",
|
||||
});
|
31
tests/cases/fourslash/signatureHelpWithTriggers01.ts
Normal file
31
tests/cases/fourslash/signatureHelpWithTriggers01.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
/// <reference path="fourslash.ts" />
|
||||
|
||||
////declare function foo<T>(x: T, y: T): T;
|
||||
////
|
||||
////foo/*1*//*2*/;
|
||||
////foo(/*3*/100/*4*/);
|
||||
////foo/*5*//*6*/();
|
||||
|
||||
const charMap = {
|
||||
1: "(",
|
||||
2: "<",
|
||||
3: ",",
|
||||
4: ",",
|
||||
5: "(",
|
||||
6: "<",
|
||||
}
|
||||
|
||||
for (const markerName of Object.keys(charMap)) {
|
||||
const triggerCharacter = charMap[markerName];
|
||||
goTo.marker(markerName);
|
||||
edit.insert(triggerCharacter);
|
||||
verify.signatureHelpPresentForTriggerReason({
|
||||
kind: "characterTyped",
|
||||
triggerCharacter,
|
||||
});
|
||||
verify.signatureHelpPresentForTriggerReason({
|
||||
kind: "retrigger",
|
||||
triggerCharacter,
|
||||
});
|
||||
edit.backspace(triggerCharacter.length);
|
||||
}
|
38
tests/cases/fourslash/signatureHelpWithTriggers02.ts
Normal file
38
tests/cases/fourslash/signatureHelpWithTriggers02.ts
Normal file
|
@ -0,0 +1,38 @@
|
|||
/// <reference path="fourslash.ts" />
|
||||
|
||||
////declare function foo<T>(x: T, y: T): T;
|
||||
////declare function bar<U>(x: U, y: U): U;
|
||||
////
|
||||
////foo(bar/*1*/)
|
||||
|
||||
goTo.marker("1");
|
||||
|
||||
edit.insert("(");
|
||||
verify.signatureHelp({
|
||||
text: "bar<U>(x: U, y: U): U",
|
||||
triggerReason: {
|
||||
kind: "characterTyped",
|
||||
triggerCharacter: "(",
|
||||
}
|
||||
});
|
||||
edit.backspace();
|
||||
|
||||
edit.insert("<");
|
||||
verify.signatureHelp({
|
||||
text: "bar<U>(x: U, y: U): U",
|
||||
triggerReason: {
|
||||
kind: "characterTyped",
|
||||
triggerCharacter: "(",
|
||||
}
|
||||
});
|
||||
edit.backspace();
|
||||
|
||||
edit.insert(",");
|
||||
verify.signatureHelp({
|
||||
text: "foo(x: <U>(x: U, y: U) => U, y: <U>(x: U, y: U) => U): <U>(x: U, y: U) => U",
|
||||
triggerReason: {
|
||||
kind: "characterTyped",
|
||||
triggerCharacter: "(",
|
||||
}
|
||||
});
|
||||
edit.backspace();
|
Loading…
Reference in a new issue