Ensure fixSpelling and importFixes still trigger on "Did you mean the instance/static member ..." (#25847)
This commit is contained in:
parent
00a64172af
commit
3d672d9550
|
@ -4,6 +4,8 @@ namespace ts.codefix {
|
|||
const errorCodes = [
|
||||
Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code,
|
||||
Diagnostics.Cannot_find_name_0_Did_you_mean_1.code,
|
||||
Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,
|
||||
Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code,
|
||||
Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_2.code,
|
||||
];
|
||||
registerCodeFix({
|
||||
|
|
|
@ -4,6 +4,8 @@ namespace ts.codefix {
|
|||
const errorCodes: ReadonlyArray<number> = [
|
||||
Diagnostics.Cannot_find_name_0.code,
|
||||
Diagnostics.Cannot_find_name_0_Did_you_mean_1.code,
|
||||
Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,
|
||||
Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code,
|
||||
Diagnostics.Cannot_find_namespace_0.code,
|
||||
Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code,
|
||||
Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here.code,
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: /a.ts
|
||||
////export const foo = 0;
|
||||
|
||||
// @Filename: /b.ts
|
||||
////const fooo = 0;
|
||||
////class C {
|
||||
//// foo: number;
|
||||
//// constructor() {[|
|
||||
|
@ -7,7 +12,14 @@
|
|||
//// |]}
|
||||
////}
|
||||
|
||||
goTo.file("/b.ts");
|
||||
verify.codeFixAvailable([
|
||||
{ description: `Import 'foo' from module "./a"` },
|
||||
{ description: "Change spelling to 'fooo'" },
|
||||
{ description: "Add 'this.' to unresolved variable" },
|
||||
]);
|
||||
verify.codeFix({
|
||||
index: 2,
|
||||
description: "Add 'this.' to unresolved variable",
|
||||
newRangeContent: `
|
||||
this.foo = 10;
|
||||
|
|
|
@ -609,7 +609,7 @@ declare namespace FourSlashInterface {
|
|||
export interface VerifyCodeFixAvailableOptions {
|
||||
readonly description: string;
|
||||
readonly actions?: ReadonlyArray<{ readonly type: string, readonly data: {} }>;
|
||||
readonly commands?: ReadonlyArray<{}?;
|
||||
readonly commands?: ReadonlyArray<{}>;
|
||||
}
|
||||
|
||||
interface VerifyNavigateToOptions {
|
||||
|
|
Loading…
Reference in a new issue