Recognize more "cannot find name" error code variations for codefixes (#56335)

This commit is contained in:
Andrew Branch 2023-11-07 11:42:06 -08:00 committed by GitHub
parent 27556f5d3b
commit 649e614496
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 0 deletions

View File

@ -163,6 +163,16 @@ const errorCodes: readonly number[] = [
Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here.code,
Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer.code,
Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code,
Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery.code,
Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_1_or_later.code,
Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom.code,
Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig.code,
Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function.code,
Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig.code,
Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha.code,
Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode.code,
Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig.code,
Diagnostics.Cannot_find_namespace_0_Did_you_mean_1.code,
];
registerCodeFix({

View File

@ -0,0 +1,15 @@
/// <reference path="fourslash.ts" />
// @module: esnext
// @moduleResolution: bundler
// @Filename: /node_modules/qwik/index.d.ts
//// export declare const $: any;
// @Filename: /index.ts
//// import {} from "qwik";
//// $/**/
goTo.marker("");
verify.importFixAtPosition([`import { $ } from "qwik";
$`]);