Skip to content

Feature/2.0.0 #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name-template: 'v$NEXT_PATCH_VERSION'
tag-template: '$NEXT_PATCH_VERSION'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
branches:
- 'master'
categories:
- title: '🐛 Bug Fixes'
labels:
- 'bug'
- title: '🧰 Maintenance'
labels:
- 'chore'
- 'dependencies'
- 'infra'

template: |
## Changes

$CHANGES

## Compare

https://github.com/heavenshell/vim-jsdoc/compare/$PREVIOUS_TAG...$NEXT_PATCH_VERSION
14 changes: 14 additions & 0 deletions .github/workflows/release-management.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Release Management

on:
push:
branches:
- master

jobs:
update_draft_release:
runs-on: ubuntu-latest
steps:
- uses: toolmantim/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
149 changes: 146 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,148 @@
*.swp
### https://raw.github.com/github/gitignore/85bf08b19a77c62d7b6286c2db8811f2ff373b0f/Global/Vim.gitignore

# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]

# Session
Session.vim
Sessionx.vim

# Temporary
.netrwhist
*~
.DS_Store
# Auto-generated tag files
tags
tests/vader.vim
# Persistent undo
[._]*.un~


### https://raw.github.com/github/gitignore/85bf08b19a77c62d7b6286c2db8811f2ff373b0f/Node.gitignore

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/


### https://raw.github.com/github/gitignore/85bf08b19a77c62d7b6286c2db8811f2ff373b0f/Global/macOS.gitignore

# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# App
lib/node_modules
lib/lehre
tests/vader.vim/
Expand Down
40 changes: 24 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
sudo: required
dist: xenial
sudo: false
group: travis_latest
language: vim

install:
cache:
apt: true
yarn: true
ccache: true

before_install:
- git clone https://github.com/junegunn/vader.vim.git tests/vader.vim
- git clone https://github.com/vim/vim /tmp/vim
- cd /tmp/vim
- sudo apt-get install -y gettext libncurses5-dev libacl1-dev libgpm-dev
- ./configure --with-features=huge --enable-fail-if-missing --enable-pythoninterp --prefix=$HOME/bin/vim
- make && make install
- git clone https://github.com/junegunn/vader.vim.git
- export VIM_EXE=$HOME/bin/vim/bin/vim
- cd $HOME/build/heavenshell/vim-jsdoc/tests
- npm install

before_script:
- cd $HOME/build/heavenshell/vim-jsdoc/tests
jobs:
include:
- env: ENV="Vim8"
install:
- git clone https://github.com/vim/vim /tmp/vim
- cd /tmp/vim
- sudo apt-get install -y gettext libncurses5-dev libacl1-dev libgpm-dev
- ./configure --with-features=huge --enable-fail-if-missing --enable-pythoninterp --prefix=$HOME/bin/vim
- make && make install

before_script:
- cd $HOME/build/heavenshell/vim-jsdoc
- make install

script:
- VIM_EXE=$HOME/bin/vim/bin/vim ./run.sh > /dev/null && echo Success || echo Fail
script:
- cd $HOME/build/heavenshell/vim-jsdoc/tests
- VIM_EXE=$HOME/bin/vim/bin/vim ./run.sh
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.PHONY: install
install:
bash lib/install.sh

.PHONY: clean
clean:
rm -rf lib/lehre lib/node_modules lib/yarn.lock
119 changes: 66 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,80 +1,93 @@
jsdoc.vim
=========
# jsdoc.vim

