sublime-jsdocs icon indicating copy to clipboard operation
sublime-jsdocs copied to clipboard

PHP variable name is not being automatically generated, into the docblock, after type placeholder

Open sameg14 opened this issue 11 years ago • 12 comments

I noticed a pretty glaring bug here, there is no varName after [type] when you create a docblock annotation. I am using SublimeText3 on OSX Yosemite

Current Behavior

<?php

    /**
     * [addWhere description]
     * @param [type]
     * @param [type]
     * @param [type]
     * @param array
     */
    public function addWhere($column, $operator, $value, $args = array()) {
        // ...
    }

Desired Behavior

The correct format should be @param [argument type] [argument name] [argument description] So the corrected code after typing /** should be

<?php

    /**
     * [addWhere description]
     * @param [type] $column   [description]
     * @param [type] $operator [description]
     * @param [type] $value    [description]
     * @param array  $args     [description]
     */
    public function addWhere($column, $operator, $value, $args = array()) {
        // ...
    }

sameg14 avatar Dec 10 '14 16:12 sameg14

This works for me... There are two settings which would modify this though:

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

  // Add a name of parameter in param tag?
  "jsdocs_param_name": true,

If both of those are false (which is not the default), then you'd see the output you've included in your post.

spadgos avatar Dec 11 '14 09:12 spadgos

I had the same issue, and I had to add the two settings mentioned by @spadgos to my Settings - User file for it to work, even though they were set to true in the Settings - Default file.

sebastienbarre avatar Dec 18 '14 23:12 sebastienbarre

I don't know why that didn't work, but I think in general it's not a good idea to edit the defaults file, since that will be overwritten each time ST updates.

spadgos avatar Dec 19 '14 01:12 spadgos

Same issue for me. Just installed DocBlocker and it does NOT contain param names in a generated docblock:

/**
 * Gets the 
 * @param  {[type]}
 * @param  {[type]}
 * @param  {[type]}
 * @param  {[type]}
 * @return {[type]}
 */
var getConfig = function(practice, workflow, role, view) {

}

toymachiner62 avatar Mar 25 '15 13:03 toymachiner62

I had the same issue, and I had to add the two settings mentioned by @spadgos to my Settings - User file for it to work, even though they were set to true in the Settings - Default file.

+1. After adding these lines to Settings => User (despite the fact they was explicitly set to true in Settings => Default), it worked.

f1nnix avatar Apr 23 '15 08:04 f1nnix

Even though PSR5 is currently in the "Proposed" status, it is evident that this is how the annotation should look.

https://github.com/phpDocumentor/fig-standards/blob/master/proposed/phpdoc.md#55-examples

sameg14 avatar Apr 27 '15 22:04 sameg14

Same here, it doesn't work when its packaged in a sublime-package-file but it works when you unpack it.

Jellyfrog avatar Aug 20 '15 12:08 Jellyfrog

+1 Installed the DocBlockr plugin via Package Control inside of ST2. Javascript function block did not generate param names.

Neither Settings-Default nor Settings-User contained any reference to DocBlockr or jsdocs.

Adding the two options specified by @spadgos above "jsdocs_param_description": true, "jsdocs_param_name": true, into Settings-User fixed the issue

davepile avatar Oct 15 '15 01:10 davepile

+1

magicmark avatar Feb 18 '16 10:02 magicmark

I'm having this very same issue in Sublime 3.

The fix mentioned before still works.

runoncedev avatar Oct 20 '17 15:10 runoncedev

Just had the same issue, tried the user settings and while it works I also checked something else. Uninstalled, installed again - same issue. I have restarted sublime (without adding any user settings) and it all works fine. So just restart sublime after install and you should be fine.

rafalborowski avatar Jan 29 '18 10:01 rafalborowski

Just had the same issue, tried the user settings and while it works I also checked something else. Uninstalled, installed again - same issue. I have restarted sublime (without adding any user settings) and it all works fine. So just restart sublime after install and you should be fine.

it worked. thanks

namlq93 avatar Nov 07 '18 11:11 namlq93