Giter Site home page Giter Site logo

vs-docblockr's People

Contributors

clayliddell avatar dependabot[bot] avatar jeremyvii avatar travisrisner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

vs-docblockr's Issues

Problem with with parameters passed by reference in PHP

Describe the bug
Extension fails when working with a php function that has a parameter passed by reference.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new php file
  2. Create a function with a parameter passed by reference(e.g. &$var)
  3. Try to autocomplete docblock

Expected behavior
Extensions should parse and create docblock with the parameter information.

Code Snippet
<?php function foo(string &$bar) {}

Enviroment (please complete the following information):

  • OS: Ubuntu 18.04 LTS
  • Version 0.4.3
  • Language(s) PHP

Multiple lines of function arguments. Reduce of empty array with no initial value

Describe the bug
Does not generate comments for multiple lines of function arguments.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the line before a function with multiple lines of arguments.
  2. Type /** and Enter
  3. See the error 'Reduce of empty array with no initial value' and the following comment block:
    /**
     * [description]
     */

Expected behavior
It should generate a comment block.

Code

     protected function getValueKeeper(
        PrintedSheets $pricingRule, 
        CalculationVariableKeeper $calculationVariableKeeper, 
        OptionCollection $options
    ): ?ValuesOfRunningMeter {
        return '';
    }

Screenshots
Снимок экрана от 2020-06-04 16-35-18

Enviroment (please complete the following information):

  • OS: Ubuntu 20.04
  • VS Code: 1.45.1, the extension: 1.1.2
  • Language: PHP

JavaScript object destructuring in function

Describe the bug
In modern JS you can do function foo({ a, b }) {} rather than function foo(args) { args.a }

However, this extension gets a bit confused and thinks that the braces are arguments.

Code Snippet

function AuthChecker({ dispatch, authed, session }) {
}

Output

/**
 * [AuthChecker description]
 *
 * @param {[type]} {
 *   [{ description]
 * @param {[type]} dispatch
 *   [dispatch description]
 * @param {[type]} authed
 *   [authed description]
 * @param {[type]} session
 *   [session description]
 * @param {[type]} }
 *   [ description]}
 *
 * @return {[type]}
 *   [return description]
 */

Expected

/**
 * [AuthChecker description]
 *
 * @param {[type]} dispatch
 *   [dispatch description]
 * @param {[type]} authed
 *   [authed description]
 * @param {[type]} session
 *   [session description]
 *
 * @return {[type]}
 *   [return description]
 */

Environment (please complete the following information):

  • OS: MacOS 10.14.6
  • Version 0.7.0
  • Language(s) Javascript

Cannot use docblockr on PHP

Describe the bug
I am getting the error:

