Coder Social home page Coder Social logo

pavlitsky / vscode-yard Goto Github PK

View Code? Open in Web Editor NEW
23.0 1.0 3.0 87 KB

YARD comments generator for Visual Studio Code

Home Page: https://yardoc.org/

License: MIT License

TypeScript 83.22% Ruby 16.78%
vscode-extension documentation yard yardoc ruby rdoc

vscode-yard's People

Contributors

pablox-cl avatar pavlitsky avatar

Stargazers

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

Watchers

 avatar

vscode-yard's Issues

New template

Hi @pavlitsky

Thanks for developing this cool plugin!👍❤️

I have some simple advice for the generated docstring template.

Now the template is:

    #
    # <Description>
    #
    # @param [<Type>] arg1 <description>
    # @param [<Type>] arg2 <description>
    #
    # @return [<Type>] <description>
    #
    def hello(arg1, arg2)

But I think the template below is clearer.

    # <Description>
    #
    # @param arg1 [<Type>] <description>
    # @param arg2 [<Type>] <description>
    #
    # @return [<Type>] <description>
    #
    def hello(arg1, arg2)

I'm sorry I don't have TypeScript skills to do it myself. So, could you please make a patch if you agree with the change?

Should the param name go before the type?

YARD documentation indicates the the parameter name goes before the type:
https://www.rubydoc.info/gems/yard/file/docs/Tags.md#param

# @param url [String] the URL of the page to download
# @param directory [String] the name of the directory to save to
def load_page(url, directory: 'pages') end

The snippet generated by this plugin looks like this, with the field names after the type name:

#
# <Description>
#
# @param [<Type>] url <description>
# @param [<Type>] directory <description>
#
# @return [<Type>] <description>
#
def load_page(url, directory: 'pages') end

I've seen both in the wild though I believe the former is preferred - should this be updated?

Add def methods without parentheses

Just wondering if it's possible to include also methods without parentheses, like:

def some_method parameter_1 parameter_2
end

I was trying to add a test, but I'm getting this:

/usr/lib/electron/electron --debugBrkPluginHost=31500 --debugId=d56f2c9b-c651-4044-8458-069c1e343f5f /home/pablo/code/vscode/vscode-yard/src/test/project --extensionDevelopmentPath=/home/pablo/code/vscode/vscode-yard --extensionTestsPath=/home/pablo/code/vscode/vscode-yard/out/test 
Error launching app
Unable to find Electron app at /home/pablo/code/vscode/vscode-yard/src/test/project
Cannot find module '/home/pablo/code/vscode/vscode-yard/src/test/project'

What I did:

  1. Clone the repo
  2. npm install
  3. Open the folder on VS Code
  4. Debug sidebar
  5. Extension tests
  6. Little green arrow

Nevertheless, I'm not that familiarized with javascript/typescript, but I was going to give it a go.

Wrong syntax for @!attribute

The YARD documentation states that:

@!attribute [r | w | rw] attribute_name
   Indented attribute docstring

Note: This directive should only be used if there is no explicit attr_* declaration for the attribute in > any source files (i.e., the attribute is declared dynamically via meta-programming). In all other cases, add documentation to the attribute declaration itself.

The correct documentation for an attribute thus looks like:

# @return [MissionType] Mission to work with
attr_reader :mission

And indeed it works well with Yard.

But the extension generates this comment:

# @!attribute [r] mission
#   @return [MissionType] Mission to work with
attr_reader :mission

And this is not understood by Yard.

Would it be possible to update the snippet in this sense?

Thanks for the very useful work!

Don't document methods with malformed parameters

Add basic validation for method's parameters. If they're invalid then don't document either entire method or only skip its parameters.

Bad params examples:

def foo(bar, baz qux)
end
def foo ; end

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.