Skip to content

Draft: Add codefix scaffold for undeclared private method #61643

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/services/codefixes/addMissingMethod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import * as ts from "../../_namespaces/ts";

Check failure on line 1 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 20 on macos-latest

Cannot find module '../../_namespaces/ts' or its corresponding type declarations.

Check failure on line 1 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / typecheck

Cannot find module '../../_namespaces/ts' or its corresponding type declarations.

Check failure on line 1 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 22 on ubuntu-latest

Cannot find module '../../_namespaces/ts' or its corresponding type declarations.

Check failure on line 1 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 20 on ubuntu-latest

Cannot find module '../../_namespaces/ts' or its corresponding type declarations.

Check failure on line 1 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 18 on macos-latest

Cannot find module '../../_namespaces/ts' or its corresponding type declarations.

Check failure on line 1 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / smoke

Cannot find module '../../_namespaces/ts' or its corresponding type declarations.

Check failure on line 1 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 16 on macos-latest

Cannot find module '../../_namespaces/ts' or its corresponding type declarations.

Check failure on line 1 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 22 on macos-latest

Cannot find module '../../_namespaces/ts' or its corresponding type declarations.

Check failure on line 1 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node lts/* on ubuntu-latest with --no-bundle

Cannot find module '../../_namespaces/ts' or its corresponding type declarations.

Check failure on line 1 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 18 on ubuntu-latest

Cannot find module '../../_namespaces/ts' or its corresponding type declarations.

Check failure on line 1 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 16 on ubuntu-latest

Cannot find module '../../_namespaces/ts' or its corresponding type declarations.

Check failure on line 1 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / lint

This relative module reference is missing a '.js' extension

Check failure on line 1 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / lint

This import relatively references another project; did you mean to import from a local _namespace module?

Check failure on line 1 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / self-check

Cannot find module '../../_namespaces/ts' or its corresponding type declarations.

Check failure on line 1 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 14 on ubuntu-latest

Cannot find module '../../_namespaces/ts' or its corresponding type declarations.

Check failure on line 1 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 22 on windows-latest

Cannot find module '../../_namespaces/ts' or its corresponding type declarations.

Check failure on line 1 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 20 on windows-latest

Cannot find module '../../_namespaces/ts' or its corresponding type declarations.

Check failure on line 1 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 18 on windows-latest

Cannot find module '../../_namespaces/ts' or its corresponding type declarations.

Check failure on line 1 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 16 on windows-latest

Cannot find module '../../_namespaces/ts' or its corresponding type declarations.

Check failure on line 1 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 14 on windows-latest

Cannot find module '../../_namespaces/ts' or its corresponding type declarations.

Check failure on line 1 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / browser-integration

Cannot find module '../../_namespaces/ts' or its corresponding type declarations.

Check failure on line 1 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / coverage

Cannot find module '../../_namespaces/ts' or its corresponding type declarations.
import {
createCodeFixAction,
registerCodeFix,
CodeFixContext,
textChanges,
} from "../_utils";

Check failure on line 7 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 20 on macos-latest

Cannot find module '../_utils' or its corresponding type declarations.

Check failure on line 7 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / typecheck

Cannot find module '../_utils' or its corresponding type declarations.

Check failure on line 7 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 22 on ubuntu-latest

Cannot find module '../_utils' or its corresponding type declarations.

Check failure on line 7 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 20 on ubuntu-latest

Cannot find module '../_utils' or its corresponding type declarations.

Check failure on line 7 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 18 on macos-latest

Cannot find module '../_utils' or its corresponding type declarations.

Check failure on line 7 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / smoke

Cannot find module '../_utils' or its corresponding type declarations.

Check failure on line 7 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 16 on macos-latest

Cannot find module '../_utils' or its corresponding type declarations.

Check failure on line 7 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 22 on macos-latest

Cannot find module '../_utils' or its corresponding type declarations.

Check failure on line 7 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node lts/* on ubuntu-latest with --no-bundle

Cannot find module '../_utils' or its corresponding type declarations.

Check failure on line 7 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 18 on ubuntu-latest

Cannot find module '../_utils' or its corresponding type declarations.

Check failure on line 7 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 16 on ubuntu-latest

Cannot find module '../_utils' or its corresponding type declarations.

Check failure on line 7 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / lint

This relative module reference is missing a '.js' extension

Check failure on line 7 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / self-check

Cannot find module '../_utils' or its corresponding type declarations.

Check failure on line 7 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 14 on ubuntu-latest

Cannot find module '../_utils' or its corresponding type declarations.

Check failure on line 7 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 22 on windows-latest

Cannot find module '../_utils' or its corresponding type declarations.

Check failure on line 7 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 20 on windows-latest

Cannot find module '../_utils' or its corresponding type declarations.

Check failure on line 7 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 18 on windows-latest

Cannot find module '../_utils' or its corresponding type declarations.

Check failure on line 7 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 16 on windows-latest

Cannot find module '../_utils' or its corresponding type declarations.

Check failure on line 7 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 14 on windows-latest

Cannot find module '../_utils' or its corresponding type declarations.

Check failure on line 7 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / browser-integration

Cannot find module '../_utils' or its corresponding type declarations.

Check failure on line 7 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / coverage

Cannot find module '../_utils' or its corresponding type declarations.

const fixName = "addMissingPrivateMethod";

registerCodeFix({
errorCodes: [],
getCodeActions: function getCodeActionsToAddPrivateMethod(context: CodeFixContext) {
const changes = textChanges.ChangeTracker.with(context, t => {

Check failure on line 14 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 20 on macos-latest

Parameter 't' implicitly has an 'any' type.

Check failure on line 14 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / typecheck

Parameter 't' implicitly has an 'any' type.

Check failure on line 14 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 22 on ubuntu-latest

Parameter 't' implicitly has an 'any' type.

Check failure on line 14 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 20 on ubuntu-latest

Parameter 't' implicitly has an 'any' type.

Check failure on line 14 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 18 on macos-latest

Parameter 't' implicitly has an 'any' type.

Check failure on line 14 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / smoke

Parameter 't' implicitly has an 'any' type.

Check failure on line 14 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 16 on macos-latest

Parameter 't' implicitly has an 'any' type.

Check failure on line 14 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 22 on macos-latest

Parameter 't' implicitly has an 'any' type.

Check failure on line 14 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node lts/* on ubuntu-latest with --no-bundle

Parameter 't' implicitly has an 'any' type.

Check failure on line 14 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 18 on ubuntu-latest

Parameter 't' implicitly has an 'any' type.

Check failure on line 14 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 16 on ubuntu-latest

Parameter 't' implicitly has an 'any' type.

Check failure on line 14 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / self-check

Parameter 't' implicitly has an 'any' type.

Check failure on line 14 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 14 on ubuntu-latest

Parameter 't' implicitly has an 'any' type.

Check failure on line 14 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 22 on windows-latest

Parameter 't' implicitly has an 'any' type.

Check failure on line 14 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 20 on windows-latest

Parameter 't' implicitly has an 'any' type.

Check failure on line 14 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 18 on windows-latest

Parameter 't' implicitly has an 'any' type.

Check failure on line 14 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 16 on windows-latest

Parameter 't' implicitly has an 'any' type.

Check failure on line 14 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / Test Node 14 on windows-latest

Parameter 't' implicitly has an 'any' type.

Check failure on line 14 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / browser-integration

Parameter 't' implicitly has an 'any' type.

Check failure on line 14 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / coverage

Parameter 't' implicitly has an 'any' type.
t.insertNodeAtEndOfFile(context.sourceFile, ts.factory.createExpressionStatement(
ts.factory.createStringLiteral("Placeholder fix for missing private method")
));
});

return [createCodeFixAction(fixName, changes, "Add missing private method", fixName, undefined)];

Check failure on line 20 in src/services/codefixes/addMissingMethod.ts

View workflow job for this annotation

GitHub Actions / lint

Tag argument with parameter name
},
});
Loading