Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Javascript comment indentation #5362

Open

Description

@weshardee

When auto indenting JS comment blocks,

/**
 *
 */

becomes:

/**
*
*/

Since the first version is a pretty common comment block pattern (used in JSDoc and YUIDoc and similar projects), it'd be great if the auto indent feature could support this indentation instead of messing with it.

Activity

  1. adamreisnz commented on May 5, 2015

    @adamreisnz

    I would call this a bug rather than an enhancement. The editor messes with the spacing when it shouldn't. If my indentation is set to tabs, then a space (the extra space on the 2nd and 3rd line of the comment block) should be treated as any other character, and not as indentation.

    Note that it also only seems to happen when pasting to the beginning of a line. When pasting where indentation is already indented, the comment block is preserved.

  2. adamreisnz commented on Jun 5, 2015

    @adamreisnz

    In the latest version of Atom, the bug is reversed. Pasting at the beginning of a line now preserves these comment blocks. Pasting with indentation however, collapses the comments as seen above. I will make some animated gifs from this behaviour, because there are more cases where it goes wrong.

  3. adamreisnz commented on Jun 10, 2015

    @adamreisnz

    Here's several examples of how things go wrong with these comment blocks:

    Example 1: wrong indentation (1 space instead of 2 spaces) directly under the comment blocks
    ex1

    Example 2: again wrong indentation when pasting something underneath the comment blocks
    ex2

    Example 3: even when correcting the indentation, upon next paste it's not respected
    ex3

    Example 4: comment block collapsing in some cases when pasted on indented lines
    ex3

    Example 5: another example of comment block collapsing when pasted on indented lines
    ex4

    @benogle @50Wliu , any chance we can have this issue reclassified as a bug?

  4. winstliu commented on Jun 10, 2015

    @winstliu
    Contributor

    Agreed, this does look like a bug.

  5. brunogaspar commented on Nov 16, 2015

    @brunogaspar

    I'm facing the same issue i believe

    Issue
    At least, this was the only relevant GH issue i could find that has somewhat the same, wrong behavior, i'm facing.

    So when i copy a comment, it adds an extra "tab" to each line, so the comment looks wrongly inserted.

  6. adamreisnz commented on Jan 1, 2016

    @adamreisnz

    This also affects moving lines of code up. They get indented one space too many when moved to under a comment block of this style.

  7. BryanDonovan commented on Apr 5, 2016

    @BryanDonovan
  8. vdeep commented on Apr 10, 2016

    @vdeep
  9. bjornwang commented on Nov 14, 2016

    @bjornwang
  10. luiseduardobrito commented on Feb 26, 2017

    @luiseduardobrito
  11. henhal commented on May 22, 2017

    @henhal
  12. 10 remaining items

  13. adamreisnz commented on May 28, 2017

    @adamreisnz

    Yes, should we extract that bug into a new issue?

  14. klarkc commented on Sep 12, 2017

    @klarkc

    +1 Problems with docblockr generated jsdoc, that is indented.

  15. nahidakbar commented on Sep 25, 2017

    @nahidakbar

    +1

    Also, when you start a comment block and press enter, it should start a new line with indented block.

    Basic documentation functionality all editors support.

  16. zhanwenchen commented on Oct 28, 2017

    @zhanwenchen
  17. Sneha-Watharkar commented on Feb 21, 2018

    @Sneha-Watharkar

    Is this issue still open?

  18. adamreisnz commented on Feb 21, 2018

    @adamreisnz

    Yes, it has never been fixed.

  19. trusktr commented on Jun 11, 2018

    @trusktr

    This makes a simple task like auto-indenting a whole file impossible.

  20. stale commented on Dec 23, 2019

    @stale

    Thanks for your contribution!

    This issue has been automatically marked as stale because it has not had recent activity. Because the Atom team treats their issues as their backlog, stale issues are closed. If you would like this issue to remain open:

    1. Verify that you can still reproduce the issue in the latest version of Atom
    2. Comment that the issue is still reproducible and include:
      • What version of Atom you reproduced the issue on
      • What OS and version you reproduced the issue on
      • What steps you followed to reproduce the issue

    Issues that are labeled as triaged will not be automatically marked as stale.

  21. added and removed on Dec 23, 2019
  22. adamreisnz commented on Dec 24, 2019

    @adamreisnz

    Of course this is still an issue, but I don't use Atom anymore so feel free to close it. Four and half years later still open, It's obviously never going to get fixed.

  23. stale commented on Dec 25, 2020

    @stale

    Thanks for your contribution!

    This issue has been automatically marked as stale because it has not had recent activity. Because the Atom team treats their issues as their backlog, stale issues are closed. If you would like this issue to remain open:

    1. Verify that you can still reproduce the issue in the latest version of Atom
    2. Comment that the issue is still reproducible and include:
      • What version of Atom you reproduced the issue on
      • What OS and version you reproduced the issue on
      • What steps you followed to reproduce the issue

    Issues that are labeled as triaged will not be automatically marked as stale.

  24. added and removed on Dec 25, 2020
  25. icecream17 commented on Feb 27, 2021

    @icecream17
    Contributor

    Hmm. Maybe I'll have a go at it? Don't expect this to be fixed anytime soon though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions