spadgos / sublime-jsdocs

Simplifies writing DocBlock comments in Javascript, PHP, CoffeeScript, Actionscript, C & C++
MIT License
3.11k stars 278 forks source link

Reparse comment block not working #289

Open MickeyKay opened 10 years ago

MickeyKay commented 10 years ago

I have the following PHP comment block:

/**
 * @param string var1 My description.
 * @param array longervarname My description.
 * @param boolean areallylongvariablename My description.
 */

I'd like to be able to reparse this entire PHP comment to align all components of each @param tags, like so:

/**
 * @param string  var1                    My description.
 * @param array   longervarname           My description.
 * @param boolean areallylongvariablename My description.
 */

It sounds like the "Reparse comment block" command should do the trick, but when I select the comment block and run the command (either via the keyboard combo or Command Palette > DocBlockr: Reparse comment block), nothing happens and I still have the original alignment. I ran the command with the console open and don't see any error or warning messages. My user settings are below for reference.

DocBlockr does do this proper indenting if I type /** + TAB before a function with multiple parameters, however I can't seem to figure out how to reparse an existing comment block to reindent everything. Is this functionality working for anyone else?

My user settings:

{
  // If true, when in a docblock, pressing tab after a @tag line (like @param, @return)
  // will indent to the description. This is useful if you are writing a long description
  // and want that block of text to stay aligned.
  "jsdocs_deep_indent": true,

  // If true, then pressing enter while in a double-slash comment (like this one)
  // will automatically add two slashes to the next line as well
  "jsdocs_extend_double_slash": true,

  // the number of spaces to add after the leading *
  "jsdocs_indentation_spaces": 1,

  // The number of spaces to add after the leading * in lines under the first line of each
  // paragraph. This is only used together with automatic line wrapping. For example, a value
  // of 3 might look like this:
  //
  // /**
  //  * Duis sed arcu non tellus eleifend ullamcorper quis non erat. Curabitur
  //  *   metus elit, ultrices et tristique a, blandit at justo.
  //  * @param  {String} foo Lorem ipsum dolor sit amet.
  //  * @param  {Number} bar Nullam fringilla feugiat pretium. Quisque
  //  *   consectetur, risus eu pellentesque tincidunt, nulla ipsum imperdiet
  //  *   massa, sit amet adipiscing dolor.
  //  * @return {[Type]}
  //  */
  "jsdocs_indentation_spaces_same_para": 1,

  // whether the words following the @tags should align.
  // Possible values are 'no', 'shallow', 'deep'
  // For backwards compatibility, false is equivalent to 'no', true is equivalent to 'shallow'
  //
  // 'shallow' will just align the first words after the tag. eg:
  // @param    {MyCustomClass} myVariable desc1
  // @return   {String} foo desc2
  // @property {Number} blahblah desc3
  //
  // 'deep' will align each component of the tags, eg:
  // @param    {MyCustomClass} myVariable desc1
  // @return   {String}        foo        desc2
  // @property {Number}        blahblah   desc3
  "jsdocs_align_tags": "deep",

  // Any additional boilerplate tags which should be added to each block. Should be an array of strings.
  // Note that this only applies when a docblock is opened directly preceding a function.
  // Tab points can be added by using snippet syntax, eg: ${1:default text}
  "jsdocs_extra_tags": [],
  //"jsdocs_extra_tags": ["", "@package ${1:WP Hotkeys}", "@since ${2:1.0.0}", ""],

  // If extra tags are defined, by default they go between the description and the param/return tags. If this is set to
  // true, the extra tags are placed at the very end.
  "jsdocs_extra_tags_go_after": false,

  // A map to determine the value of variables, should hungarian notation (or similar) be in use
  "jsdocs_notation_map": [],

  // Since there seems to be no agreed standard for "@return" or "@returns", use this setting to rename it as you wish.
  "jsdocs_return_tag": "@return",

  // Add a '[description]' placeholder for the return tag?
  "jsdocs_return_description": true,

  // Add a '[description]' placeholder for the param tag?
  "jsdocs_param_description": true,

  // Whether there should be blank lines added between the description line, and between tags of different types.
  // Possible values are true, false, or "after_description".
  // If true, the output might look like this:
  //
  // /**
  //  * [description]
  //  *
  //  * @param  {String} foo
  //  * @param  {Number} bar
  //  *
  //  * @return {[Type]}
  //  */
  //
  // If "after_description" is configured, a blank line is only added between the description and the first tag, but not
  // between different tag sections, so the output, in that case, might look like this:
  //
  // /**
  //  * [description]
  //  *
  //  * @param  {String} foo
  //  * @param  {Number} bar
  //  * @return {[Type]}
  //  */
  "jsdocs_spacer_between_sections": true,

  // Whether each section should be indented to the same level, or indent each one individually.
  // (When true, the @param section will lose the extra space immediately after each '@param').
  "jsdocs_per_section_indent": true,

  // Minimum spaces between cols (default is 1). For example, a value
  // of 2 might look like this:
  //
  // /**
  //  * Duis sed arcu non tellus eleifend ullamcorper quis non erat. Curabitur
  //  *
  //  * @param   {String}  foo  Lorem ipsum dolor sit amet.
  //  * @param   {Number}  bar  Nullam fringilla feugiat pretium. Quisque
  //  *
  //  * @return  {[Type]}       description
  //  */
  "jsdocs_min_spaces_between_columns": 1,

  // indicates whether the @method tag should be added automatically
  "jsdocs_autoadd_method_tag": false,

  // If set to true, DocBlockr won't parse any code, providing no default templates. All other functions work as normal.
  "jsdocs_simple_mode": false,

  // If set to true, primitives such as "Number" and "String" will be documented as "number" and "string".
  "jsdocs_lower_case_primitives": false,

  // If set to true, primitives such as "boolean" and "integer" will be shortened to "bool" and "int".
  "jsdocs_short_primitives": false,

  // This property affects the default tag added to `var` declarations in Javascript/Coffeescript. If `false`, the
  // default is used ("var"), otherwise it can be set to any String, eg: "property"
  "jsdocs_override_js_var": false,

  // If set to true, an extra line break is added after the end of a docblock to separate it from the code.
  "jsdocs_newline_after_block": false,

  "jsdocs_development_mode": false
}
MickeyKay commented 8 years ago

Hello hello?

AndrewMast commented 5 years ago

I know this is an old issue, but I am answering this for anybody else who has the question. The functionality of the "reparse comment block" does not work like that. It simply reparses the unedited fields so you hit tab to move through the fields.

@spadgos This issue should be closed. Maybe the "reparse comment block" terminology should be changed to avoid confusion? Maybe "reactivate unedited fields"?