-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(26217): Add missing member fix should work for missing function (#…
…41215) * feat(26217): Add missing function declaration QF * use codeFixAvailable instead of codeFix * add diagnostics messages 'Method not implemented.' and 'Function not implemented.' * use codeFixAvailable instead of codeFix * fix signature types
- Loading branch information
1 parent
66ba15a
commit 0c58ede
Showing
28 changed files
with
590 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
tests/cases/fourslash/codeFixAddMissingFunctionDeclaration1.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
////foo(); | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"], | ||
newFileContent: | ||
`foo(); | ||
function foo() { | ||
throw new Error("Function not implemented."); | ||
} | ||
` | ||
}); |
22 changes: 22 additions & 0 deletions
22
tests/cases/fourslash/codeFixAddMissingFunctionDeclaration10.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
////namespace Foo { | ||
//// export const x = 0; | ||
////} | ||
//// | ||
////Foo.test<string, number>(); | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "test"], | ||
newFileContent: | ||
`namespace Foo { | ||
export const x = 0; | ||
export function test<T, U>() { | ||
throw new Error("Function not implemented."); | ||
} | ||
} | ||
Foo.test<string, number>();` | ||
}); |
23 changes: 23 additions & 0 deletions
23
tests/cases/fourslash/codeFixAddMissingFunctionDeclaration11.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @filename: /test.ts | ||
////export const x = 1; | ||
|
||
// @filename: /foo.ts | ||
////import * as test from "./test"; | ||
////test.foo(); | ||
|
||
goTo.file("/foo.ts"); | ||
verify.codeFix({ | ||
index: 0, | ||
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"], | ||
newFileContent: { | ||
"/test.ts": | ||
`export const x = 1; | ||
export function foo() { | ||
throw new Error("Function not implemented."); | ||
} | ||
` | ||
} | ||
}); |
28 changes: 28 additions & 0 deletions
28
tests/cases/fourslash/codeFixAddMissingFunctionDeclaration12.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @filename: /test.ts | ||
////export const x = 1; | ||
|
||
// @filename: /foo.ts | ||
////import * as test from "./test"; | ||
////test.foo(); | ||
////test.foo(); | ||
////test.foo(); | ||
|
||
goTo.file("/foo.ts"); | ||
verify.codeFix({ | ||
index: 0, | ||
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"], | ||
applyChanges: true, | ||
newFileContent: { | ||
"/test.ts": | ||
`export const x = 1; | ||
export function foo() { | ||
throw new Error("Function not implemented."); | ||
} | ||
` | ||
} | ||
}); | ||
|
||
verify.not.codeFixAvailable(); |
23 changes: 23 additions & 0 deletions
23
tests/cases/fourslash/codeFixAddMissingFunctionDeclaration13.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @filename: /test.ts | ||
////export const x = 1; | ||
|
||
// @filename: /foo.ts | ||
////import * as test from "./test"; | ||
////test.foo(1, "", { x: 1, y: 1 }); | ||
|
||
goTo.file("/foo.ts"); | ||
verify.codeFix({ | ||
index: 0, | ||
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"], | ||
newFileContent: { | ||
"/test.ts": | ||
`export const x = 1; | ||
export function foo(arg0: number, arg1: string, arg2: { x: number; y: number; }) { | ||
throw new Error("Function not implemented."); | ||
} | ||
` | ||
} | ||
}); |
23 changes: 23 additions & 0 deletions
23
tests/cases/fourslash/codeFixAddMissingFunctionDeclaration14.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @filename: /test.ts | ||
////export const x = 1; | ||
|
||
// @filename: /foo.ts | ||
////import * as test from "./test"; | ||
////const foo: string = test.foo(); | ||
|
||
goTo.file("/foo.ts"); | ||
verify.codeFix({ | ||
index: 0, | ||
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"], | ||
newFileContent: { | ||
"/test.ts": | ||
`export const x = 1; | ||
export function foo(): string { | ||
throw new Error("Function not implemented."); | ||
} | ||
` | ||
} | ||
}); |
23 changes: 23 additions & 0 deletions
23
tests/cases/fourslash/codeFixAddMissingFunctionDeclaration15.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @filename: /test.ts | ||
////export const x = 1; | ||
|
||
// @filename: /foo.ts | ||
////import * as test from "./test"; | ||
////test.foo<string, number>(); | ||
|
||
goTo.file("/foo.ts"); | ||
verify.codeFix({ | ||
index: 0, | ||
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"], | ||
newFileContent: { | ||
"/test.ts": | ||
`export const x = 1; | ||
export function foo<T, U>() { | ||
throw new Error("Function not implemented."); | ||
} | ||
` | ||
} | ||
}); |
12 changes: 12 additions & 0 deletions
12
tests/cases/fourslash/codeFixAddMissingFunctionDeclaration16.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @moduleResolution: node | ||
// @filename: /node_modules/test/index.js | ||
////export const x = 1; | ||
|
||
// @filename: /foo.ts | ||
////import * as test from "test"; | ||
////test.foo(); | ||
|
||
goTo.file("/foo.ts"); | ||
verify.not.codeFixAvailable(); |
22 changes: 22 additions & 0 deletions
22
tests/cases/fourslash/codeFixAddMissingFunctionDeclaration2.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
////foo(); | ||
////foo(); | ||
////foo(); | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"], | ||
applyChanges: true, | ||
newFileContent: | ||
`foo(); | ||
foo(); | ||
foo(); | ||
function foo() { | ||
throw new Error("Function not implemented."); | ||
} | ||
` | ||
}); | ||
|
||
verify.not.codeFixAvailable(); |
15 changes: 15 additions & 0 deletions
15
tests/cases/fourslash/codeFixAddMissingFunctionDeclaration3.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
////foo(1, "", { x: 1, y: 1 }); | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"], | ||
newFileContent: | ||
`foo(1, "", { x: 1, y: 1 }); | ||
function foo(arg0: number, arg1: string, arg2: { x: number; y: number; }) { | ||
throw new Error("Function not implemented."); | ||
} | ||
` | ||
}); |
15 changes: 15 additions & 0 deletions
15
tests/cases/fourslash/codeFixAddMissingFunctionDeclaration4.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
////const test: string = foo(); | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"], | ||
newFileContent: | ||
`const test: string = foo(); | ||
function foo(): string { | ||
throw new Error("Function not implemented."); | ||
} | ||
` | ||
}); |
Oops, something went wrong.