fzf-preview.vim
fzf-preview.vim copied to clipboard
Older versions of Node throwing SyntaxError: Unexpected token '?'
Problems summary
I am working on a project that uses Node version 12.16.1
.
Neovim picks this version of Node and uses it, making some fzf-preview functions to fail with syntax errors since I believe fzf-preview uses latest Node versions.
An example, when I run :FzfPreviewProjectGrep
, I get SyntaxError: Unexpected token '?'
Expected
The grep preview above works
Environment Information
-
fzf-preview version (package.json): 2.12.9
-
OS: Mac OS Monterey
-
Vim/Neovim version: 0.7.0
Provide a minimal init.vim
" call plug#begin('~/.vim/plugged')
" Plug 'junegunn/fzf'
" Plug 'neoclide/coc.nvim', {'branch': 'release'}
" Plug 'ryanoasis/vim-devicons'
" call plug#end()
"
" let g:coc_global_extensions = ['coc-fzf-preview']
Screenshot
Dockerfile that reproduces the problem (if possible)
Refer to https://github.com/yuki-yano/fzf-preview.vim/blob/main/.github/issue_example/Dockerfile
I know it's extra work to support this so let me know if and how I can help! (haven't dug into the code deep enough to know what to tweak but if you give a brief guidance I will be happy to do it!)
it's because de Nullish coalescing ??
has introduced in Node version 14, and you are using Node version 12 (look https://node.green/#ES2020-features--nullish-coalescing-operator-----).
But you can change the
BAT_THEME = process.env.FZF_PREVIEW_PREVIEW_BAT_THEME ?? "OneHalfDark"
to
BAT_THEME = process.env.FZF_PREVIEW_PREVIEW_BAT_THEME || "OneHalfDark"