Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Older versions of Node throwing SyntaxError: Unexpected token '?' #304

Open
kaka-ruto opened this issue May 18, 2022 · 2 comments
Open

Older versions of Node throwing SyntaxError: Unexpected token '?' #304

kaka-ruto opened this issue May 18, 2022 · 2 comments

Comments

@kaka-ruto
Copy link

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

Screenshot 2022-05-18 at 14 26 36

Dockerfile that reproduces the problem (if possible)

Refer to https://github.com/yuki-yano/fzf-preview.vim/blob/main/.github/issue_example/Dockerfile

@kaka-ruto
Copy link
Author

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!)

@lucioreyli
Copy link

lucioreyli commented Sep 21, 2022

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants