heavenshell / vim-jsdoc

Generate JSDoc to your JavaScript code.
BSD 3-Clause "New" or "Revised" License
452 stars 44 forks source link

E492: Not an editor command: JsDoc #73

Closed liyuanqiu closed 4 years ago

liyuanqiu commented 6 years ago

Sorry to ask such a question here, because this is not your bug for certain. But I googled a lot of time, no solution found. So I have to seek for help here.

I use Vim 8.0.707 in Debian 9, and I clone this git repository into this path: ~/.vim/pack/plugins/start/vim-jsdoc Then I open my js file, type :JsDoc, and see this error: E492: Not an editor command: JsDoc But if I type :call jsdoc#insert(), it will add some docs to my function without prompts like the gif in the README.md

So how to setup my vim to enable :JsDoc and make it running like your gif?

Jikstra commented 6 years ago

Same problem for me using neovim 0.2.2 Workaround to have the :JsDoc command place this in your vim config: command! -register JsDoc call jsdoc#insert()

For your other problem, you need to enable prompting for those things. let g:jsdoc_allow_input_prompt = 1 enables all prompts. There are other options to fine control the prompting.

heavenshell commented 6 years ago

@liyuanqiu @Jikstra Sorry for late response(I did not notice this issue :-(). That's so strange. In my enviorment, I can generate via :JsDoc command.

@liyuanqiu Could you update your Vim more recent one?

liyuanqiu commented 6 years ago

@heavenshell Sorry I'm late too. I prepared a pure newly installed Debian 8, then install vim from vim github, the version is 8.0.1733. Same problem. I guess maybe your environment has some required installations that make :JsDoc work. Could you please take a test in a pure newly installed Debian system? I can give you a cloud server for test if you need.

heavenshell commented 6 years ago

@liyuanqiu Thx for information. I have some questions.

  1. What plugin manager do you use?
  2. Could you show me your minimal vimrc?
  3. Other plugin's command works fine?
  4. macOS and Ubutsu 16.04 works fine at my local. Could you try other OS?
  5. Tests are all passed. https://travis-ci.org/heavenshell/vim-jsdoc/jobs/317707031#L1717 https://github.com/heavenshell/vim-jsdoc/blob/master/tests/js.vader#L6

I guess maybe your environment has some required installations that make :JsDoc work.

JsDoc.vim is pure Vim script and no dependency.

I can give you a cloud server for test if you need.

Sounds nice, but first of all could you answer my questions?

heavenshell commented 6 years ago

Forgot to comment. One more question. What file do you open?(.js? .jsx? other?) Could you show me what filetype(:set ft) is.

liyuanqiu commented 6 years ago

@heavenshell

  1. What plugin manager do you use?

Vim 8 native plugin manager

git clone https://github.com/heavenshell/vim-jsdoc.git ~/.vim/pack/plugins/start/vim-jsdoc
  1. Could you show me your minimal vimrc?

No custom .vimrc file, all default.(Newly installed Debian 8, Newly installed Vim 8 with no custom configurations)

  1. Other plugin's command works fine?

After installed vim-jsdoc, I installed vim-vue and yats, they all work fine.(But they don't need any command, just syntax highlighting.)

  1. macOS and Ubutsu 16.04 works fine at my local. Could you try other OS?

I tried on my macOS, same problem.

what filetype(:set ft) is

filetype=javascript The extension name of my file is .js


Finally, I think it must be my fault on installation and configuration of this plugin. Could you please write a detail installation guide to help me using this plugin? I really need it.

heavenshell commented 6 years ago

@liyuanqiu Thank you.

Vim 8 native plugin manager

Umm, I also use Vim8's pack, but works fine.

2018-08-04 1 07 38

Hit :J<TAB>.

2018-08-04 1 09 28

Finally, I think it must be my fault on installation and configuration of this plugin. Could you please write a detail installation guide to help me using this plugin? I really need it.

git clone https://github.com/heavenshell/vim-jsdoc.git ~/.vim/pack/plugins/start/vim-jsdoc

That's all... Very strange...

liyuanqiu commented 6 years ago

@heavenshell Sorry for some incorrect feedback, after many trials, I found that if ~/.vimrc or ~/_vimrc existing, this plugin will not work, even if they are empty.

I'v send you an email which gives you a live host for testing.

You can login to that host, remove ~/.vimrc, then vim a.js, then :J<TAB>, works fine.

But if you touch ~/.vimrc, this plugin will not work.

kovalevsky0 commented 4 years ago

the issue is still actual I'm using:

heavenshell commented 4 years ago

Could you show me your rtp?

let s:save_cpo = &cpo
set cpo&vim

let path = &rtp
let paths = split(path, ',')
for p in paths
  if p =~ 'jsdoc'
    echomsg 'jsdoc exists'
  endif
endfor

let &cpo = s:save_cpo
unlet s:save_cpo
  1. save above Vim script to your local such as /path/to/rtp.vim
  2. do vim sample.js
  3. do :so /path/to/rtp.vim

If vim-jsdoc exists your rtp, it shows jsdoc exists to Vim's cmd area. If not, something wrong with your rtp.

スクリーンショット 2020-01-30 23 22 25
kovalevsky0 commented 4 years ago

@heavenshell that's what rtp show me Screenshot 2020-01-31 at 12 36 15 and when i tried to use JsDoc Screenshot 2020-01-31 at 12 32 57 also I've tried JsDoc on my other machine with macOS and everything is ok there

heavenshell commented 4 years ago

Thx for information! Hummm strange...

also I've tried JsDoc on my other machine with macOS and everything is ok there

Is it Vim? or Neovim? What is difference between ok and not ok machine?

heavenshell commented 4 years ago

Ver 2.0.0 was released. I Change command