othree / jspc.vim

JavaScript Parameter Complete
http://www.vim.org/scripts/script.php?script_id=5060
MIT License
61 stars 1 forks source link

E121: Undefined variable: jspc#javascript #7

Closed goldylucks closed 5 years ago

goldylucks commented 5 years ago

I'm getting this error whenever pressing tab when trying to autocomplete some javascript function.

Any ideas where to look into this?

Thanks in advance!

Peek 2019-08-02 08-45

othree commented 5 years ago

Can you execute :echom &filetype and see the output

goldylucks commented 5 years ago

sure, it's javascript.jsx, even tho the file extension is .js

othree commented 5 years ago

Please try the fix

goldylucks commented 5 years ago

Thank you for that. I'm getting now a different error

Omni completion (^O^N^P) Pattern not found

Which I think isn't related to jspc at all, correct?

othree commented 5 years ago

Not sure why no pattern found. Can you do some A/B test?

goldylucks commented 5 years ago

Try normal js file (filetype is javascrip)

The file in question is normal js file, but for some reason vim thinks it's jsx

Try editing a empty js file. Not other codes.

Same thing happens

Try disable all other omni funciton plugins.

Still same error.

Here's my .vimrc and .vim/.plug.vim if it helps

.vim/.plug.vim " ============================================================================= " Plugin Manager Setup " ============================================================================= " filetype off " Install the plugin manager if it doesn't exist let s:plugin_manager=expand('~/.vim/autoload/plug.vim') let s:plugin_url='https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' if empty(glob(s:plugin_manager)) echom 'vim-plug not found. Installing...' if executable('curl') silent exec '!curl -fLo ' . s:plugin_manager . ' --create-dirs ' . \ s:plugin_url elseif executable('wget') call mkdir(fnamemodify(s:plugin_manager, ':h'), 'p') silent exec '!wget --force-directories --no-check-certificate -O ' . \ expand(s:plugin_manager) . ' ' . s:plugin_url else echom 'Could not download plugin manager. No plugins were installed.' finish endif augroup vimplug autocmd! autocmd VimEnter * PlugInstall augroup END endif " Create a horizontal split at the bottom when installing plugins let g:plug_window = 'botright new' let g:plug_dir = expand('~/.vim/bundle') call plug#begin(g:plug_dir) " PlugInstall and PlugUpdate will clone fzf in ~/.fzf and run the install script Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'junegunn/fzf.vim' Plug 'scrooloose/nerdcommenter' Plug 'tpope/vim-fugitive' Plug 'mattn/emmet-vim' Plug 'kien/ctrlp.vim' Plug 'haishanh/night-owl.vim' Plug 'prettier/vim-prettier', { 'do': 'yarn install' } Plug 'dense-analysis/ale' Plug 'airblade/vim-gitgutter' Plug 'editorconfig/editorconfig-vim' Plug 'mattn/emmet-vim' Plug 'terryma/vim-multiple-cursors' Plug 'tpope/vim-surround' " https://github.com/SirVer/ultisnips " Track the engine. Plug 'SirVer/ultisnips' " Snippets are separated from the engine. Add this if you want them: Plug 'honza/vim-snippets'" post install (yarn install | npm install) Plug 'pangloss/vim-javascript' Plug 'jelera/vim-javascript-syntax' Plug 'mxw/vim-jsx' Plug 'maxmellon/vim-jsx-pretty' if has('nvim') Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } else Plug 'Shougo/deoplete.nvim' Plug 'roxma/nvim-yarp' Plug 'roxma/vim-hug-neovim-rpc' endif Plug 'ervandew/supertab' Plug 'ternjs/tern_for_vim', { 'for': ['javascript', 'javascript.jsx'] } Plug 'carlitux/deoplete-ternjs', { 'for': ['javascript', 'javascript.jsx'] } Plug 'othree/jspc.vim', { 'for': ['javascript', 'javascript.jsx'] } Plug 'elzr/vim-json' Plug 'vim-airline/vim-airline' Plug 'luochen1990/rainbow' Plug 'joaohkfaria/vim-jest-snippets' " All of your Plugins must be added before the following line " Add plugins to &runtimepath call plug#end() "required
.vimrc ```vi " load vim-plug source ~/.vim/.plug.vim set runtimepath^=~/.vim/bundle/poppy.vim nnoremap j nnoremap k nnoremap l nnoremap h " https://github.com/haishanh/night-owl.vim if (has("termguicolors")) set termguicolors endif syntax enable colorscheme night-owl map ; :FZF " autocompletion based on https://www.gregjs.com/vim/2016/neovim-deoplete-jspc-ultisnips-and-tern-a-config-for-kickass-autocompletion/ let g:deoplete#enable_at_startup = 1 let g:deoplete#omni#functions = {} let g:deoplete#omni#functions.javascript = [ "\ 'tern#Complete', \ 'jspc#omni' \] set completeopt=longest,menuone,preview let g:deoplete#sources = {} let g:deoplete#sources['javascript.jsx'] = ['file', 'ultisnips', 'ternjs'] let g:tern#command = ['tern'] let g:tern#arguments = ['--persistent'] "autocmd FileType javascript let g:SuperTabDefaultCompletionType = "" "let g:UltiSnipsExpandTrigger="" "inoremap pumvisible() ? "\" : "\" let g:vim_jsx_pretty_colorful_config = 1 " https://github.com/luochen1990/rainbow let g:rainbow_active = 1 set splitbelow set splitright " disable automatic comments in new lines https://vim.fandom.com/wiki/Disable_automatic_comment_insertion "autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o let g:jsx_ext_required = 0 let g:ale_linters = { \ 'javascript': ['eslint'], \} let g:ale_fixers = { \ 'javascript': ['prettier', 'eslint'], \ '*': ['remove_trailing_lines', 'trim_whitespace'], \} " when running at every change you may want to disable quickfix "let g:prettier#quickfix_enabled = 0 "let g:prettier#autoformat = 0 "autocmd BufWritePre,TextChanged,InsertLeave *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html PrettierAsync "let g:ale_fixers = {'javascript': ['prettier', 'eslint']} let g:ale_sign_error = '❌' let g:ale_sign_warning = '⚠️' let g:ale_lint_on_enter = 0 let g:ale_lint_on_text_changed = 'never' highlight ALEErrorSign ctermbg=NONE ctermfg=red highlight ALEWarningSign ctermbg=NONE ctermfg=yellow let g:ale_linters_explicit = 1 let g:ale_lint_on_save = 1 let g:ale_fix_on_save = 1 let g:airline#extensions#ale#enabled = 1 " organize swap files https://vi.stackexchange.com/a/179 set directory^=$HOME/.vim/tmp// inoremap jk set number let mapleader=" " filetype plugin indent on " https://github.com/SirVer/ultisnips " Trigger configuration. Do not use if you use https://github.com/Valloric/YouCompleteMe. let g:UltiSnipsExpandTrigger="" let g:UltiSnipsJumpForwardTrigger="" let g:UltiSnipsJumpBackwardTrigger="" set autoindent set indentexpr=off set tabstop=2 set softtabstop=2 set expandtab set shiftwidth=0 set textwidth=80 set nohls set noshowmatch setlocal spell spelllang=en_us set nospell autocmd VimEnter * set vb t_vb= set modeline set nojoinspaces " pesky 2-spaces after the period thing set shortmess=AITstW " I hate: naggy dialogs, intros, long messages set noshowcmd set nowritebackup set noswapfile set nobackup " don't delete whitespace-only lines leaving insert mode: inoremap xx inoremap x inoremap x nnoremap o ox nnoremap O Ox " fuck everything about the 'Press ENTER' message: set showcmd set shortmess=at " 2-space indent for html and json files autocmd BufRead,BufNewFile *.json,*.html,*.css,*.svg set sw=2 tabstop=2 autocmd BufRead,BufNewFile Makefile,makefile,*Makefile,*makefile set noexpandtab " for lightline plugin set laststatus=2 set clipboard=unnamedplus set runtimepath^=~/.vim/bundle/ctrlp.vim " https://github.com/vim-airline/vim-airline#integrating-with-powerline-fonts let g:airline_powerline_fonts=1 " https://stackoverflow.com/a/17327372/1226072 if executable('ag') " Use Ag over Grep set grepprg=ag\ --nogroup\ --nocolor " Use ag in CtrlP for listing files. Lightning fast and respects .gitignore let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' endif let g:ctrlp_show_hidden=1 " https://stackoverflow.com/questions/4292733/vim-creating-parent-directories-on-save function s:MkNonExDir(file, buf) if empty(getbufvar(a:buf, '&buftype')) && a:file!~#'\v^\w+\:\/' let dir=fnamemodify(a:file, ':h') if !isdirectory(dir) call mkdir(dir, 'p') endif endif endfunction augroup BWCCreateDir autocmd! autocmd BufWritePre * :call s:MkNonExDir(expand(''), +expand('')) augroup END nnoremap :echo synIDattr(synID(line('.'), col('.'), 0), 'name') nnoremap :echo ("hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' \ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" \ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">") nnoremap :echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') nnoremap :exec 'syn list '.synIDattr(synID(line('.'), col('.'), 0), 'name') ```