roxma / nvim-completion-manager

:warning: PLEASE USE https://github.com/ncm2/ncm2 INSTEAD
MIT License
917 stars 49 forks source link

javascript completion problems with window/document object #74

Closed luofish closed 7 years ago

luofish commented 7 years ago

hi, @roxma My javascript completion works well except document and window object completion. As you can see from below gif, I can't get document.getElementById & window.addEventListener completion. I'm not sure where is problem. My neovim is 0.21. Ncm & nvim-cm-tern is latest.

.tern-project

image

ncm

roxma commented 7 years ago

Could you provide a minimal vimrc to reproduce this issue? I cannot reproduce it.

luofish commented 7 years ago

sure, Note that my neovim is 0.2.1dev. key point is document regard as Key.

image

Plug 'vimwiki' Plug 'haya14busa/incsearch.vim' Plug 'flazz/vim-colorschemes' Plug 'skywind3000/asyncrun.vim' Plug 'terryma/vim-smooth-scroll' Plug '907th/vim-auto-save' Plug 'itchyny/lightline.vim'

Plug 'tpope/vim-fugitive' Plug 'tpope/vim-unimpaired'

Plug 'gregsexton/gitv', {'on': ['Gitv']} Plug 'eparreno/vim-l9' Plug 'lambdalisue/lista.nvim' Plug 'easymotion/vim-easymotion' Plug 'Chun-Yang/vim-action-ag' Plug 'jeetsukumaran/vim-filebeagle' Plug 'kien/ctrlp.vim' Plug 'tacahiroy/ctrlp-funky' Plug 'simeji/winresizer' Plug 'kien/rainbow_parentheses.vim'

"====================== General Programing ======================== Plug 'tpope/vim-surround' Plug 'jiangmiao/auto-pairs' Plug 'w0rp/ale' Plug 'rking/ag.vim' Plug 'airblade/vim-gitgutter' Plug 'vim-scripts/matchit.zip' Plug 'tpope/vim-commentary' Plug 'roxma/nvim-completion-manager' Plug 'godlygeek/tabular' Plug 'rhysd/conflict-marker.vim' Plug 'SirVer/ultisnips' Plug 'honza/vim-snippets' Plug 'nelstrom/vim-visual-star-search' Plug 'alvan/vim-closetag' Plug 'terryma/vim-expand-region' Plug 'terryma/vim-multiple-cursors'

"====================== Front End ======================== Plug 'chemzqm/vim-jsx-improve' Plug 'metakirby5/codi.vim'

Plug 'roxma/nvim-cm-tern', {'do': 'npm install'} Plug 'autozimu/LanguageClient-neovim', { 'do': ':UpdateRemotePlugins' }

"typescript " Plug 'leafgarland/typescript-vim' " Plug 'Quramy/tsuquyomi' " Plug 'HerringtonDarkholme/yats.vim' " Plug 'jason0x43/vim-js-indent' " Plug 'ianks/vim-tsx'

" Initialize plugin system call plug#end()

set nocompatible " be iMproved set fenc=utf-8

set wildignore+=*/node_modules/* set wildignore+=/tnpm/* set wildignore+=/tmp/,.so,.swp,.zip " MacOSX/Linux

set fileencodings=ucs-bom,utf-8,cp936,gb2312,gb18030,big5 set number set relativenumber set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
set smarttab set sidescroll=10 set hlsearch set ignorecase set incsearch set wrapscan set noswapfile set nobackup set iskeyword +=- set hidden set autoindent set guifont=Consolas\ 12 set fdm=syntax set ttimeoutlen=50 set foldlevel=99 set completeopt=longest,menuone set completeopt-=preview set background=dark set mouse=a

colorscheme gruvbox

set suffixesadd+=.js set suffixesadd+=.jsx set suffixesadd+=.css set nostartofline set path+=$PWD/src/** set noshowmode set guitablabel=%t set noimdisable set inccommand=split " Neovim support

let g:ctrlp_custom_ignore = '\v[\/].(git|hg|svn)$' let g:ctrlp_custom_ignore = { \ 'dir': '\v[\/].(git|hg|svn)$', \ 'file': '\v.(exe|so|dll)$', \ 'link': 'some_bad_symbolic_links', \ } let g:ctrlp_map = '' let g:ctrlp_cmd = 'CtrlP' let g:ctrlp_working_path_mode = '0'

if executable('ag') set grepprg=ag\ --nogroup\ --nocolor let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' let g:ctrlp_use_caching = 0 endif

filetype plugin on filetype off syntax on

let g:UltiSnipsExpandTrigger="" let mapleader = " " let g:jsx_ext_required = 0 " Allow JSX in normal JS files let g:auto_save = 1 " enable AutoSave on Vim startup

let g:lightline = { \ 'colorscheme': 'wombat', \ 'active': { \ 'left': [ [ 'mode', 'paste' ], \ ['fugitive', 'readonly', 'filename', 'modified'] ] \ }, \ 'component': { \ 'readonly': '%{&filetype=="help"?"":&readonly?"--":""}', \ 'modified': '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}', \ 'fugitive': '%{exists("fugitive#head")?fugitive#head():""}' \ }, \ 'component_visible_condition': { \ 'readonly': '(&filetype!="help"&& &readonly)', \ 'modified': '(&filetype!="help"&&(&modified||!&modifiable))', \ 'fugitive': '(exists("fugitive#head") && ""!=fugitive#head())' \ } \ }

let g:closetag_filenames = ".html,.xhtml,.phtml,.jsx,*.js" let g:multi_cursor_start_key=''

autocmd! InsertLeave set imdisable|set iminsert=0 autocmd! InsertEnter set noimdisable|set iminsert=0

autocmd InsertEnter let save_cwd = getcwd() | set autochdir autocmd InsertLeave set noautochdir | execute 'cd' fnameescape(save_cwd)

" iterm cursor set let $NVIM_TUI_ENABLE_CURSOR_SHAPE = 1 let &t_SI .= "\[5 q" let &t_SR .= "\[4 q" let &t_EI .= "\[3 q"

au VimEnter RainbowParenthesesToggle au Syntax RainbowParenthesesLoadRound au Syntax RainbowParenthesesLoadSquare au Syntax RainbowParenthesesLoadBraces

if $TERM_PROGRAM =~ "iTerm" set termguicolors endif

augroup autoQuick autocmd! autocmd QuickFixCmdPost [^l] cwindow autocmd QuickFixCmdPost l lwindow augroup END

roxma commented 7 years ago

Sorry, by minimal vimrc I mean you need to remove irrelevant code to reduce the read/debug effort. Normally it should be no more than 50 lines of vimrc unless there's a reason.

luofish commented 7 years ago

haha, 😄, It turns out to be I misspell .tern-project. It should be libs not lib. Anyway, thanks for this good plug! It's very fast.