slashmili / alchemist.vim

Elixir Integration Into Vim
https://github.com/slashmili/alchemist.vim/wiki
GNU General Public License v3.0
651 stars 38 forks source link

When trying to jump to a function definition: Error: "E484: Can't open file: b' ..." #164

Closed Tmw closed 4 years ago

Tmw commented 4 years ago

The issue

When hovering over a function / module name in vim (nvim) and pressing CTRL + ] to jump to its definition; vim displays an error with the following message:

E484: Can't open file: b'lib/custom_module.ex   

which; makes sense since the path is misformed by having a b' as a prefix. The file lib/custom_module.ex is correct. Reproduced it in the debugging setup as described in the Wiki.

1. Elixir/OTP/Python version

Elixir: 1.9.1 OTP: 22

$ elixir --version

Erlang/OTP 22 [erts-10.5.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe]

Elixir 1.9.1 (compiled with Erlang/OTP 22)

Python: 3.6.7

$ python --version
Python 3.6.7

2. Are you using VIM or Neovim? Please provide the version.

NeoVim version v0.4.3 on Mac OS Mojave (10.14.6)

NVIM v0.4.3 Build type: Release LuaJIT 2.0.5 Compilation: /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/tmp/neovim-20191107-13403-1or2rj3/neovim-0.4.3/build/config -I/tmp/neovim-20191107-13403-1or2rj3/neovim-0.4.3/src -I/usr/local/include -I/tmp/neovim-20191107-13403-1or2rj3/neovim-0.4.3/deps-build/include -I/usr/local/opt/gettext/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include -I/tmp/neovim-20191107-13403-1or2rj3/neovim-0.4.3/build/src/nvim/auto -I/tmp/neovim-20191107-13403-1or2rj3/neovim-0.4.3/build/include Compiled by brew@Mojave.local Features: +acl +iconv +tui See ":help feature-compile" system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/usr/local/Cellar/neovim/0.4.3/share/nvim"

3. Which pluging are you using:

 Plug 'neoclide/coc.nvim', {'branch': 'release'}                                                                                                
 Plug 'scrooloose/nerdtree'                                                                                                                     
 Plug 'ryanoasis/vim-devicons'                                                                                                                  
 Plug 'airblade/vim-gitgutter'                                                                                                                  
 Plug 'ctrlpvim/ctrlp.vim'                                                                                                                      
 Plug 'scrooloose/nerdcommenter'                                                                                                                
 Plug 'vim-airline/vim-airline'                                                                                                                 
 Plug 'vim-airline/vim-airline-themes'                                                                                                          
 Plug 'editorconfig/editorconfig-vim'                                                                                                           
 Plug 'tiagofumo/vim-nerdtree-syntax-highlight'                                                                                                 
 Plug 'mileszs/ack.vim'
 Plug 'morhetz/gruvbox'                                                                                                   
 Plug 'elixir-editors/vim-elixir'                                                                                                               
 Plug 'slashmili/alchemist.vim'                                                                                                                 
 Plug 'mhinz/vim-mix-format'                                                                                                                    
 "Plug 'dense-analysis/ale'                                                                                                                                                                                                                                
 Plug 'pangloss/vim-javascript'                                                                                                                 
 Plug 'prettier/vim-prettier', {                                                                                                                
   \ 'do': 'yarn install',                                                                                                                      
   \ 'for': ['javascript', 'typescript', 'css', 'less', 'scss', 'json',                                                                         
   \ 'graphql', 'markdown', 'vue', 'yaml', 'html'] }                                                                                            
Plug 'maxmellon/vim-jsx-pretty'     

4. Which steps of Debugging passed?

edborsa commented 4 years ago

Having the same issue here.

slashmili commented 4 years ago

Hey! Sorry for the late response. Looks like is related to python2 vs python3

/t/foo $ python3 ~/.vim/pack/minpac/start/alchemist.vim/elixir_sense_client -d./ -c8 -l1 -r definition < sample.exs
b'/private/tmp/elixir-20191106-52993-11bkenu/elixir-1.9.4/lib/elixir/lib/enum.ex:0'⏎                                                                                                           /t/foo $ python ~/.vim/pack/minpac/start/alchemist.vim/elixir_sense_client -d./ -c8 -l1 -r definition < sample.exs
/private/tmp/elixir-20191106-52993-11bkenu/elixir-1.9.4/lib/elixir/lib/enum.ex:0⏎

I'll try to comp up with a fix

slashmili commented 4 years ago

It's fixed in https://github.com/slashmili/alchemist.vim/commit/a5158d2e731afe3bca25a6a76eb706ff34e155b0