juliosueiras / vim-terraform-completion

A (Neo)Vim Autocompletion and linter for Terraform, a HashiCorp tool
MIT License
336 stars 24 forks source link

cant get completion to work with neovim #50

Closed lanox closed 4 years ago

lanox commented 5 years ago

Hi,

I cant seem to get this working with neovim,

I have installed the following plugins,

Plug 'hashivim/vim-terraform'
Plug 'juliosueiras/vim-terraform-completion'
Plug 'w0rp/ale'   < -- although not sure if this is supported as I use this instead on syntastic

this is my CheckHealth output

health#deoplete#check
========================================================================
## deoplete.nvim
  - OK: exists("v:t_list") was successful
  - OK: has("timers") was successful
  - OK: has("python3") was successful
  - INFO: If you're still having problems, try the following commands:
    $ export NVIM_PYTHON_LOG_FILE=/tmp/log
    $ export NVIM_PYTHON_LOG_LEVEL=DEBUG
    $ nvim
    $ cat /tmp/log_{PID}
    and then create an issue on github

health#nvim#check
========================================================================
## Configuration
  - ERROR: 'paste' is enabled. This option is only for pasting text.
    It should not be set in your config.
    - ADVICE:
      - Remove `set paste` from your init.vim, if applicable.
      - Check `:verbose set paste?` to see if a plugin or script set the option.

## Performance
  - OK: Build type: Release

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=^H
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  - INFO: $TERM_PROGRAM='iTerm.app'
  - INFO: $COLORTERM='truecolor'

health#provider#check
========================================================================
## Clipboard (optional)
  - OK: Clipboard tool found: pbcopy

## Python 2 provider (optional)
  - WARNING: No Python interpreter was found with the neovim module.  Using the first available for diagnostics.
  - ERROR: Python provider error
    - ADVICE:
      - provider/pythonx: Could not load Python 2:
          /usr/local/bin/python2 does not have the "neovim" module. :help |provider-python|
          /usr/local/bin/python2.7 does not have the "neovim" module. :help |provider-python|
          python2.6 not found in search path or not executable.
          /usr/local/bin/python does not have the "neovim" module. :help |provider-python|
  - INFO: Executable: Not found

## Python 3 provider (optional)
  - INFO: `g:python3_host_prog` is not set.  Searching for python3 in the environment.
  - INFO: Executable: /usr/local/bin/python3
  - INFO: Python3 version: 3.7.0
  - INFO: python3-neovim version: 0.2.6
  - OK: Latest python3-neovim is installed: 0.2.6

## Ruby provider (optional)
  - INFO: Ruby: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
  - INFO: Host: /usr/local/bin/neovim-ruby-host
  - OK: Latest "neovim" gem is installed: 0.7.1

## Node.js provider (optional)
  - INFO: Node.js: v10.9.0
  - WARNING: Missing "neovim" npm (or yarn) package.
    - ADVICE:
      - Run in shell: npm install -g neovim
      - Run in shell (if you use yarn): yarn global add neovim

also have this set in init.vim

" (Optional)Remove Info(Preview) window
set completeopt-=preview

" (Optional)Hide Info(Preview) window after completions
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif

" (Optional) Enable terraform plan to be include in filter
let g:syntastic_terraform_tffilter_plan = 1

" (Optional) Default: 0, enable(1)/disable(0) plugin's keymapping
let g:terraform_completion_keys = 1

" (Optional) Default: 1, enable(1)/disable(0) terraform module registry completion
let g:terraform_registry_module_completion = 0
let g:deoplete#omni_patterns = {}
let g:deoplete#omni_patterns.terraform = '[^ *\t"{=$]\w*'
let g:deoplete#enable_at_startup = 1
call deoplete#initialize()

any ideas on why autocompletion doesn't work ?

thanks

esn89 commented 5 years ago

I think you might have the same issue as https://github.com/juliosueiras/vim-terraform-completion/issues/49

lanox commented 5 years ago

I still can't get this to work. I have followed the issues #49, but no luck.

lanox commented 5 years ago

Well got it further but, i get Omni completion (^O^N^P) Pattern not found and neither instructions fro deoplete worked for me.

lanox commented 5 years ago

@juliosueiras any help would be appreciated.

bzub commented 5 years ago

Here's a log with some exceptions that seem relevant to this issue, when I try omnicomplete after typing resource "

exceptions.log

juliosueiras commented 5 years ago

updated the repo due to dein.vim load ftplugin very differently from others(dein.vim apparently collect ftplugin and overwrite them)

so pull the newest update of the repo and follow this

Neovim version: 0.3.1

lanox commented 5 years ago

Hi @juliosueiras I don't understand, in you video you have the same issue all the way to end ? I am not sure what I am looking at or what to follow. ? I am grateful that you spend time to write this plugin and to support it, but I think your approach on helping people using this plugin is quiet poor.

