mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-27 23:58:38 -06:00
stubbing extra completions
This commit is contained in:
parent
bf48564cc8
commit
ba80ce63ad
@ -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 "";
|
||||
}
|
||||
|
||||
@ -0,0 +1,44 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// 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.');
|
||||
}
|
||||
`);
|
||||
@ -0,0 +1,18 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// 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.');
|
||||
}
|
||||
`);
|
||||
@ -0,0 +1,18 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// 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.');
|
||||
}
|
||||
`);
|
||||
@ -0,0 +1,18 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// 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.');
|
||||
}
|
||||
`);
|
||||
@ -0,0 +1,18 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// 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.');
|
||||
}
|
||||
`);
|
||||
@ -0,0 +1,30 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// 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");
|
||||
}
|
||||
`);
|
||||
Loading…
x
Reference in New Issue
Block a user