tpope / vim-fireplace

fireplace.vim: Clojure REPL support
https://www.vim.org/scripts/script.php?script_id=4978
1.74k stars 139 forks source link

E776: No location list when getting an error #331

Closed tomgeorge closed 5 years ago

tomgeorge commented 5 years ago

~/.vimrc

set nocompatible
filetype off 
set rtp+=~/.vim/bundle/Vundle.vim

call vundle#begin()
Plugin 'tpope/vim-fireplace'
call vundle#end()
syntax on
filetype plugin indent on
set shiftwidth=2
set tabstop=2
set expandtab
set guicursor=
" colorscheme vividchalk
se nu
set ruler

This affects neovim and vim on my system, but I am able to reproduce the error with the vim that came with my system (fedora 28):

VIM - Vi IMproved 8.1 (2018 May 18, compiled Jan  8 2019 08:44:41)
Included patches: 1-702
Modified by <bugzilla@redhat.com>
Compiled by <bugzilla@redhat.com>
Huge version without GUI.  Features included (+) or not (-):
+acl               +extra_search      +mouse_netterm     +tag_old_static
+arabic            +farsi             +mouse_sgr         -tag_any_white
+autocmd           +file_in_path      -mouse_sysmouse    -tcl
+autochdir         +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
-balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
-browse            +fork()            -mzscheme          +textobjects
++builtin_terms    +gettext           +netbeans_intg     +textprop
+byte_offset       -hangul_input      +num64             +timers
+channel           +iconv             +packages          +title
+cindent           +insert_expand     +path_extra        -toolbar
-clientserver      +job               +perl/dyn          +user_commands
-clipboard         +jumplist          +persistent_undo   +vartabs
+cmdline_compl     +keymap            +postscript        +vertsplit
+cmdline_hist      +lambda            +printer           +virtualedit
+cmdline_info      +langmap           +profile           +visual
+comments          +libcall           +python/dyn        +visualextra
+conceal           +linebreak         +python3/dyn       +viminfo
+cryptv            +lispindent        +quickfix          +vreplace
+cscope            +listcmds          +reltime           +wildignore
+cursorbind        +localmap          +rightleft         +wildmenu
+cursorshape       +lua/dyn           +ruby/dyn          +windows
+dialog_con        +menu              +scrollbind        +writebackup
+diff              +mksession         +signs             -X11
+digraphs          +modify_fname      +smartindent       -xfontset
-dnd               +mouse             +startuptime       -xim
-ebcdic            -mouseshape        +statusline        -xpm
+emacs_tags        +mouse_dec         -sun_workshop      -xsmp
+eval              +mouse_gpm         +syntax            -xterm_clipboard
+ex_extra          -mouse_jsbterm     +tag_binary        -xterm_save
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/etc"
 f-b for $VIMRUNTIME: "/usr/share/vim/vim81"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/python3.6m -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: gcc   -L. -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,--enable-new-dtags -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld  -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -L/usr/local/lib -Wl,--as-needed -o vim        -lm  -lselinux   -lncurses -lacl -lattr -lgpm -ldl   -Wl,--enable-new-dtags -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector-strong -L/usr/local/lib  -L/usr/lib64/perl5/CORE -lperl -lpthread -lresolv -ldl -lm -lcrypt -lutil -lc        

When I try to eval a file, or the defroutes form that has an error in it (this is generated straight from lein new compojure:

(ns dexcom-rest-api.handler
  (:require [compojure.core :refer :all]
            [compojure.route :as route]
            [ring.middleware.defaults :refer [wrap-defaults site-defaults]]
            [ring.util.response :rerfer [ok]]))

(defroutes app-routes
  (GET "/" [] "Hello World")
  (GET "/health" [] (ok))
  (route/not-found "Not Found"))

(def app
  (wrap-defaults app-routes site-defaults))

I see the following error:

Vim(return):Traceback (most recent call last):

When I try to open the loclist, I get E776: No location list

tpope commented 5 years ago

That's a mighty cryptic error. Recent versions should give you a bit more in :echo g:fireplace_last_python_exception.

tomgeorge commented 5 years ago

I'm getting an error when I try to echo that out.

E121: Undefined variable: g:fireplace_last_python_exception                                                                                                                                   
E15: Invalid expression: g:fireplace_last_python_exception                                                                                                                                    
Press ENTER or type command to continue                      

A little more diagnostic info:

java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-b13)
OpenJDK 64-Bit Server VM (build 25.191-b13, mixed mode)
lein version 
Warning: implicit hook found: lein-environ.plugin/hooks 
Hooks are deprecated and will be removed in a future version.
Leiningen 2.9.1 on Java 1.8.0_191 OpenJDK 64-Bit Server VM
tpope commented 5 years ago

Did you trigger a Traceback (most recent call last) error first? That variable won't exist if not.

tomgeorge commented 5 years ago

Yes, I eval-d some bad clojure code and tried to echo it, and I'm still getting the E121: Undefined variable message

tpope commented 5 years ago

There's nothing else to the original error? Just Vim(return):Traceback (most recent call last):?

tomgeorge commented 5 years ago

That's correct. I posted an asciinema of it here if you want to take a look

edit: link

tpope commented 5 years ago

Well that rules out some things. Try deleting this catch clause and try again.

tomgeorge commented 5 years ago

Which catch clause do you want me delete? The link just goes to plugin/fireplace.vim, but no line number. I deleted the catches in most of the eval-looking functions in a sort of shotgun approach, with no effect.

tpope commented 5 years ago

Whoops, butchered the link. https://github.com/tpope/vim-fireplace/blob/cf0537f683ef6195fee453f330510b95536c8861/plugin/fireplace.vim#L890-L894

tomgeorge commented 5 years ago

Removing that catch clause showed an error message from the compiler, and lopen opened up a stacktrace.

tpope commented 5 years ago

I'm officially confused. There's no higher level catch in the :Eval implementation, so I don't know why removing a catch clause would allow it to succeed. You didn't update Fireplace in the interim did you?

tomgeorge commented 5 years ago

I removed the catch clause that you told me about, and that seemed to show the stacktrace/location lists. cd-ing to ~/.vim/bundle/vim-fireplace and doing a git checkout -- of fireplace.vim reintroduced the issue.

tpope commented 5 years ago

I'm out of good things to check for. Make sure :verbose command Eval points back to fireplace.vim.

tomgeorge commented 5 years ago

That does point back to plugin/fireplace.vim. I'll try running vim with fireplace in a couple of docker containers, maybe I will have better luck with different environments.

Also, thanks for working through this with me, and all your work on the vim ecosystem :bowing_man:

tpope commented 5 years ago

Recent changes might have fixed this.

tpope commented 5 years ago

This error should be impossible on master now.