dsawardekar / wordpress.vim

Vim Plugin for WordPress Development
MIT License
166 stars 17 forks source link

Vim barfs errors on launch, fails to load syntax files #12

Closed evantravers closed 10 years ago

evantravers commented 10 years ago

I updated a while back, and suddenly it broke. Not sure which revision. I tried cloning it manually to my ~/.vim/bundle folder, and every single time when I removed the folder… the syntax would come back and no errors. Very strange. Thanks for all your hard work.

Here's the error log: https://gist.github.com/evantravers/1904b824100f15b569b3

Here's my .vimrc: https://github.com/evantravers/polka/blob/master/.vimrc

dsawardekar commented 10 years ago

The errors are a bit cryptic, but the only one that's important is the first one. The rest is just Vimscript being stupid and happily trying to continue even after a fatal error.

I've seen this particular kind of error with older versions of Vim. Older Vim has poor support for if-else statements. It just skips over conditionals it doesn't like!

WordPress.vim needs at least Vim 7.3patch97+. Sometime there are multiple Vim versions installed, sudo can use a different Vim etc. Please confirm that you have the right Vim.

evantravers commented 10 years ago

I just upgraded vim via brew… that may very well be the issue. Here's the results of vim --version:

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled May  5 2014 08:33:41)
MacOS X (unix) version
Included patches: 1-273
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +syntax
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
-balloon_eval    +float           +mouse_urxvt     -tag_any_white
-browse          +folding         +mouse_xterm     -tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         -gettext         -mzscheme        +textobjects
-clientserver    -hangul_input    +netbeans_intg   +title
+clipboard       +iconv           +path_extra      -toolbar
+cmdline_compl   +insert_expand   -perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python          +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con      -lua             +rightleft       +windows
+diff            +menu            +ruby            +writebackup
+digraphs        +mksession       +scrollbind      -X11
-dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     -xim
+emacs_tags      -mouseshape      -sniff           -xsmp
+eval            +mouse_dec       +startuptime     -xterm_clipboard
+ex_extra        -mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    -xpm
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H   -F/usr/local/Frameworks -DMACOS_X_UNIX  -Os -w -pipe -march=native -mmacosx-version-min=10.9 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: /usr/bin/clang   -L. -L/Users/evantravers/.rbenv/versions/2.0.0-p247/lib  -L/usr/local/lib -F/usr/local/Frameworks -Wl,-headerpad_max_install_names -o vim        -lm  -lncurses -liconv -framework Cocoa    -framework Python   -lruby-static -lobjc -L/Users/evantravers/.rbenv/versions/2.0.0-p247/lib
evantravers commented 10 years ago

Just in case, I ran `brew update && brew uninstall vim && brew install vim, but no dice.

davidosomething commented 10 years ago

try this

brew install python3
brew install macvim --custom-icons --override-system-vim --withlua --withpython3
brew linkapps
evantravers commented 10 years ago

I'm not really a macvim guy… usually just roll in the terminal. I don't really want to do the --override-system-vim flag at the moment. I will try and reinstall vim with lua and python3.

dsawardekar commented 10 years ago

I did some digging around, seems like Vim introduced a regression in 7.4.p260. Some discussion here and here. Seems like syntastic was also effected. Does syntastic work for you?

evantravers commented 10 years ago

Thus far I haven't noticed anything weird about it… if you want, you can close this as unrelated to you.

On Wed, May 7, 2014 at 9:48 AM, Darshan Sawardekar <notifications@github.com

wrote:

I did some digging around, seems like Vim introduced a regression in 7.4.p260. Some discussion herehttps://github.com/neovim/neovim/issues/387and here https://github.com/neovim/neovim/pull/602. Seems like syntastic was also effected. Does syntastic work for you?

— Reply to this email directly or view it on GitHubhttps://github.com/dsawardekar/wordpress.vim/issues/12#issuecomment-42436370 .

dsawardekar commented 10 years ago

No worries, anyone else having the same problem can chime in.

I'm not on a Mac at the moment, so can't effectively debug this. But WordPress.vim has a decent test suite. If you can setup a dev environment(see contributing.md), you'll be able to run the test suite. That would help narrow down the list of things quite a bit.

DArcMattr commented 10 years ago

Vim 7.4 patches 264 and 265 allegedly fix the problem, but it still breaks on a lot of plugins. If you're crafty, you can build Vim without those patches.

tnorthcutt commented 10 years ago

I'm not sure if this is related, but I'm seeing errors on startup. Here's a screenshot:

2014-05-12 at 3 27 pm

I'm happy to help debug however I can, but I'm not sure what next steps to take with this. @dsawardekar, would you prefer I open a separate issue for this?

dsawardekar commented 10 years ago

@tnorthcutt That looks similar to #2. Yes, it would be best to open a new issue for this. Please include your WordPress.vim version, wp-cli version and the output of wp cli cmd-dump.

dsawardekar commented 10 years ago

@DArcMattr Any idea if this change alters how OO Vimscript is written? WordPress.vim uses the OO layer provided by Riml.

Riml does this by writing a series of funcrefs and then links them to an object's dictionary. The funcrefs are prefixed as are the linked functions.

My guess is something to do with this prefixing was changed in Vim with these patches. Not sure what though...

DArcMattr commented 10 years ago

The Syntastic project also got hit by the changes from Vim patch 260. And it's been fixed in by removing some functions from global scope to be local.

dsawardekar commented 10 years ago

Interesting. I ran the plugin and autoload vim files through vimlint. But it didn't produce any errors. And there aren't any global calls in the plugin that I'm aware of.

The first error at which @evantravers's Vim is struggling with is,

E884: Function name cannot contain a colon: s:AutocmdLoader_set_group_name(group_name) dict

Which corresponds to this line. This is idiomatic Vimscript to create a script local function as far as I can tell.

dsawardekar commented 10 years ago

Also odd is that there another similar script local function defined just above that also contains a colon in it's name, s:SID.

DArcMattr commented 10 years ago

To make things even more confusing, vim-markdown fixed a similar problem that was triggered by the recent vim patches, but by switching variables from buffer-local to script-local.

dsawardekar commented 10 years ago

I'm confused now. Shouldn't this mean that Functions with colons like the above s:AutocmdLoader are Ok!?

devhell commented 10 years ago

I'm seeing the same issue with vim 7.4.307. I've got a lot of plugins installed with vundle, and so far portkey and ember are the ones where vim will crap out.

kevashcraft commented 10 years ago

There's a discussion about the patch and this error here - https://groups.google.com/forum/#!topic/vim_dev/Z_DelYZwtv0

dsawardekar commented 10 years ago

@kevashcraft Thanks. That does clarify things quite a bit. I think I have a better understanding of the problem now. Will report back once I have a solution.

dsawardekar commented 10 years ago

I have pushed a new branch that contains a potential fix for this issue. It manually removes the SNR prefixes. I've tested it on p260 and upto Vim master and it seems to work fine. Please verify and let me know.

If possible please test with this branch on Vim older than and newer than patch 260.

You can switch to this branch with,

$ git checkout -b issue-12 origin/feature/manually-remove-snr-prefixes

Once verified I'll try to get this fix into upstream Riml and cut a release.

/cc @evantravers

kevashcraft commented 10 years ago

That branch is not throwing errors anymore, but I'm also not seeing any of the wordpress functions in the autocomplete dialog.

screenshot - 06262014 - 08 28 10 am

dsawardekar commented 10 years ago

Are you inside a WordPress project? The plugin only kicks in if you are editing a WordPress PHP file. Try opening something like wp-load.php etc.

kevashcraft commented 10 years ago

Ah. Okay. I loaded an index.php file inside of /wp-content/themes and got the following

"www/wordpress.two/wp-content/themes/kandk/index.php" [noeol] 16L, 461C Error detected while processing function 14_WordPressPlugin_on_buffer_open..14_WordPressPlug in_get_app: line 2: E117: Unknown function: wordpress#app E15: Invalid expression: wordpress#app() line 4: E716: Key not present in Dictionary: app E15: Invalid expression: self.app Error detected while processing function 14_WordPressPlugin_on_buffer_open: line 4: E488: Trailing characters Error detected while processing function 14_WordPressPlugin_on_buffer_enter..14_WordPressPlu gin_get_app: line 2: E117: Unknown function: wordpress#app E15: Invalid expression: wordpress#app() line 4: E716: Key not present in Dictionary: app E15: Invalid expression: self.app Error detected while processing function 14_WordPressPlugin_on_buffer_enter: line 2: E488: Trailing characters Press ENTER or type command to continue

dsawardekar commented 10 years ago

Not good... It's not finding the bootstrap app function now. I'll need to investigate further. The underlying problem needs to be fixed in the Riml -> Viml compiler. I haven't been able to reach @luke-gru so far.

At the moment only thing I can suggest is to try to use a version of Vim < 7.4 patch 260. Most unixy systems will have a copy of Vim in places like /usr/local/bin/ and so on. I've been running it on Vim 7.4 p214 for a while now without issues.

dsawardekar commented 10 years ago

Finally managed to get some time to wrap this up. Thanks to @tek's Riml fork this is now fixed. Apologies for the delay. Tested up to Vim 7.4 p345, but if you find issues let me know.