Skip to content
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
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,23 @@ make clean
make install
```

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

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

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

#### Installing on Windows

```console
# cd to <vim-jsdoc path>/lib
npm install
```

If you want to set the path of [lehre](https://www.npmjs.com/package/lehre) manually on Windows, you should use the path with the file extension `.cmd`, such as `/path/to/node_modules/.bin/lehre.cmd`.

## Usage

1. Move cursor on `function` keyword line
Expand Down
18 changes: 13 additions & 5 deletions autoload/jsdoc.vim
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,19 @@ set cpo&vim

let g:jsdoc_templates_path = get(g:, 'jsdoc_templates_path', '')
let g:jsdoc_formatter = get(g:, 'jsdoc_formatter', 'jsdoc')
let g:jsdoc_lehre_path = get(
\ g:,
\ 'jsdoc_lehre_path',
\ printf('%s/lib/lehre', expand('<sfile>:p:h:h'))
\ )
if has("win64") || has("win32") || has("win16")
let g:jsdoc_lehre_path = get(
\ g:,
\ 'jsdoc_lehre_path',
\ printf('%s/lib/node_modules/.bin/lehre.cmd', expand('<sfile>:p:h:h'))
\ )
else
let g:jsdoc_lehre_path = get(
\ g:,
\ 'jsdoc_lehre_path',
\ printf('%s/lib/lehre', expand('<sfile>:p:h:h'))
\ )
endif

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*\).*$'
Expand Down