juliosueiras commented 5 years ago

wait, are you sure?, since the video show completion working

On Fri, Oct 12, 2018 at 1:20 AM lanox notifications@github.com wrote:

Hi @juliosueiras https://github.com/juliosueiras I don't understand, in you video you have the same issue all the way to end ? I am not sure what I am looking at or what to follow. ? I am grateful that you spend time to write this plugin and to support it, but I think your approach on helping people using this plugin is quiet poor.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/juliosueiras/vim-terraform-completion/issues/50#issuecomment-429207496, or mute the thread https://github.com/notifications/unsubscribe-auth/ADgoLig3ET2uDg2kbe89X733Cq3pGs1fks5ukCa2gaJpZM4Wmxy2 .

lanox commented 5 years ago

Yes, sorry my bad, it shows it’s working, but it is not working for me, I still get the error I mentioned above.

I have followed readme and did exactly as it states, with out any luck.

I am not exactly sure what I am following in that video.

juliosueiras commented 5 years ago

Just double checking everything

A) what neovim version are you using?

B) what is your plugin manager?

C) you have json gem installed? (or can use require "json" in ruby

lanox commented 5 years ago

A) what neovim version are you using? NVIM v0.3.1 B) what is your plugin manager? Plug C) you have json gem installed? (or can use require "json" in ruby gem list shows

json (default: 2.1.0) also check health shows

## Ruby provider (optional)
  - INFO: Ruby: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
  - INFO: Host: /usr/local/bin/neovim-ruby-host
  - OK: Latest "neovim" gem is installed: 0.7.1
juliosueiras commented 5 years ago

can you double check this https://asciinema.org/a/CZH4fT2u1IIRUcn3wcFZVWnzk and see if I am using the same config as you? (Neovim 0.3.1, same ruby neovim gem version, and json 2.1.0)

lanox commented 5 years ago

@juliosueiras I have no idea why this is not working for me, I copied your config from asciiname video and created new init.conf.

This is what I have now in my init.conf and it's still not working. Also I am running macos, with homebrew I dunno if that has anything to do with.

if &compatible                                                                            
 set nocompatible                                                                         
endif                                                                                     

" - For Neovim: ~/.local/share/nvim/plugged                                               
" - Avoid using standard Vim directory names like 'plugin'                                
call plug#begin('~/.config/nvim/plugged')                                                  
Plug 'hashivim/vim-terraform'                                                             
Plug 'juliosueiras/vim-terraform-completion'                                              
Plug 'w0rp/ale'                                                                           
Plug 'Shougo/deoplete.nvim'                                                               
call plug#end()                                                                           

filetype plugin indent on                                                                 
syntax enable                                                                             

" (Optional)Remove Info(Preview) window                                                   
set completeopt-=preview                                                                  

" (Optional)Hide Info(Preview) window after completions                                   
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif                                  
autocmd InsertLeave * if pumvisible() == 0|pclose|endif 

" (Optional) Enable terraform plan to be include in filter                                
let g:syntastic_terraform_tffilter_plan = 1                                               

" (Optional) Default: 0, enable(1)/disable(0) plugin's keymapping                         
let g:terraform_completion_keys = 1                                                       

" (Optional) Default: 1, enable(1)/disable(0) terraform module registry completion        
let g:terraform_registry_module_completion = 0     

let g:deoplete#omni_patterns = {}
call deoplete#custom#option('omni_patterns', {
\ 'complete_method': 'omnifunc',
\ 'terraform': '[^ *\t"{=$]\w*',
\})

call deoplete#initialize()
kinowarrior commented 5 years ago

In the same situation, very similar setup to @lanox

kinowarrior commented 5 years ago

syntax & formatting works great, but autocompletion is a no show. use w0rp/ale too - understand that means no linting options?

kinowarrior commented 5 years ago

With <c-x><c-o> to initiate omnicomplete, I receive E117: Unknown function: terraformcomplete#Complete

kinowarrior commented 5 years ago

Well, after quite a bit of digging around, I got everything working great for autocompletion, and ctags / tagbar support too.

terraform-vim

In my situation, the problem was related to my path entries being a mess in .zshrc. At some point, a path_helper entry was added which meant my environment was picking up system/brew version of ruby and not the intended rbenv global env where I had installed neovim gem etc. Sorting out the $PATH issue, and getting the correct ordering resolved this problem.

Environment is: MacOs Mojave, Neovim 0.3.4, with iTerm & Tmux in case it assists others. Very similar plugins setup to the OP.

May try installing neomake to get linting working... Thanks to all the maintainers for providing this excellent Plugin. Appreciated.

hposca commented 5 years ago

I had a similar problem. To fix it I had to install neovim gem and make sure that ruby and json were installed:

brew install ruby
gem install json neovim