Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed gathering comments in LitElement component #101

Closed
yveslange opened this issue Sep 10, 2019 · 2 comments
Closed

Failed gathering comments in LitElement component #101

yveslange opened this issue Sep 10, 2019 · 2 comments

Comments

@yveslange
Copy link

yveslange commented Sep 10, 2019

The comment is not added to the resulting markdown output.

☠ Failing usecase:
» file: src/first-compo.js

import { html, css, LitElement } from 'lit-element';

@customElement('first-compo')
export class FirstCompo extends LitElement {
  static get properties() {
    return {
      /**
       * This is my comment for the property `foo`
       */
      foo: {
        type: String,
      },
    };
  }

constructor()  {
  this.foo = "init foo";
}

✓ Working usecase 1:

  static get properties() {
    return {
      /**
       * This is my comment for the property `foo`
       */
      foo: {
        type: String,
      },
    };
  }

constructor()  {
  // initialization removed
}

Here the This is my comment for the property foo will be used

✓ Working usecase 2:

  static get properties() {
    return {
      /**
       * This is my comment for the property `foo`
       */
      foo: {
        type: String,
      },
    };
  }

constructor()  {
   /**
     * My comment for foo in the constructor
     */
   this.foo = "something"
}

Here, the My comment for foo in the constructor will be used

It seems that if

  • there is no initialization (this.foo = ...) in the constructor of a property, the comment of the properties is added correctly
  • there is the comment in the constructor, the comment from the constructor is added correctly and the comment of the properties is ignored.
  • there is a comment in the properties and an initialization without a comment, the comment is not added at all

I would suggest to use the comment from the properties instead of nothing.

@runem
Copy link
Owner

runem commented Dec 12, 2019

Version 1.0.0 which has just been published parses jsdoc inside static get properties() { 🎉 Thanks for opening this issue 👍

@runem runem closed this as completed Dec 12, 2019
@yveslange
Copy link
Author

Works thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants