kabouzeid / nvim-lspinstall

Provides the missing :LspInstall for nvim-lspconfig
MIT License
526 stars 66 forks source link

JSON language server will not run under Node 12.x because... #162

Open jrop opened 3 years ago

jrop commented 3 years ago

...because it makes use of Optional Chaining in its source. I temporarily fixed it by:

  1. Change directory to where the offending JS file is:
cd ~/.local/share/nvim/lspinstall/json/vscode-json/json-language-features/server/dist/node
  1. Create a .babelrc file:
{
  "presets": [
    [
      "@babel/preset-env",
      {
        "targets": {
          "node": "12"
        }
      }
    ]
  ]
}
  1. Transpile the offending JS file:
npm init -f
npm i @babel/{core,cli,preset-env}
./node_modules/.bin/babel jsonServerMain.js > jsonServerMain.new.js
cp jsonServerMain.js jsonServerMain.js.bak
mv jsonServerMain.new.js jsonServerMain.js
jrop commented 3 years ago

This is probably the wrong place to file this issue, but I'm putting it here to make it searchable