diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts
index bcab7d59b37..3c06ae6288f 100644
--- a/src/services/codefixes/helpers.ts
+++ b/src/services/codefixes/helpers.ts
@@ -28,6 +28,7 @@ namespace ts.codefix {
}
const node = declarations[0];
const visibility = getVisibilityPrefix(getModifierFlags(node));
+ let getOrSetPrefix: string = undefined;
switch (node.kind) {
case SyntaxKind.PropertySignature:
case SyntaxKind.PropertyDeclaration:
@@ -44,6 +45,20 @@ namespace ts.codefix {
const sigString = checker.signatureToString(signatures[0], enclosingDeclaration, TypeFormatFlags.SuppressAnyReturnType, SignatureKind.Call);
return `${visibility}${name}${sigString}${getMethodBodyStub(newlineChar)}`;
+ case SyntaxKind.GetAccessor:
+ getOrSetPrefix = "get";
+ case SyntaxKind.SetAccessor:
+ getOrSetPrefix = getOrSetPrefix ? getOrSetPrefix : "set";
+
+ throw new Error('Not implemented, getter and setter.');
+ case SyntaxKind.ComputedPropertyName:
+ if (hasDynamicName(node)) {
+ return "";
+ }
+ throw new Error('Not implemented, computed property name.');
+ case SyntaxKind.IndexSignature:
+ throw new Error('Not implemented.');
+
default:
return "";
}
diff --git a/tests/cases/fourslash/codeFixUnImplementedClassMissingAbstractGettersAndSetters.ts b/tests/cases/fourslash/codeFixUnImplementedClassMissingAbstractGettersAndSetters.ts
new file mode 100644
index 00000000000..5540b20cfb9
--- /dev/null
+++ b/tests/cases/fourslash/codeFixUnImplementedClassMissingAbstractGettersAndSetters.ts
@@ -0,0 +1,44 @@
+///
+
+//// namespace N1 {
+//// export interface I1 {
+//// f1():string;
+//// }
+//// }
+//// interface I1 {
+//// f1();
+//// }
+////
+//// class C1 implements N1.I1 {[|
+//// |]}
+
+let passcode = "secret passcode";
+
+abstract class A {
+ private _a: string;
+
+ abstract get a(): string;
+ abstract set a(newName: string);
+}
+
+class B extends A {
+ a: string;
+}
+
+
+abstract class AA {
+ private _a: string;
+
+ abstract get a(): string {
+ return this._a;
+ }
+
+ abstract set a(newName: string) {
+ this._a = newName;
+ }
+}
+
+verify.rangeAfterCodeFix(`f1(): string{
+ throw new Error('Method not implemented.');
+}
+`);
diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (3).ts b/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (3).ts
new file mode 100644
index 00000000000..f81dea49782
--- /dev/null
+++ b/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (3).ts
@@ -0,0 +1,18 @@
+///
+
+//// namespace N1 {
+//// export interface I1 {
+//// f1():string;
+//// }
+//// }
+//// interface I1 {
+//// f1();
+//// }
+////
+//// class C1 implements N1.I1 {[|
+//// |]}
+
+verify.rangeAfterCodeFix(`f1(): string{
+ throw new Error('Method not implemented.');
+}
+`);
diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (4).ts b/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (4).ts
new file mode 100644
index 00000000000..f81dea49782
--- /dev/null
+++ b/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (4).ts
@@ -0,0 +1,18 @@
+///
+
+//// namespace N1 {
+//// export interface I1 {
+//// f1():string;
+//// }
+//// }
+//// interface I1 {
+//// f1();
+//// }
+////
+//// class C1 implements N1.I1 {[|
+//// |]}
+
+verify.rangeAfterCodeFix(`f1(): string{
+ throw new Error('Method not implemented.');
+}
+`);
diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (5).ts b/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (5).ts
new file mode 100644
index 00000000000..f81dea49782
--- /dev/null
+++ b/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (5).ts
@@ -0,0 +1,18 @@
+///
+
+//// namespace N1 {
+//// export interface I1 {
+//// f1():string;
+//// }
+//// }
+//// interface I1 {
+//// f1();
+//// }
+////
+//// class C1 implements N1.I1 {[|
+//// |]}
+
+verify.rangeAfterCodeFix(`f1(): string{
+ throw new Error('Method not implemented.');
+}
+`);
diff --git a/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (6).ts b/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (6).ts
new file mode 100644
index 00000000000..f81dea49782
--- /dev/null
+++ b/tests/cases/fourslash/codeFixUnImplementedInterface39 - Copy (6).ts
@@ -0,0 +1,18 @@
+///
+
+//// namespace N1 {
+//// export interface I1 {
+//// f1():string;
+//// }
+//// }
+//// interface I1 {
+//// f1();
+//// }
+////
+//// class C1 implements N1.I1 {[|
+//// |]}
+
+verify.rangeAfterCodeFix(`f1(): string{
+ throw new Error('Method not implemented.');
+}
+`);
diff --git a/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignatures.ts b/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignatures.ts
new file mode 100644
index 00000000000..a7142931eed
--- /dev/null
+++ b/tests/cases/fourslash/codeFixUnImplementedInterfaceMultipleSignatures.ts
@@ -0,0 +1,30 @@
+///
+
+//// namespace N1 {
+//// export interface I1 {
+//// f1():string;
+//// }
+//// }
+//// interface I1 {
+//// f1();
+//// }
+////
+//// class C1 implements N1.I1 {[|
+//// |]}
+
+//// interface I {
+//// method(a: number, b: string): boolean;
+//// method(a: string, b: number): Function;
+//// method(a: string): Function;
+//// }
+////
+//// class C implements I {[| |]}
+
+verify.rangeAfterCodeFix(`
+ method(a: number, b: string): boolean;
+ method(a: string, b: number): Function;
+ method(a: string): Function;
+ method(a: number | string, b?: string | number): boolean | Function {
+ throw new Error("Method not implemented");
+ }
+`);