ERR Cannot read property 'col' of null: TypeError: Cannot read property 'col' of null
	at PHP.tokenize (/home/b/.vscode-oss/extensions/jeremyljackson.vs-docblock-0.4.0/out/src/languages/php.js:129:22)
	at PHP.tokenize (/home/b/.vscode-oss/extensions/jeremyljackson.vs-docblock-0.4.0/out/src/languages/php.js:135:26)
	at PHP.tokenize (/home/b/.vscode-oss/extensions/jeremyljackson.vs-docblock-0.4.0/out/src/languages/php.js:135:26)
	at PHP.init (/home/b/.vscode-oss/extensions/jeremyljackson.vs-docblock-0.4.0/out/src/parser.js:71:28)
	at Snippets.provideCompletionItems (/home/b/.vscode-oss/extensions/jeremyljackson.vs-docblock-0.4.0/out/src/snippets.js:52:42)
	at /usr/lib/code/out/vs/workbench/node/extensionHostProcess.js:755:678
	at /usr/lib/code/out/vs/workbench/node/extensionHostProcess.js:108:466
	at new n.Class.derive._oncancel (/usr/lib/code/out/vs/workbench/node/extensionHostProcess.js:86:460)
	at Object.t.asWinJsPromise (/usr/lib/code/out/vs/workbench/node/extensionHostProcess.js:108:431)
	at e.provideCompletionItems (/usr/lib/code/out/vs/workbench/node/extensionHostProcess.js:755:632)
	at /usr/lib/code/out/vs/workbench/node/extensionHostProcess.js:767:852
	at e._withAdapter (/usr/lib/code/out/vs/workbench/node/extensionHostProcess.js:761:91)
	at e.$provideCompletionItems (/usr/lib/code/out/vs/workbench/node/extensionHostProcess.js:767:814)
	at e._doInvokeHandler (/usr/lib/code/out/vs/workbench/node/extensionHostProcess.js:681:309)
	at e._invokeHandler (/usr/lib/code/out/vs/workbench/node/extensionHostProcess.js:681:27)
	at e._receiveRequest (/usr/lib/code/out/vs/workbench/node/extensionHostProcess.js:679:802)
	at e._receiveOneMessage (/usr/lib/code/out/vs/workbench/node/extensionHostProcess.js:678:993)
	at /usr/lib/code/out/vs/workbench/node/extensionHostProcess.js:677:791
	at /usr/lib/code/out/vs/workbench/node/extensionHostProcess.js:98:597
	at e.fire (/usr/lib/code/out/vs/workbench/node/extensionHostProcess.js:99:917)
	at a (/usr/lib/code/out/vs/workbench/node/extensionHostProcess.js:164:787)
	at Socket._socketDataListener (/usr/lib/code/out/vs/workbench/node/extensionHostProcess.js:164:1006)
	at emitOne (events.js:116:13)
	at Socket.emit (events.js:211:7)
	at addChunk (_stream_readable.js:263:12)
	at readableAddChunk (_stream_readable.js:250:11)
	at Socket.Readable.push (_stream_readable.js:208:10)
	at Pipe.onread (net.js:594:20)

To Reproduce
Steps to reproduce the behavior:

  1. Go to a php file
  2. Enter /**

Expected behavior
Docblockr to insert the doc block template

Enviroment (please complete the following information):
screenshot_2018-11-20_12-51-25

Command throws an error

Describe the bug
The command that comes with this extension, vs-docblockr.init throws an error when running.

Command 'DocBlockr - Parse' resulted in an error (command 'vs-docblockr.init' not found)

Enviroment (please complete the following information):

  • Version 1.0.1

Additional context
Probably need to re-evaluate the name and function of this command.

Snippet does not show up after the key combination

Describe the bug

When I type the /** characters above the first line of a method, the snippet completion window does not show up. Instead, VSCode automatically add the closing */ to the end of the line.

Is this due to a setting in VSCode?

To Reproduce
Steps to reproduce the behavior:

  1. Put your cursor above the opening line of a method
  2. Type /**
  3. Notice that the snippet window does not appear and pressing TAB does not expand the docblock.

Code Snippet

public static function indexQuery(NovaRequest $request, $query)
    {
        return $query->where('is_company', true);
    }

The problem is however not limited to this snippet, I tried with many different methods in different files, it does not work with JS files either.

Screenshots

Enviroment (please complete the following information):

  • OS: Windows 10 1803
  • Version 0.4.2 of the extension
  • Language(s) : PHP and Javascript

Additional context

Here is my settings file in case anything here is interfering with the extension :
https://pastebin.com/JDJZqYGc

Pressing enter does not continue docblock

Describe the bug
Pressing enter inside a docblock does not continue the docblock. The asterisk is not printed and the cursor moves to the beginning of the line as if it is outside a docblock.

To Reproduce

  1. Start a docblock with /** and press Enter
  2. The cursor is now inside a docblock template. Type some text and press Enter
  3. Notice that the cursor has moved to the beginning of the line and no asterisk was created

docblock not continuing

Expected behavior
A newline and " * " is printed with my cursor at the end of the newly created line.

Code Snippet

/**
  * I'm going to press enter>
Oops, I got a new line with no padded asterisk
  */

Enviroment (please complete the following information):

  • OS: Windows
  • Version 11
  • Language(s) JavaScript

Fails on nullable types in PHP

Describe the bug
Extension fails if types are nullable

To Reproduce

  1. Create new php file
  2. Create function with nullable type (e.g. ?string)
  3. Try to autocomplete docblock

Expected behavior
Extension should parse and create docblock with type autocompleted

Code Snippet

<?php
function foo(): ?string {}

Enviroment (please complete the following information):

  • OS: Ubuntu 18.04.1 LTS
  • Version 1.25.1
  • Language(s) PHP

Support arbitrary array of file extensions

Is your feature request related to a problem? Please describe.
I am not able to use the /** or multi-line // comment shortcuts in other files such as css, sass, scss, etc.

Describe the solution you'd like
I'd like a supportedExtensions array of file extensions where this plugin will do its thing

Describe alternatives you've considered
I've tried different plugins, but they are all syntax specific as well with no options

Additional context
n/a

Handle different ways of function definitions in JS files

I am thankful for the functionality the extension currently have and I could live with it as it is but it would be nice to have this usability/comfort improvement.

Is your feature request related to a problem? Please describe.
If you define a function in a more weird way than the example provided in the Readme it will not work. Ex. code :

HS.Utils.usefullFunction = function usefullFunction(object) {
    return object
}

EDIT: Just found out that it doesn't work for anonymous functions as well (this might be categorised as bug?)

/**
function (par1, par2, par3){
    return "magic"
}

In this case it does not generate the parameters.
Combination of both two examples would be nice to work as well.

I haven't research all the ways a function can be defined in JS. I write only of what I have come across in my code for the little time I have used the extension.

Describe the solution you'd like
I expect when I write "//**" a top this line to work as it normally does.
Result should be:

/**
 * [usefullFunction description]
 *
 * @param   {[type]}  object  [object description]
 *
 * @return  {[type]}          [return description]
 */
HS.Utils.usefullFunction = function usefullFunction(object) {
    return object
}

Describe alternatives you've considered
Currently I have to move my cursor after the "=" hit two times enter in order to move the function definition to new line and use the "/**" atop of it, copy the generated template, undo those changes, paste the template above my definition. The code would look something like this before doing the "Undo"s:

HS.Utils.usefullFunction = 
/**
 * [usefullFunction description]
 *
 * @param   {[type]}  object  [object description]
 *
 * @return  {[type]}          [return description]
 */
function usefullFunction(object) {
    return object
}

PHP constants try to parse as fuctions

Describe the bug
When attempting to autocomplete a const in PHP, the parser thinks it is attempting to parse a function or method.

/**
 * [ description]
 *
 * @return [type]
 *   [return description]
 */
const FOO = 4;

To Reproduce
Attempt to autocomplete the following snippet

const FOO = 4;

Expected behavior

/**
 * [FOO description]
 *
 * @var [type]
 */
const FOO = 4;

Code Snippet

const FOO = 4;

Enviroment (please complete the following information):

  • OS: Xubuntu
  • Version 0.7.0
  • Language(s) PHP

Setting to remove extra blank lines

Is your feature request related to a problem? Please describe.
Remove the extra blank lines added to the generated DocBlocks.

Current formatting:

/**
 * [sample description]
 *
 * @param   {[type]}  param1  [param1 description]
 * @param   {[type]}  param2  [param2 description]
 *
 * @return  {[type]}          [return description]
 */
function sample(param1, param2){}

Suggested formatting:

/**
 * [sample description]
 * @param   {[type]}  param1  [param1 description]
 * @param   {[type]}  param2  [param2 description]
 * @return  {[type]}          [return description]
 */
function sample(param1, param2){}

PHP traits aren't properly parsed

Describe the bug
PHP traits aren't properly parsed.

Expected behavior
PHP traits are parsed similar to classes

Code Snippet

trait Foo {

Enviroment (please complete the following information):

