From aa8f557d5e2ceb3c87b87c3930dae7159def265a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20B=C3=BChler?= Date: Wed, 28 Jun 2017 23:51:39 +0200 Subject: [PATCH] fix(code action): implement interface or abstract adds optionals (#233) * remove the need of abstract in implement * fix bug in serializing of objects * changelog * add the abstract check again * add an optional param --- CHANGELOG.md | 4 ++++ src/common/ts-parsing/declarations/MethodDeclaration.ts | 2 +- .../codeActionExtension/implementInterfaceOrAbstract.ts | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a88faf..eb4c24e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +#### Fixed +- Some abstract methods were not implemented from interfaces +- Optional parameters are implemented now ([#141](https://github.com/buehler/typescript-hero/issues/141)) + #### Removed - The document view, since there is a command `cmd+shift+o` that basically does the same, but better diff --git a/src/common/ts-parsing/declarations/MethodDeclaration.ts b/src/common/ts-parsing/declarations/MethodDeclaration.ts index 341772f..c87e96e 100644 --- a/src/common/ts-parsing/declarations/MethodDeclaration.ts +++ b/src/common/ts-parsing/declarations/MethodDeclaration.ts @@ -18,7 +18,7 @@ import { CompletionItemKind } from 'vscode-languageserver-types'; */ @Serializable({ factory: (json) => { - const obj = new MethodDeclaration(json.name, json.isExported, json.visibility, json.type, json.start, json.end); + const obj = new MethodDeclaration(json.name, json.isAbstract, json.visibility, json.type, json.start, json.end); obj.parameters = json.parameters; obj.variables = json.variables; return obj; diff --git a/test/_workspace/extension/extensions/codeActionExtension/implementInterfaceOrAbstract.ts b/test/_workspace/extension/extensions/codeActionExtension/implementInterfaceOrAbstract.ts index a40e725..33bf0f8 100644 --- a/test/_workspace/extension/extensions/codeActionExtension/implementInterfaceOrAbstract.ts +++ b/test/_workspace/extension/extensions/codeActionExtension/implementInterfaceOrAbstract.ts @@ -29,7 +29,7 @@ interface GenericInterface { abstract class GenericAbstractClass { public abstract abstractMethod(p1: T1): T2; - protected abstract protMethod(p2: T2, p3: T3); + protected abstract protMethod(p2: T2, p3?: T3); } class ImplementGenericInterface implements GenericInterface {