Prioritize spelling fix over add-missing-member fix (#23268)
This commit is contained in:
parent
998beadba2
commit
98a5e5cc0d
5 changed files with 38 additions and 4 deletions
|
@ -1,11 +1,14 @@
|
|||
// Fixes higher in this list will be first in the array returned by `getCodeFixesAtPosition`.
|
||||
|
||||
/// <reference path="addMissingInvocationForDecorator.ts" />
|
||||
/// <reference path="annotateWithTypeFromJSDoc.ts" />
|
||||
/// <reference path="convertFunctionToEs6Class.ts" />
|
||||
/// <reference path="convertToEs6Module.ts" />
|
||||
/// <reference path="correctQualifiedNameToIndexedAccessType.ts" />
|
||||
/// <reference path="fixClassIncorrectlyImplementsInterface.ts" />
|
||||
/// <reference path="fixAddMissingMember.ts" />
|
||||
/// <reference path="importFixes.ts" />
|
||||
/// <reference path="fixSpelling.ts" />
|
||||
/// <reference path="fixAddMissingMember.ts" />
|
||||
/// <reference path="fixCannotFindModule.ts" />
|
||||
/// <reference path="fixClassDoesntImplementInheritedAbstractMember.ts" />
|
||||
/// <reference path="fixClassSuperMustPrecedeThisAccess.ts" />
|
||||
|
@ -15,7 +18,6 @@
|
|||
/// <reference path='fixUnusedIdentifier.ts' />
|
||||
/// <reference path='fixJSDocTypes.ts' />
|
||||
/// <reference path='fixAwaitInSyncFunction.ts' />
|
||||
/// <reference path='importFixes.ts' />
|
||||
/// <reference path='disableJsDiagnostics.ts' />
|
||||
/// <reference path='helpers.ts' />
|
||||
/// <reference path='inferFromUsage.ts' />
|
||||
|
|
|
@ -12,4 +12,4 @@ verify.rangeAfterCodeFix(`class C {
|
|||
doStuff() {
|
||||
this.state;
|
||||
}
|
||||
}`, /*includeWhiteSpace*/false, /*errorCode*/ undefined, /*index*/ 2);
|
||||
}`, /*includeWhiteSpace*/false, /*errorCode*/ undefined, /*index*/ 0);
|
||||
|
|
16
tests/cases/fourslash/codeFixSpellingVsImport.ts
Normal file
16
tests/cases/fourslash/codeFixSpellingVsImport.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Tests that the import fix is returned first.
|
||||
|
||||
// @Filename: /a.ts
|
||||
////export const foo = 0;
|
||||
|
||||
// @Filename: /b.ts
|
||||
////const foof = 0;
|
||||
////foo;
|
||||
|
||||
goTo.file("/b.ts");
|
||||
verify.codeFixAvailable([
|
||||
{ description: `Import 'foo' from module "./a"` },
|
||||
{ description: "Change spelling to 'foof'" },
|
||||
]);
|
16
tests/cases/fourslash/codeFixSpellingVsMissingMember.ts
Normal file
16
tests/cases/fourslash/codeFixSpellingVsMissingMember.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Tests that the spelling fix is returned first.
|
||||
|
||||
////class C {
|
||||
//// foof: number;
|
||||
//// method() {
|
||||
//// this.foo = 10;
|
||||
//// }
|
||||
////}
|
||||
|
||||
verify.codeFixAvailable([
|
||||
{ description: "Change spelling to 'foof'" },
|
||||
{ description: "Declare property \'foo\'" },
|
||||
{ description: "Add index signature for property 'foo'" },
|
||||
]);
|
|
@ -48,7 +48,7 @@ verify.codeFix({
|
|||
|
||||
verify.codeFix({
|
||||
description: "Declare static property 'prop2'",
|
||||
index: 0,
|
||||
index: 1, // fix at index 0 is to change the spelling to 'prop1'
|
||||
newRangeContent: `
|
||||
static prop2: string;
|
||||
static prop1: number;
|
||||
|
|
Loading…
Reference in a new issue