  • OS: Ubuntu
  • Version 0.8.0
  • Language(s) PHP

Some tests are broken

Some tests, Keybinding: /** + Enter and renderFromSelection are not throwing an error even though they are broken. With this tests working code coverage should increase. These tests are unique as they try to test the extension with an active workspace.

Issue with Constructors in PHP

When trying to use the plugin with a constructor class called __construct (or any class that begins with an underscore), it doesn't seem to work.

  public function __construct() {
    
  }

Wrong parameter, miss null

Describe the bug
Does not generate parameters with null.

To Reproduce

protected function checkPricingRule(PricingRule $pricingRule = null): ?bool {}

Expected behavior

    /**
     * [checkPricingRule description]
     *
     * @param   PricingRule|null  $pricingRule  [$pricingRule description]
     *
     * @return  bool|null                       [return description]
     */
    protected function checkPricingRule(PricingRule $pricingRule = null): ?bool

Code

/**
     * [checkPricingRule description]
     *
     * @param   PricingRule  $pricingRule  [$pricingRule description]
     * @param   null                       [ description]
     *
     * @return  bool                       [return description]
     */
    protected function checkPricingRule(PricingRule $pricingRule = null): ?bool

Screenshots
Снимок экрана от 2020-06-04 17-58-41

Enviroment (please complete the following information):
OS: Ubuntu 20.04
VS Code: 1.45.1, the extension: 1.1.2
Language: PHP

Extension mistakes second parameter type as another parameter

Describe the bug
Extension mistakes second parameter type as another parameter when language is set to TypeScript

To Reproduce
Steps to reproduce the behavior:

  1. Attempt to run VS DocBlockr on TypeScript function with two type defined parameters
  2. See three parameter tags have been generated

Expected behavior

/**
 * [foo description]
 *
 * @param   {number}  bar     [bar description]
 * @param   {string}  thing   [thing description]
 *
 * @return  {void}            [return description]
 */
function foo(bar: number, thing: string): void {

}

Result

/**
 * [foo description]
 *
 * @param   {number}  bar     [bar description]
 * @param   {[type]}  thing:  [thing: description]
 * @param   {[type]}  string  [string description]
 *
 * @return  {void}            [return description]
 */
function foo(bar: number, thing: string): void {

}

Enviroment (please complete the following information):

  • Version: 1.30.2
  • Commit: 61122f88f0bf01e2ac16bdb9e1bc4571755f5bd8
  • Date: 2019-01-07T22:49:48.319Z
  • Electron: 2.0.12
  • Chrome: 61.0.3163.100
  • Node.js: 8.9.3
  • V8: 6.1.534.41
  • OS: Linux x64 4.15.0-43-generic

Possible user/configuration issue

Hey guys,

I'm trying to migrate over to VS Code from Sublime and was looking for a DocBlock package and found yours. But when I try to add blocks to a class method, like this:

public function myTestMethod( string $myString, bool $myBool ){

 }

by typing above the method name, it only adds the empty comments, like this:

  /**
   * 
   */
  public function myTestMethod( string $myString, bool $myBool ){

  }

If, however, I start typing on the same line as the method, I get this:

