Skip to content
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

E492: Not an editor command: ScalaDoc #1

Open
noahlz opened this issue Jul 31, 2013 · 18 comments
Open

E492: Not an editor command: ScalaDoc #1

noahlz opened this issue Jul 31, 2013 · 18 comments

Comments

@noahlz
Copy link

noahlz commented Jul 31, 2013

I am getting this error when attempting :ScalaDoc in a scala file.

:help scaladoc works and displays the help text.

Python support is enabled (compile flag +python) and many other plugins work.

Ubuntu 12.04 LTS / Vim 7.3

@mdreves
Copy link
Owner

mdreves commented Aug 3, 2013

At first glance it appears to be installation related. Are you using pathogen or vundle? What directory did you install it to?

@noahlz
Copy link
Author

noahlz commented Aug 3, 2013

pathogen and .vim/bundle

:help scaladoc works and displays the help file

@noahlz
Copy link
Author

noahlz commented Aug 4, 2013

What is the minimum Python version? I am using 2.7.3

@mdreves
Copy link
Owner

mdreves commented Aug 7, 2013

2.7.3 is fine. I'm using 2.7.2. I can't see it being a ubunutu issue (I've tested on Mac), but I'll run a quick test later today when I get a chance to make sure.

@noahlz
Copy link
Author

noahlz commented Aug 10, 2013

@mdreves
Copy link
Owner

mdreves commented Aug 10, 2013

I tried with Ubuntu 12.04 / Vim 7.3 / Python 2.7.3 and it is working fine for me. Can you run this command and paste the output:

:set runtimepath?

@noahlz
Copy link
Author

noahlz commented Aug 11, 2013

runtimepath=/.vim,/.vim/bundle/CSApprox,/.vim/bundle/Command-T,/.vim/bundle/aftercolors,/.vim/bundle/auto-pairs,/.vim/bundle/conque_2.3,/.vim/bundle/nerdtree,/.vim/bundle/paredit.vim,/.vim/bundle/snipmate.vim,/.vim/bundle/surround,/.vim/bundle/taglist_46,/.vim/bundle/vim-airline,/.vim/bundle/vim-classpath,/.vim/bundle/vim-clojure-static,/.vim/bundle/vim-dispatch,/.vim/bundle/vim-fireplace,/.vim/bundle/vim-fugitive,/.vim/bundle/vim-markdown,/.vim/bundle/vim-pipe,/.vim/bundle/vim-redl,/.vim/bundle/vim-scala,/.vim/bundle/vim-scaladoc,/.vim/bundle/vimux,/var/lib/vim/addons
,/usr/share/vim/vimfiles,/usr/share/vim/vim73,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,
/.vim/bundle/CSApprox/after,/.vim/bundle/snipmate.vim/after,/.vim/bundle/vim-scala/after,~/.vim/after

@mdreves
Copy link
Owner

mdreves commented Aug 11, 2013

It's in your runtime path, so that's not the issue. Maybe try re-install?

cd ~/.vim/bundle
rm -rf vim-scaladoc
git clone git://github.com/mdreves/vim-scaladoc.git

There should be a ~/.vim/bundle/vim-scaladoc/plugin/scaladoc.vim file that contains the ScalaDoc mapping. You can also try running the following command directly to see if the rest of the installation is working:

:call scaladoc#Search("list")

@noahlz
Copy link
Author

noahlz commented Aug 11, 2013

It works after I manually execute

command -buffer -nargs=+ ScalaDoc :call scaladoc#Search('<f-args>')

@mdreves
Copy link
Owner

mdreves commented Aug 11, 2013

That's odd, can you restart and run the following:

:echo exists(":ScalaDoc")

@noahlz
Copy link
Author

noahlz commented Aug 11, 2013

:echo exists(":ScalaDoc")
2

Adding the following to my .vimrc works as well:

nnoremap K :call scaladoc#Search(expand("<cword>"))<CR>

@mdreves
Copy link
Owner

mdreves commented Aug 11, 2013

Did you reinstall? Unless you added the 'command -buffer...' to your .vimrc, after restart :ScalaDoc should have gone back to not working. So you are seeing :echo exists(":ScalaDoc") returning 2, and :ScalaDoc still not working. That's very strange.

I can take out the exists check for :ScalaDoc in my code, although I'm puzzled why it would behave this way. Alternatively you can add the 'command -buffer...' to your .vimrc for a quickfix.

@noahlz
Copy link
Author

noahlz commented Aug 12, 2013

What's in your vimrc related to this plugin?

I have been trying to resolve this issue on my own for about an hour, and nothing I am trying is working. I am following other plugins such as vim-fireplace (clojure plugin) as a model, as well as attempting some of the patterns described in this blog post by @sjl

http://stevelosh.com/blog/2011/09/writing-vim-plugins/

@noahlz
Copy link
Author

noahlz commented Aug 12, 2013

I took the following steps:

  1. Removed all plugins except pathogen and vim-scaladoc
  2. Changed .vimrc to contain only the following:
set nocompatible
call pathogen#infect() 

Result of :ScalaDoc list

Error detected while processing function scaladoc#Search:
line   23:
Traceback (most recent call last):
  File "<string>", line 11, in <module>
  File "/home/noahlz/.vim/bundle/vim-scaladoc/pylibs/scaladoc.py", line 71, in Search
    api_path = _FindLocalDocs(file_name)
  File "/home/noahlz/.vim/bundle/vim-scaladoc/pylibs/scaladoc.py", line 162, in _FindLocalDocs
    (path, tail) = os.path.split(path)
  File "/usr/lib/python2.7/posixpath.py", line 83, in split
    i = p.rfind('/') + 1
AttributeError: 'NoneType' object has no attribute 'rfind'
Press ENTER or type command to continue

@mdreves
Copy link
Owner

mdreves commented Aug 12, 2013

Your original problem doesn't seem to be there anymore. If you can run :ScalaDoc then the mapping is working. The problem you have now is that you are running from an unnamed file and vim-scaladoc uses your local file to try to find a path to local docs. I've uploaded a patch for this so that it will work on unnamed files as well.

Regarding what is in my .vimrc related to this plugin. I've tried it with and without any settings and it works for me. Let me know if you still see issues, although I'm still puzzled by why you were first seeing the :ScalaDoc not found issue. It's as if there was an incomplete download.

@noahlz
Copy link
Author

noahlz commented Aug 12, 2013

It works when I set up my .vimrc as in this commit

Understood that the error is due to running :ScalaDoc in an unnamed buffer.

@noahlz
Copy link
Author

noahlz commented Aug 12, 2013

Ok, I have solid reproduction steps for this issue:

  1. Only plugin installed with pathogen: vim-scaladoc
  2. Only contents of .vimrc:
set nocompatible
call pathogen#infect() 
  1. Start vim with just $ vim (don't specify an initial file on the command line). ScalaDoc function does not work.

  2. When starting vim with an initial file, i.e. $ vim HelloWorld.scala - it works as advertised.

@mdreves
Copy link
Owner

mdreves commented Aug 13, 2013

If you are referring to the AttributeError, then yes that is the bug fixed by my last push. If you are saying that :ScalaDoc is returning E492 then there is something not right with the installation or at least I can't reproduce it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants