Skip to content

Topic/async #101

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 3 commits into from
Oct 10, 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
39 changes: 39 additions & 0 deletions .github/workflows/linux_neovim.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: build

on: [push, pull_request]

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
name: [neovim-v04-x64]
include:
- name: neovim-v04-x64
os: ubuntu-latest
neovim_version: v0.4.3
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
python-version: '12.x'
- name: Download vim
shell: bash
run: |
mkdir -p ~/nvim/bin
curl -L https://github.com/neovim/neovim/releases/download/${{matrix.neovim_version}}/nvim.appimage -o ~/nvim/bin/nvim
chmod u+x ~/nvim/bin/nvim
- name: Download test runner
shell: bash
run: |
git clone --depth 1 --single-branch https://github.com/junegunn/vader.vim.git ./tests/vader.vim
make install

- name: Run tests
shell: bash
run: |
export PATH=~/nvim/bin:$PATH
cd ./tests
nvim -u vimrc -c 'Vader! *.vader'
40 changes: 40 additions & 0 deletions .github/workflows/linux_vim.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: build

on: [push, pull_request]

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
name: [vim-v82-x64]
include:
- name: vim-v82-x64
os: ubuntu-latest
vim_version: 8.2.0037
glibc_version: 2.15
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
python-version: '12.x'
- name: Download vim
shell: bash
run: |
mkdir -p ~/vim/bin
curl -L https://github.com/vim/vim-appimage/releases/download/v${{matrix.vim_version}}/GVim-v${{matrix.vim_version}}.glibc${{matrix.glibc_version}}-x86_64.AppImage -o ~/vim/bin/vim
chmod u+x ~/vim/bin/vim
- name: Download test runner
shell: bash
run: |
git clone --depth 1 --single-branch https://github.com/junegunn/vader.vim.git ./tests/vader.vim
make install

- name: Run tests
shell: bash
run: |
export PATH=~/vim/bin:$PATH
cd ./tests
vim -u vimrc -c 'Vader! *.vader'
43 changes: 0 additions & 43 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# jsdoc.vim

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

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

Expand Down
5 changes: 3 additions & 2 deletions autoload/jsdoc.vim
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ let g:jsdoc_lehre_path = get(
\ )

let s:is_method_regex = '^.\{-}\s*\([a-zA-Z_$][a-zA-Z0-9_$]*\)\s*(\s*\([^)]*\)\s*).*$'
let s:is_declarelation = '^.\{-}=\s*\(\([a-zA-Z_$][a-zA-Z0-9_$]*\)\s*(\s*\([^)]*\)\s*)\|(\s*\([^)]*\)\s*\).*$'
let s:registered_callback = ''
let s:results = []
let s:vim = {}
Expand Down Expand Up @@ -73,7 +74,7 @@ function! s:callback(msg, start_lineno, is_method) abort
let i = 0
let length = len(docs)
for d in docs
" If generate methods's signature, jsdoc.vim would add dummy Class
" If generate methods's signature, jsdoc.vim would add dummy Class
" signature. So ignore it.
if i == 0 && a:is_method
call s:insert_doc(d, a:start_lineno)
Expand Down Expand Up @@ -169,7 +170,7 @@ function! jsdoc#insert(...) abort
if is_not_range
let line = getline('.')
let is_method = line =~ s:is_method_regex && line !~ 'function(.*)\|function [A-z0-9_]\+(.*)\|function [A-z0-9_]\+\s\+(.*)'
if is_method
if is_method && line !~ s:is_declarelation
let lines = printf("%s\n%s", 'class ForJsDocDummyClass {', lines)
endif
endif
Expand Down
18 changes: 18 additions & 0 deletions tests/js.vader
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,24 @@ Expect javascript:
*/
function foo(arg, arg1 = 'foo', arg2 = 100) {}


Given javascript (async):
const foo = async foo(arg, arg1, arg2) => {}

Execute:
:JsDoc
:sleep 1

Expect javascript:
/**
* foo.
*
* @param {} arg
* @param {} arg1
* @param {} arg2
*/
const foo = async foo(arg, arg1, arg2) => {}

Given javascript (export default function):
export default function (arg1, arg2) {}

Expand Down