[![Build Status](https://travis-ci.org/heavenshell/vim-jsdoc.svg?branch=master)](https://travis-ci.org/heavenshell/vim-jsdoc)

jsdoc.vim generates [JSDoc](http://usejsdoc.org/) block comments based on a function signature.

![Move cursor to function keyword line, then type `:JsDoc`. If g:jsdoc_allow_input_prompt is enabled, prompt input description, argument type, parameter description. If g:jsdoc_allow_input_prompt is disabled, insert JsDoc automatically.](https://github.com/heavenshell/vim-jsdoc/wiki/images/vim-jsdoc-screencast-preview.gif)
![jsdoc.vim](./assets/jsdoc.gif)

This plugin based on https://gist.github.com/3903772#file-jsdoc-vim written by [NAKAMURA, Hisashi](https://gist.github.com/sunvisor)
## Note

Depending on your configuration, jsdoc.vim will prompt for description, `@return` type and description. It will also prompt you for types and descriptions for each function `@param`.
Since version 2.0.0 jsdoc.vim is support only **Vim8**.

Data type tab completion supported for parameter and return types
* currently: `boolean`, `null`, `undefined`, `number`, `string`, `symbol`, `object`, `function`, `array`, `typedArray`, `date`, `promise`, `proxy`, `map`, `set`, `weakmap`, `weakset`, `error`, `regexp`
If you want use old version checkout [1.0.0](https://github.com/heavenshell/vim-jsdoc/releases/tag/1.0.0>).

## Install

Since version 2.0.0, jsdoc.vim requires [lehre](https://www.npmjs.com/package/lehre).

You can install following command.

```console
make install
```

If you want to update `lehre` hit following commands.

```console
make clean
make Install
```

If you want install lehre manually, you can install from npm.

```console
$ yarn add -D lehre
```

Than set installed `/path/to/node_modules/.bin/lehre` path to `g:jsdoc_lehre_path`.

## Usage

1. Move cursor on `function` keyword line.
2. Type `:JsDoc` to insert JSDoc.
3. Insert JSDoc above the `function` keyword line.
1. Move cursor on `function` keyword line
1. Type `:JsDoc` to insert JSDoc
1. Insert JSDoc above the `function` keyword line

## Format

1. Type `:JsDocFormat`
1. Insert JSDoc above the all signatures

## Configuration

Option | Default | Description
:-------------------------------------- | :------ | :----------
**g:jsdoc_allow_input_prompt** | 0 | Allow prompt for interactive input.
**g:jsdoc_input_description** | 0 | Prompt for a function description
**g:jsdoc_additional_descriptions** | 0 | Prompt for a value for `@name`, add it to the JSDoc block comment along with the `@function` tag.
**g:jsdoc_return** | 1 | Add the `@return` tag.
**g:jsdoc_return_type** | 1 | Prompt for and add a type for the aforementioned `@return` tag.
**g:jsdoc_return_description** | 1 | Prompt for and add a description for the `@return` tag.
**g:jsdoc_access_descriptions** | 0 | Set value to 1 to turn on access tags like `@access <private\|public>`. Set value to 2 to turn on access tags like `@<private\|public>`
**g:jsdoc_underscore_private** | 0 | Set value to 1 to turn on detecting underscore starting functions as private convention
**g:jsdoc_allow_shorthand** | 0 | Set value to 1 to allow ECMAScript6 shorthand syntax. Since ver `0.5.0` deprecated. Use `g:jsdoc_enable_es6` instead.
**g:jsdoc_param_description_separator** | ' ' | Characters used to separate `@param` name and description.
**g:jsdoc_custom_args_hook** | {} | Override default type and description. See help more detail.
**g:jsdoc_custom_args_regex_only** | 0 | When using `custom_args_hook`, only match against regexes
**g:jsdoc_type_hook** | {} | Allow to insert default description depending on the type.
**g:jsdoc_enable_es6** | 0 | Enable to use ECMAScript6's Shorthand function, Arrow function.
**g:jsdoc_tags** | see :h | Allow use of alternate tags (the ones that support synonyms) per JSDoc documentation. Can be changed on a per tag basis, for example: `let g:jsdoc_tags = {} \| let g:jsdoc_tags['param'] = 'arg'`
**g:jsdoc_user_defined_tags** | {} | Allow use of `user_defined_tags`.
Option |Default |Description
:--------------------------|:-------------|:-----------------------
**g:jsdoc_templates_path** |'' |Path to custom template.
**g:jsdoc_formatter** |'jsdoc' |Document block formatter, `jsdoc`, `esdoc`, `tsdoc`
**g:jsdoc_lehre_path** |'./lib/lehre' |Path to [`lehre`](https://www.npmjs.com/package/lehre).

## Formatter

You can choose formatter from [JsDoc](https://jsdoc.app/), [ESDoc](https://esdoc.org/), [TSDoc](https://github.com/microsoft/tsdoc).

If you want to create your own template, see [example template](https://github.com/heavenshell/ts-lehre/tree/master/examples).

## Intaractive input

Since ver 2.0.0 input `Allow prompt for interactive input` is deprecated.

If you want input Intaractively, use snippet plugin.

See [snippet example template](./examples/snippet_template.js).

## Keymap
Since version `0.3`, `g:jsdoc_default_mapping` was removed.

Add following setting to .vimrc if you want same behavior as version `0.2.1`.
```viml
You can add following setting to .vimrc
```vim
nmap <silent> <C-l> <Plug>(jsdoc)
```

Alternatively, you could add the following setting to your .vimrc to search for the last `function` declaration
and puts your jsdoc above it:
```viml
```vim
nmap <silent> <C-l> ?function<cr>:noh<cr><Plug>(jsdoc)
```

## TypeScript
Since ver 0.10.0 jsdoc.vim support TypeScript.
## Thanks
- This plugin based on https://gist.github.com/3903772#file-jsdoc-vim written by [NAKAMURA, Hisashi](https://gist.github.com/sunvisor)

```typescript
function foo(foo: string): string {
return 'foo'
}
```
- The idea of npm packages installation is from [vim-lsp-settings](https://github.com/mattn/vim-lsp-settings).
Highly applicate [@mattn](https://github.com/mattn/) and all vim-lsp-settings contributors.

`:JsDoc` would generate following.

```typescript
/**
* foo
*
* @param {string} foo
* @returns {string}
*/
function foo(foo: string): string {
return 'foo'
}
```
`param` and `returns` set `type` automatically.
## LICENSE
New BSD LICENSE
Binary file added assets/jsdoc.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading