coffeedoc / codo

CoffeeScript API documentation generator. It's like YARD but for CoffeeScript!
Other
625 stars 92 forks source link

Display special badge for methods overrides #219

Open bennycode opened 8 years ago

bennycode commented 8 years ago

In some programming languages like Java it is common to annotate method implementations (which come from an interface) with @override.

It would be nice if codo would also have this annotation.

Example for @override:

Interface

window.cryptobox ?= {}

class cryptobox.CryptoboxStore
  add_prekey: (key) ->
  load_prekey: (prekey_id) ->

Implementation

window.z ?= {}
z.storage ?= {}

class z.storage.EncryptionAssetStore extends cryptobox.CryptoboxStore

  constructor: (@storage_repository) ->
    @prekeys = {}

  ###
  @override
  ###
  add_prekey: (prekey) ->
    Proteus.util.TypeUtil.assert_is_instance Proteus.keys.PreKey, prekey
    serialised = prekey.serialise()
    @prekeys[prekey.key_id] = serialised

  ###
  @override
  ###
  load_prekey: (prekey_id) ->
    serialised = @prekeys[prekey_id]
    return undefined if not serialised
    return Proteus.keys.PreKey.deserialise serialised

What do you think about my idea? Or is there already an approach to handle my use case with the current codo?

inossidabile commented 8 years ago

I don't see the need to annotate something that can be extracted from source code directly.

bennycode commented 8 years ago

But this is common practice and in the end everything can be extracted from the source code so why annotating functions at all?

inossidabile commented 8 years ago

I'm ok to accept PR that leaves overriding mark based on having similarly named method in parent. With current Codo design it should be piece of cake. We will not introduce the tag - if it shows you overrides - it has to show them all. Another approach is harmful.

inossidabile commented 8 years ago

In fact I like the idea of displaying that. I'll keep it open.

E-geek commented 8 years ago

I keep this solution!