Skip to content
This repository has been archived by the owner on Nov 12, 2022. It is now read-only.

Sorbet: unable to find executable #617

Open
1 task done
kputnam opened this issue Apr 21, 2022 · 0 comments
Open
1 task done

Sorbet: unable to find executable #617

kputnam opened this issue Apr 21, 2022 · 0 comments

Comments

@kputnam
Copy link

kputnam commented Apr 21, 2022

Problem description

I installed sorbet using :LspInstall sorbet, but when I run :LspInfo after opening a ruby file, it says it's not attached and "unable to find executable. Please check your path and ensure the server is installed".

I spent longer than I hoped to troubleshoot this, but eventually figured it out. There are two issues:

  1. Sorbet's LSP does not work without having Facebook's watchman package installed.
  2. You must initialize the project with srb init.

Issue no. 1: the gems named watchman and ruby-watchman will not suffice. Being on macOS, I was able to install it using brew install watchman. Without it, srb tc --lsp prints this message:

{"jsonrpc":"2.0","method":"window/showMessage","params":{"type":1,"message":"Error running Watchman (with `watchman -j -p --no-pretty`).\nWatchman is required for Sorbet to detect changes to files made outside of your code editor.\nDon't need Watchman? Run Sorbet with `--disable-watchman`."}}%                                                                                                                                       

Issue no. 2: First you need a Gemfile in the project directory; even an empty file will suffice. Next you must run

GEM_PATH=~/.local/share/nvim/lsp_servers/sorbet GEM_HOME=~/.local/share/nvim/lsp_servers/sorbet PATH=~/.local/share/nvim/lsp_servers/sorbet/bin:$PATH bundle exec srb init

If you skip this step, :LspInfo again incorrectly states "unable to find executable. Please check your path and ensure the server is installed". The actual problem is printed by srb:

{"jsonrpc":"2.0","method":"window/showMessage","params":{"type":1,"message":"Sorbet's language server requires a single input directory. However, 0 are configured: []"}}

Once that's done, nvim will launch and connect to sorbet.

Neovim version (>= 0.6)

NVIM v0.7.0
Build type: Release
LuaJIT 2.1.0-beta3

Operating system/version

Darwin localhost.local 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:54 PST 2021; root:xnu-8019.61.5~1/RELEASE_X86_64 x86_64

I've recently downloaded the latest plugin version of both nvim-lsp-installer and nvim-lspconfig

  • Yes

Affected language servers

sorbet

Actual behavior

The language server does not attach to the buffer when editing a Ruby file, and :LspInfo says that it is unable to find the executable.

Expected behavior

At minimum, a more useful error message should be provided, like the ones provided by srb as "window/showMessage".

Even better would be installing watchman using the OS package manager, or even just instructing the user that "watchman" is not in $PATH and it must be installed manually using the OS package manager. Because of the potential confusion with the similarly named Ruby gems (one gem is even hosted in Facebook's repository), printing some example instructions would be useful.

Secondly, provide a warning that the sorbet directory does not exist. Even better, offer to run srb init for the user, or even print the command required for them to run it themselves. Because the sorbet is installed in a separate $GEM_PATH, users might have trouble trying to run it.

LspInstallInfo output

No response

Installation log

[INFO  Wed Apr 20 22:58:43 2022] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:682: Starting install server_name="sorbet", requested_version=""
[INFO  Wed Apr 20 22:58:45 2022] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:701: Installation completed server_name="sorbet", success=true

Healthcheck

nvim-lsp-installer: require("nvim-lsp-installer.health").check()
========================================================================
## nvim-lsp-installer report
  - OK: neovim version >= 0.6.0
  - WARNING: **Composer**: not available
  - WARNING: **PHP**: not available
  - WARNING: **julia**: not available
  - OK: **bash**: `GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin21)`
  - OK: **tar**: `bsdtar 3.5.1 - libarchive 3.5.1 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8 `
  - OK: **gzip**: `Apple gzip 352.40.6`
  - OK: **curl**: `curl 7.77.0 (x86_64-apple-darwin21.0) libcurl/7.77.0 (SecureTransport) LibreSSL/2.8.3 zlib/1.2.11 nghttp2/1.42.0`
  - OK: **wget**: `GNU Wget 1.21.3 built on darwin21.3.0.`
  - OK: **python3**: `Python 3.9.12`
  - OK: **node**: `v16.14.0`
  - OK: **Ruby**: `ruby 3.0.4p208 (2022-04-12 revision 3fa771dded) [x86_64-darwin21]`
  - OK: **Go**: `go version go1.18.1 darwin/amd64`
  - OK: **sh**: `Ok`
  - OK: **java**: `Ok`
  - OK: **cargo**: `cargo 1.60.0 (d1fd9fe2c 2022-03-01)`
  - OK: **javac**: `javac 18`
  - OK: **RubyGem**: `3.2.33`
  - OK: **npm**: `8.5.5`
  - OK: **pip3**: `pip 22.0.4 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)`

Screenshots

No response

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

No branches or pull requests

1 participant