Skip to content

Commit ba80ce6

Browse files
author
Arthur Ozga
committed
stubbing extra completions
1 parent bf48564 commit ba80ce6

7 files changed

+161
-0
lines changed

src/services/codefixes/helpers.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ namespace ts.codefix {
2828
}
2929
const node = declarations[0];
3030
const visibility = getVisibilityPrefix(getModifierFlags(node));
31+
let getOrSetPrefix: string = undefined;
3132
switch (node.kind) {
3233
case SyntaxKind.PropertySignature:
3334
case SyntaxKind.PropertyDeclaration:
@@ -44,6 +45,20 @@ namespace ts.codefix {
4445
const sigString = checker.signatureToString(signatures[0], enclosingDeclaration, TypeFormatFlags.SuppressAnyReturnType, SignatureKind.Call);
4546

4647
return `${visibility}${name}${sigString}${getMethodBodyStub(newlineChar)}`;
48+
case SyntaxKind.GetAccessor:
49+
getOrSetPrefix = "get";
50+
case SyntaxKind.SetAccessor:
51+
getOrSetPrefix = getOrSetPrefix ? getOrSetPrefix : "set";
52+
53+
throw new Error('Not implemented, getter and setter.');
54+
case SyntaxKind.ComputedPropertyName:
55+
if (hasDynamicName(node)) {
56+
return "";
57+
}
58+
throw new Error('Not implemented, computed property name.');
59+
case SyntaxKind.IndexSignature:
60+
throw new Error('Not implemented.');
61+
4762
default:
4863
return "";
4964
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
//// namespace N1 {
4+
//// export interface I1 {
5+
//// f1():string;
6+
//// }
7+
//// }
8+
//// interface I1 {
9+
//// f1();
10+
//// }
11+
////
12+
//// class C1 implements N1.I1 {[|
13+
//// |]}
14+
15+
let passcode = "secret passcode";
16+
17+
abstract class A {
18+
private _a: string;
19+
20+
abstract get a(): string;
21+
abstract set a(newName: string);
22+
}
23+
24+
class B extends A {
25+
a: string;
26+
}
27+
28+
29+
abstract class AA {
30+
private _a: string;
31+
32+
abstract get a(): string {
33+
return this._a;
34+
}
35+
36+
abstract set a(newName: string) {
37+
this._a = newName;
38+
}
39+
}
40+
41+
verify.rangeAfterCodeFix(`f1(): string{
42+
throw new Error('Method not implemented.');
43+
}
44+
`);
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
//// namespace N1 {
4+
//// export interface I1 {
5+
//// f1():string;
6+
//// }
7+
//// }
8+
//// interface I1 {
9+
//// f1();
10+
//// }
11+
////
12+
//// class C1 implements N1.I1 {[|
13+
//// |]}
14+
15+
verify.rangeAfterCodeFix(`f1(): string{
16+
throw new Error('Method not implemented.');
17+
}
18+
`);
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
//// namespace N1 {
4+
//// export interface I1 {
5+
//// f1():string;
6+
//// }
7+
//// }
8+
//// interface I1 {
9+
//// f1();
10+
//// }
11+
////
12+
//// class C1 implements N1.I1 {[|
13+
//// |]}
14+
15+
verify.rangeAfterCodeFix(`f1(): string{
16+
throw new Error('Method not implemented.');
17+
}
18+
`);
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
//// namespace N1 {
4+
//// export interface I1 {
5+
//// f1():string;
6+
//// }
7+
//// }
8+
//// interface I1 {
9+
//// f1();
10+
//// }
11+
////
12+
//// class C1 implements N1.I1 {[|
13+
//// |]}
14+
15+
verify.rangeAfterCodeFix(`f1(): string{
16+
throw new Error('Method not implemented.');
17+
}
18+
`);
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
//// namespace N1 {
4+
//// export interface I1 {
5+
//// f1():string;
6+
//// }
7+
//// }
8+
//// interface I1 {
9+
//// f1();
10+
//// }
11+
////
12+
//// class C1 implements N1.I1 {[|
13+
//// |]}
14+
15+
verify.rangeAfterCodeFix(`f1(): string{
16+
throw new Error('Method not implemented.');
17+
}
18+
`);
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
//// namespace N1 {
4+
//// export interface I1 {
5+
//// f1():string;
6+
//// }
7+
//// }
8+
//// interface I1 {
9+
//// f1();
10+
//// }
11+
////
12+
//// class C1 implements N1.I1 {[|
13+
//// |]}
14+
15+
//// interface I {
16+
//// method(a: number, b: string): boolean;
17+
//// method(a: string, b: number): Function;
18+
//// method(a: string): Function;
19+
//// }
20+
////
21+
//// class C implements I {[| |]}
22+
23+
verify.rangeAfterCodeFix(`
24+
method(a: number, b: string): boolean;
25+
method(a: string, b: number): Function;
26+
method(a: string): Function;
27+
method(a: number | string, b?: string | number): boolean | Function {
28+
throw new Error("Method not implemented");
29+
}
30+
`);

0 commit comments

Comments
 (0)