Giter Site home page Giter Site logo

Comments (8)

heavenshell avatar heavenshell commented on May 13, 2024

@IonicaBizau
Very interesting.
I've implemented your idea.
Try this branch(https://github.com/heavenshell/vim-jsdoc/tree/feature_default_message).
This is an experimentation and please report me if you have any problems.

Add following setting to your .vimrc

let g:jsdoc_type_hook = {
  \ 'object': 'An object containing the following fields',
  \ 'function': 'Callback function'
  \ }

If type is obejct, JSDoc.vim insert An object containing the following fields to description.

Btw, do you have a PayPal account? I'm happy to donate you some πŸ’² for making my life easier using this plugin. πŸ˜„

Wow, Thank you very much.
It's very glad to hear that, but I don't have paypal account.
So if it's ok with you, please donate to Vim it self instead of me πŸ˜„

You know Vim is charity ware

http://www.vim.org/sponsor/index.php

from vim-jsdoc.

IonicaBizau avatar IonicaBizau commented on May 13, 2024

@heavenshell Thanks! Almost there! ❇️ The thing I still need is to be able to input a custom description (currently it seems that if I configure a hook for Object, then it doesn't ask me for the description).

Anyway, nice work! 😸

from vim-jsdoc.

heavenshell avatar heavenshell commented on May 13, 2024

@IonicaBizau

The thing I still need is to be able to input a custom description (currently it seems that if I configure a hook for Object, then it doesn't ask me for the description).

Please explain to me little bit more?

let g:jsdoc_custom_args_hook = {
  \ 'callback\|cb': {
  \   'type': '{function}',
  \   'description': 'The callback function.'
  \ }
  \}
let g:jsdoc_type_hook = {
  \ 'object': 'An object containing the following fields',
  \ 'function': 'Callback function'
  \ }

Followings are steps to reproduce.

function foo(bar, baz, callback) {
}
  • :JsDoc
  • Argument "bar" type:
  • Input object
    • Then JSDoc.vim shows Argument "baz" type:
  • input number
    • Then JSDoc.vim shows Argument "baz" description:
    • Input baz description
    • Then shows Argument "callback" type:
  • hit return
    • Then shows Argument "callback" description:
    • hit return

Generated JSDoc is following.

/**
 * foo
 *
 * @param {object} bar An object containing the following fields
 * @param {number} baz foo
 * @param {function} callback The callback function.
 */
function foo(bar, baz, callback) {
}

@param {function} callback The callback function. is from let g:jsdoc_custom_args_hook.

from vim-jsdoc.

IonicaBizau avatar IonicaBizau commented on May 13, 2024

Then JSDoc.vim shows Argument "baz" type:

Before this I want to get Argument "bar" description:–and if I only press Enter, it will be set to An object containing the following fields, otherwise (if I write something different), it will be set to what I wrote. So, basically, I still want to have the possibility to enter custom descriptions for type hooks. πŸ’«

from vim-jsdoc.

heavenshell avatar heavenshell commented on May 13, 2024

@IonicaBizau
OK, I see.
Please wait a while πŸ˜„

from vim-jsdoc.

heavenshell avatar heavenshell commented on May 13, 2024

@IonicaBizau
Updated.

let g:jsdoc_type_hook = {
  \ 'object': {
  \   'description': 'An object containing the following fields',
  \   'force_override': 1,
  \ },
  \ 'function': 'Function description'
  \ }

If you set 'force_override': 1, skip description prompt.
If you don't set force_override description prompt.

from vim-jsdoc.

IonicaBizau avatar IonicaBizau commented on May 13, 2024

@heavenshell Works nice! Thank you sooooo much! ✨

from vim-jsdoc.

heavenshell avatar heavenshell commented on May 13, 2024

Merged to master. a0c8603

from vim-jsdoc.

Related Issues (20)

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.