Skip to content

provider: Fix ruby and node providers for Windows#7577

Merged
justinmk merged 3 commits intoneovim:masterfrom
janlazo:win_fix_providers
Nov 17, 2017
Merged

provider: Fix ruby and node providers for Windows#7577
justinmk merged 3 commits intoneovim:masterfrom
janlazo:win_fix_providers

Conversation

@janlazo
Copy link
Copy Markdown
Contributor

@janlazo janlazo commented Nov 17, 2017

Add some workarounds because of exepath return non-executable files in Windows and the current viml for node provider attempts to run the shell script via node.

I like to test this in Appveyor but node and ruby aren't installed there in the current builds.

This should resolve my issues mentioned in #7568 but I don't have a use case for these providers and I don't know what plugins to test these providers with besides https://github.com/clojure-vim/nvim-parinfer.js

neovim-ruby-host is a ruby script.
neovim-node-host is a shell script.
Both don't work in cmd.exe so gem and npm provide batchfile shims.

This patch returns the full path of these shims
because cmd.exe knows better than neovim on what to do with these files.
@janlazo janlazo changed the title providers: Fix ruby and node providers for Windows provider: Fix ruby and node providers for Windows Nov 17, 2017
endif
if !empty($NVIM_NODE_HOST_DEBUG)
call add(args, '--inspect-brk')
endif
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is only wanted on Windows?
just want to make sure this is intentional.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should try to keep this for all systems so we can have remote debugging for plugins

Copy link
Copy Markdown
Contributor Author

@janlazo janlazo Nov 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justinmk I reversed the logic by mistake. Fixing it now.

@billyvg --inspect-brk is unavailable on my system. I'm using node 6.9.1. If there's minimum version required for this, a version check should be included here.

