-
Notifications
You must be signed in to change notification settings - Fork 12.9k
feat(26217): Add missing member fix should work for missing function #41215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
dc448f9
feat(26217): Add missing function declaration QF
a-tarasyuk f3be16e
use codeFixAvailable instead of codeFix
a-tarasyuk f322ed6
add diagnostics messages 'Method not implemented.' and 'Function not …
a-tarasyuk 570493f
use codeFixAvailable instead of codeFix
a-tarasyuk fa994b7
Merge branch 'master' of https://github.com/microsoft/TypeScript into…
a-tarasyuk 3aec1be
fix signature types
a-tarasyuk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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."); | ||
} | ||
` | ||
}); |
15 changes: 15 additions & 0 deletions
15
tests/cases/fourslash/codeFixAddMissingFunctionDeclaration5.ts
This file contains hidden or 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<string, number>(); | ||
|
||
verify.codeFix({ | ||
index: 0, | ||
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"], | ||
newFileContent: | ||
`foo<string, number>(); | ||
|
||
function foo<T, U>() { | ||
throw new Error("Function not implemented."); | ||
} | ||
` | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.