Comments (20)
No, but let g:jsdoc_input_description = 1
allows you to input description interactively.
Is this solve your problem?
from vim-jsdoc.
I know that, but I would like this feature: some default things for repetitive things (e.g. callback
).
Temporary, I hacked it this way:
if (l:arg == "callback")
let l:argType = "Function"
let l:argDescription = "The callback function."
else
let l:argType = input('Argument "' . l:arg . '" type: ', '', 'custom,jsdoc#listDataTypes')
let l:argDescription = input('Argument "' . l:arg . '" description: ')
endif
from vim-jsdoc.
@IonicaBizau I can see what you mean. Maybe there is a place for something like this. A user configurable mapping to allow defaults such as the one you describe.
from vim-jsdoc.
ah, now I see what you mean.
1.Set let g:jsdoc_allow_input_prompt = 0
to .vimrc
2.Write following JavaScript code
function foo(callback) {
}
3.Type :JsDoc
Then you want to insert custom description instead of default description.
Huuum, I think your hack is not a good idea and I can't include to jsdoc.vim
function foo(callback, cb, errorCallback) {
}
For example If args are all callback, your hack ignore second and third callback.
So, maybe we should think something like hook structure.
Note following is a just idea.
let g:jsdoc_custom_arg_hooks = {
\ 'callback|cb': {
\ 'description': 'cutsom description',
\ 'type': 'custom type'
\ },
\ 'error*': {
\ 'description': 'Error callback',
\ }
\}
Dict key is regex and if key matched to defined signature, description and type would be replaced to default value.
from vim-jsdoc.
@heavenshell A setting like g:jsdoc_custom_arg_hooks
in .vimrc
is exactly what I imagine as well! Can you implement it? That will increase my productivity a lot. π
You know that joke:
Over 1 year, the average Vim user saves 11 minutes in productivity.
However, they lose 27 hours through evangelising Vim to non-users.
from vim-jsdoc.
OK, I'll add my ToDo list, so stay tuned.
If you can't wait my implementation, send me PR π
from vim-jsdoc.
@heavenshell Cool!
If you can't wait my implementation, send me PR
Right now, I don't know to write VimL code (the snippet I posted above was the first two lines written in VimL in my life). π
from vim-jsdoc.
@IonicaBizau
Try feature_custom_args
branch.
Set following setting to your .vimrc
let g:jsdoc_custom_args_hook = {
\ 'callback\|cb': {
\ 'type': ' {Function} ',
\ 'description': 'Callback function'
\ }
\}
If above setting(dict) key matched to function signature,
type
and description
would replaced.
/**
* foo
*
* @param bar
* @param callback {Function} Callback function
* @param cb {Function} Callback function
* @return {undefined}
*/
function foo(bar, callback, cb) {
}
This is an experimental implementation.
So, if you catch bugs or problems, let me know.
from vim-jsdoc.
@heavenshell For some reason it doesn't work for me. I updated the autoload/jsdoc.vim
file and set the following in .vimrc
:
let g:jsdoc_custom_args_hook = {
\ 'callback\|cb': {
\ 'type': ' {Function} ',
\ 'description': 'The callback function.'
\ },
\ 'progress': {
\ 'type': ' {Function} ',
\ 'description': 'The progress function.'
\ }
\}
:echo g:jsdoc_custom_args_hook
outputs {'progress': {'description': 'The progress function.', 'type': ' {Function} '}, 'callback\|cb': {'description': 'The callback function.', 'type': ' {Function} '}}
But when I press CTRL + L, I see no difference.
from vim-jsdoc.
ah, sorry currently it's only run at let g:jsdoc_allow_input_prompt=0
.
from vim-jsdoc.
@heavenshell Almost there. π
/**
* foo
*
* @name foo
* @function
* @param input
* @param input
* @param callback
* @param callback {Function} The callback function.
* @param cb
* @param cb {Function} The callback function.
* @param progress {Function} The progress function.
* @param progress
* @return {undefined}
*/
function foo(input, callback, cb, progress) {
}
As you see, the fields are duplicated.
But I want to have the following: to be able to insert description, but if I just press enter (empty string), then search the default description.
from vim-jsdoc.
Thx for reporting problem.
Strange...I'll look into it.
Would you show me your .vimrc(related jsdoc.vim settings).
But I want to have the following: to be able to insert description, but if I just press enter (empty string), then search the default description.
So, you mean JsDoc.vim(interactive mode) might behave overwrite default description when press enter if dict key matched.
Please wait a while πΊ
from vim-jsdoc.
Here and the following (not committed yet):
let g:jsdoc_custom_args_hook = {
\ 'callback\|cb': {
\ 'type': ' {Function} ',
\ 'description': 'The callback function.'
\ },
\ 'progress': {
\ 'type': ' {Function} ',
\ 'description': 'The progress function.'
\ }
\}
So, you mean JsDoc.vim(interactive mode) might behave overwrite default description when press enter if dict key matched.
Yes! If I write something, then it has a greater priority than the default description.
Thanks! π°
from vim-jsdoc.
Thx. reproduced.
Huum, maybe takes a while to fix.
I should reconsider implementation.
from vim-jsdoc.
@IonicaBizau
Fixed duplication and now you can use in interactive mode.
Could you try this?
from vim-jsdoc.
Awww, this is soooo nice! β¨
However, there is one little thing that still should be fixed: it puts two spaces instead of one. Example:
...
* @param a {Function} The callback function.
...
This is probably the last thing to fix from my side. π Really great work.
from vim-jsdoc.
However, there is one little thing that still should be fixed: it puts two spaces instead of one (e.g. * @param a {Function} The callback function.).
Yep, expected behavior.
I Fixed to insert one space automatically.
Could you change your vimrc?
-'type': ' {Function} ',
+'type': '{Function}',
from vim-jsdoc.
Could you change your vimrc?
Hahaha! Cool! βοΈ Exactly what I needed. Thanks again!
from vim-jsdoc.
Merged to master.
from vim-jsdoc.
π π
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.