@justinmk justinmk merged commit e8af34d into neovim:master Nov 17, 2017
@janlazo janlazo deleted the win_fix_providers branch November 17, 2017 23:54
justinmk added a commit to justinmk/neovim that referenced this pull request Nov 18, 2017
FEATURES:
b6a603f neovim#7458 node.js remote-plugin support
f5d4da0 :checkhealth : validate 'runtimepath' (neovim#7526)

FIXES:
e6beb60 :terminal : fix crash on resize (neovim#7547)
07931ed tui: 'guicursor': use DECSCUSR for xterm-likes (neovim#7576)
f185c73 neovim#7561 'os_open: UV_EINVAL on NULL filename'
e8af34d win: provider: Detect(): return *.cmd path (neovim#7577)
eacd788 :checkhealth : fix check for npm and yarn (neovim#7569)
a43a573 health.vim: normalize slashes for script path (neovim#7525)
69e3308 cmake: install runtime/rgb.txt
d0b05e3 runtime: Fix syntax error in `runtime/syntax/tex.vim` (neovim#7518)
55d8967 tutor: some fixes (neovim#7510)

CHANGES:
9837a9c remove legacy alias to `v:count` (neovim#7407)
c5f001a runtime: revert netrw update (neovim#7557)
67e4529 defaults: scrollback=10000 (neovim#7556)
881f9e4 process_close(): uv_unref() detached processes (neovim#7539)
justinmk added a commit to justinmk/neovim that referenced this pull request Nov 18, 2017
FEATURES:
a6de144 'viewoptions': add "curdir" flag neovim#7447
b6a603f node.js remote-plugin support neovim#7458
f5d4da0 :checkhealth : validate 'runtimepath' neovim#7526

FIXES:
e6beb60 :terminal : fix crash on resize neovim#7547
f19e5d6 work around gnome-terminal memory leak neovim#7573
07931ed 'guicursor': use DECSCUSR for xterm-likes neovim#7576
f185c73 'os_open: UV_EINVAL on NULL filename' neovim#7561
e8af34d win: provider: Detect(): return *.cmd path neovim#7577
eacd788 :checkhealth : fix check for npm and yarn neovim#7569
a43a573 health.vim: normalize slashes for script path neovim#7525
69e3308 cmake: install runtime/rgb.txt
d0b05e3 runtime: syntax error in `runtime/syntax/tex.vim` neovim#7518
55d8967 tutor: some fixes neovim#7510

CHANGES:
9837a9c remove legacy alias to `v:count` neovim#7407
c5f001a runtime: revert netrw update neovim#7557
67e4529 defaults: scrollback=10000 neovim#7556
881f9e4 process_close(): uv_unref() detached processes neovim#7539
sameedali added a commit to sameedali/neovim that referenced this pull request Nov 19, 2017
* 'master' of https://github.com/neovim/neovim: (148 commits)
  vim-patch:8.0.0283
  version bump
  NVIM v0.2.2
  tui: setrgbf/setrgbb: emit semicolons for VTE
  'viewoptions': add "curdir" flag neovim#7447
  win: provider: Detect(): return *.cmd path (neovim#7577)
  os_nodetype: rework
  os_open, os_stat: UV_EINVAL on NULL filename
  tui: 'guicursor': use DECSCUSR for xterm-likes (neovim#7576)
  lint neovim#7562
  :checkhealth: fix check for npm and yarn (neovim#7569)
  doc: Fix pathshorten() example (neovim#7571)
  health.vim: define highlights as `default` (neovim#7560)
  runtime: revert netrw update (neovim#7557)
  defaults: scrollback=10000 (neovim#7556)
  doc: test/README.md: migrate wiki info (neovim#7552)
  vim-patch:8.0.0227 (neovim#7548)
  test/unit/path_spec: expect correct buffer size (neovim#7514)
  health.vim: normalize slashes for script path (neovim#7525)
  :terminal : fix crash on resize (neovim#7547)
  ...
@janlazo
Copy link
Copy Markdown
Contributor Author

janlazo commented Nov 29, 2017

I mixed up the batchfile extension for neovim-ruby-host. It uses bat, not cmd.

@janlazo
Copy link
Copy Markdown
Contributor Author

janlazo commented Nov 29, 2017

Looking at the batchfile, maybe it's better to be explicit (list, not string) in Windows and handle any escaping ourselves. For some reason, batchfiles with cmd extension are specific to ruby (installer) and batchfiles with bat extension are for gems.

@janlazo
Copy link
Copy Markdown
Contributor Author

janlazo commented Dec 10, 2017

--inspect-brk is included in nodejs/node#16263 for node 6.12+ and nodejs/node-inspect#43 for node 7.6+

If node client should support debugging on node v6 and v7 with https://github.com/neovim/node-client#nvim_node_host_debug, then there must be some quick version check. system('node -v') to get the node version and then split it to get the major and minor versions.
nvm install --lts installs node v6 on Travis.

janlazo added a commit to janlazo/neovim that referenced this pull request Dec 14, 2017
justinmk pushed a commit to justinmk/neovim that referenced this pull request Dec 17, 2017
ci: install nodejs 8 in Appveyor, Travis

provider: check node version for debug support
Resolve neovim#7577 (comment) for Unix.

provider: test if nodejs in ci supports --inspect-brk

nodejs host for neovim requires nodejs 6+ to work properly.
nodejs 6.12+ or 7.6+ is required for debug support via `node --inspect-brk`.

provider: run cli.js of nodejs host directly

npm shims are useless because the user cannot set node to debug mode via
--inspect-brk. This is problematic on Windows which use batchfiles and
shell scripts to compensate for not supporting shebang.

The patch uses `npm root -g` to get the absolute path of the global npm
modules. If that fails, then the user did not install neovim npm package
globally. Use that absolute path to find `neovim/bin/cli.js`, which is
what the npm shim actually runs with node. glob() is for a simple file
check in case bin/ is removed because the npm shims are ignored now.
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

Successfully merging this pull request may close these issues.

3 participants