 /**
   * [ description]
   *
   * @return  [type]  [return description]
   */public function myTestMethod( string $myString, bool $myBool ){

  }

But it doesn't include any params or anything. Any ideas what I'm doing wrong? Thanks in advance!

typing `/**` and pressing enter does duplicate the `/**` tag

Describe the bug
A clear and concise description of what the bug is.

typing /** and pressing enter does duplicate the /** tag. See the following video

dockblockr small

To Reproduce

  1. Go on top of a function
  2. Type /**
  3. Press enter
  4. The first line does now contain /**/**

Expected behavior
Do not duplicate /**

Code Snippet
If applicable, code snippet you tried to try to apply docblock too

Screenshots
If applicable, add screenshots to help explain your problem.

Enviroment (please complete the following information):

  • plugin version : 1.0.1
  • Windows 10
  • Vscode:
    Version: 1.44.2 (user setup)
    Commit: ff915844119ce9485abfe8aa9076ec76b5300ddd
    Date: 2020-04-16T16:36:23.138Z
    Electron: 7.1.11
    Chrome: 78.0.3904.130
    Node.js: 12.8.1
    V8: 7.8.279.23-electron.0
    OS: Windows_NT x64 10.0.18363
  • Languages : tested with PHP and Javascript

Suggestion : C language

Is your feature request related to a problem? Please describe.
A suggestion 😄

Describe the solution you'd like
Adding C/C++ docblocks too. I see there is a c-language branch, but never updated since last year.

Describe alternatives you've considered
PHP could be maybe used as a base ?

Docblocks generated from command breaks indention

Describe the bug
Docblocks created with renderFromSelection command breaks indention on indented code snippets. This only happens to code that's on it's own line.

Code Snippet

  public bar(
    argument: string
  ) {

  }

Screenshots
Screenshot_2020-05-11_16-56-39

Enviroment (please complete the following information):

  • OS: Ubuntu
  • Version 1.1.1

PHP ignores next parameter without type

Describe the bug
If the first function parameter has a type and the second parameter doesn't, the latter is ignored in PHP.

Expected behavior

<?php
/**
 * [test description]
 *
 * @param int $foo
 *   [$foo description]
 * @param [type] $bar
 *   [$bar description]
 *
 * @return [type]
 *   [return description]
 */
function test(int $foo,  $bar) {
}

Code Snippet

<?php
/**
 * [test description]
 *
 * @param int $bar
 *   [$bar description]
 *
 * @return [type]
 *   [return description]
 */
function test(int $foo,  $bar) {

}

Enviroment (please complete the following information):

  • OS: Xubuntu
  • Version 1.0.0
  • Language(s) PHP

Functions in PHP aren't being parsed

Describe the bug
An error is thrown when PHP functions are parsed.

Reduce of empty array with no initial value

Expected behavior
Should properly parse a PHP method

Code Snippet

function fizz() {

}

Enviroment (please complete the following information):

  • OS: Xubuntu
  • Version 1.1.2
  • Language PHP

Add C++ support

Is your feature request related to a problem? Please describe.
C was recently implemented, C++ should be as well.

Describe the solution you'd like
It would be nice if the C and C++ parser could be one. I don't know how feasible this would be given the messy regular expressions in the C parser.

Does not return two types of data

Describe the bug
Does not return two types of data.

Example:

?bool => bool

There should be the following:

?bool => bool|null

Code

protected function checkPricingRule(PricingRule $pricingRule): ?bool
{}

Screenshots
Снимок экрана от 2020-06-04 17-54-14

Enviroment (please complete the following information):

OS: Ubuntu 20.04
VS Code: 1.45.1, the extension: 1.1.2
Language: PHP

Add support to arrow functions (and anonymous functions too).

Is your feature request related to a problem? Please describe.
I love VS DocBlockr, but when I use it on an arrow function (or an anonymous one), I have a different result.

Describe the solution you'd like
The next code shows VS DockBlockr with a "normal" function:

/**
 * [sum description]
 *
 * @param   {[type]}  a  [a description]
 * @param   {[type]}  b  [b description]
 *
 * @return  {[type]}     [return description]
 */
function sum(a,b) {
  return a + b;
}

But this is what happens when I write an arrow function

/**
 * [sum description]
 *
 * @var  {[type]}
 */
const sum = (a,b) => a+b;

Describe alternatives you've considered
I want the same result when using DockBlockr with both arrow and anonymous functions.

Additional context
No additional context

Use the SnippetString class to build docblock snippets

It would be beneficial to use the VS Code API's SnippetString to build docblock snippets. This should clean up the functions associated with Parser.renderBlock(). This should the complexity involved placeholder parameter.

PHP - issue with class properties without a default value

Describe the bug
When attempting to docblock a class property that does not have a value set, the last letter of the variable name is truncated in the description placeholder.

To Reproduce
Steps to reproduce the behavior:

  1. Create a PHP file
  2. Create a class
  3. Create a property inside the class without defining it's value
  4. When autocompleting the docblock, the last character of the variable name is dropped in the placeholder.

Expected behavior
The placeholder for [$varname description] should display exactly as the variable name is

Code Snippet
class foo { protected $varname; }

Enviroment (please complete the following information):

  • OS: Ubuntu 18.04 LTS
  • Version [e.g. 22]
  • Language(s) [e.g. JavaScript, PHP]

OS: Ubuntu 18.04 LTS
Version 0.5.5
Language(s) PHP

No DocBlock with TypeScript in Vue

Is your feature request related to a problem? Please describe.
Hi, thanks for this, for me. I don't seem to be able to get a doc block if the code is inside a .vue file. I can however inside either a .ts or .js file. Just wondered if that is the expected behaviour

Describe the solution you'd like
docblocks within .vue extensions

Describe alternatives you've considered
none, but might just put it in a ts file and copy it back over

:)

File extensions configuration

Could you provide some settings to specify which file type will have comment blocks?
For example I'm using Vue components. This components are files with combination of JS, html, and css with .vue extension.
I need to have docblockr snippets inside JS part of code.
Sometimes file names and extension are different than .js or .php but contain valid js/php code.
It will be usefull to customize file extensions and suitable comment blocks.

Thanks for this plugin anyway!

Problem with variables that contain "s_" in PHP

Describe the bug
When working with a PHP file that contains a variable with "s_" in the name, everything after the "s_" is truncated in the description.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new PHP file
  2. Create a variable named $tests_testing
  3. Autocomplete the docblock
  4. You will see that it describes the variable as [$test description]

Expected behavior
The docblock should describe the variable as [$tests_testing description]

Code Snippet
<?php class Testing { private $tests_testing = 'Value'; }

Screenshots
If applicable, add screenshots to help explain your problem.

  • OS: Ubuntu 18.04 LTS
  • Version 0.4.11
  • Language(s) PHP

Additional context
Add any other context about the problem here.

Publish to Open-VSX

VS Chromium uses https://open-vsx.org instead of Microsoft's store. It's basically VSCode but without the spyware built in and runs faster because it has most plugins disabled or not installed by default.

Methods in JavaScript aren't properly parsed

Describe the bug
Class methods in JavaScript aren't properly parsed. It appears that an empty block is being rendered.

Expected behavior

class Foo {
  /**
   * [bar description]
   * 
   * @param   {[type]}  fizz  [fizz description]
   * 
   * @return  {[type]}        [return description]
   */
  bar(fizz) {

  }
}

Code Snippet

class Foo {
  /**
   * [description]
   */
  bar(fizz) {

  }
}

Enviroment (please complete the following information):

  • OS: Xubuntu
  • Version 1.1.2
  • Language(s) JavaScript, TypeScript

Autocomplete Indentation Broken

Describe the bug
Whenever creating multi-line comments for some indented piece of code (e.g. a class method, property, or variable declaration) the indentation of the comment is removed during autocomplete.

Expected behavior
Whenever creating multi-line comments, the indentation should be preserved for the comment.

Screenshots
Expected Behavior:
Selection_001
Actual Behavior:
Selection_002

Enviroment (please complete the following information):

  • OS: Ubuntu
  • Version: 1.1.0
  • Language(s): Tested with PHP, C, and Java

Additional context
This appears to have been caused by a recent commit (3 days ago) which was added to the recent 1.0.2 release.

Typescript not showing block

Trying /** + enter for a typescript file and it just result sin /** */. If I change language mode to javascript it works as expected.

Code Snippet

static returnsTheThing(arr: string[][], str: string): boolean {
  //  ...  
  return true;
}

Enviroment (please complete the following information):
ubuntu 18.04.2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.