Comments (8)
@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.
@heavenshell Thanks! Almost there! Object
, then it doesn't ask me for the description).
Anyway, nice work!
from vim-jsdoc.
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:
- Then JSDoc.vim shows
- input
number
- Then JSDoc.vim shows
Argument "baz" description:
- Input
baz
description - Then shows
Argument "callback" type:
- Then JSDoc.vim shows
- hit return
- Then shows
Argument "callback" description:
- hit return
- Then shows
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.
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.
@IonicaBizau
OK, I see.
Please wait a while
from vim-jsdoc.
@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.
@heavenshell Works nice! Thank you sooooo much!
from vim-jsdoc.
Merged to master. a0c8603
from vim-jsdoc.
Related Issues (20)
- Does not work on multi lines parameters HOT 1
- yarn.lock changes prevent vim-plug from updating vim-jsdoc HOT 1
- δΈζ―ηΌθΎε¨ηε½δ»€: commentstring< comments< HOT 3
- No @return in JS HOT 2
- E1208: -complete used without allowing arguments HOT 1
- JsDoc is not an editor command for filetype=javascriptreact/typescriptreact HOT 4
- Support for updating existing JSDoc comments? HOT 12
- Multiline function definitions don't work HOT 2
- E492: Not an editor command: JsDoc HOT 13
- TypeScript inputs configuration HOT 13
- Return Type Includes Arrorw with Flow and Arrow Functions HOT 4
- Error thrown for some functions HOT 1
- nullable @member syntax issue HOT 1
- jsdoc.vim v2.0.0 HOT 3
- windows offer HOT 1
- Unknown function: job_start HOT 3
- Any plan on supporting neovim? HOT 1
- How to use the interactive mode in 2.0.0? HOT 6
- Autodetect filetype and formatter HOT 5
- Does not work with async functions HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-jsdoc.