alchemist.vim
alchemist.vim copied to clipboard
socket is not available
Issue I am sorry to bother you. when i use vim , the alchemist did not auto complete and jump to definition. here is the problem "alchemist.vim: failed with message error:Socket is not a vailable. E426: tag not found:"
Details Elixir/OTP/Python version Elixir: 1.7.4 OTP: 21.1 Python: 3.7.1 Vim version. vim 8.1.0518 (command line) Which pluging are you using: basic omnifunc
Hey @zlfera,
May I know if you have compiled the project? https://github.com/slashmili/alchemist.vim/wiki#important-notes
If you still have problem please flow the Debugging steps and send me the outputs
Yes, I have compiled project yet. but when I type <C-x><C-o>, the problem has appeared.
hello, same problem here.
@slashmili I get this error too, but only intermittently. The output of the debugging commands:
✔ ~/@code/myapp [my-branch L|✔]
(ins)16:05 $ ~/.local/share/nvim/plugged/alchemist.vim/elixir_sense_client -d./ -c1 -l1 --request=definition < sample.exs
/home/build/elixir/lib/elixir/lib/enum.ex:0✔ ~/@code/myapp [my-branch L|…2]
(ins)16:08 $ ~/.local/share/nvim/plugged/alchemist.vim/elixir_sense_client -d./ -c6 -l1 --request=definition < sample.exs
/home/build/elixir/lib/elixir/lib/enum.ex:0✔ ~/@code/myapp [my-branch L|…2]
(ins)16:09 $ ~/.local/share/nvim/plugged/alchemist.vim/elixir_sense_client -d./ -c6 -l1 --request=docs < sample.exs
> Enum.map(enumerable, fun)
### Specs
`@spec map(t, (element -> any)) :: list`
Returns a list where each item is the result of invoking
`fun` on each corresponding item of `enumerable`.
For maps, the function expects a key-value tuple.
## Examples
iex> Enum.map([1, 2, 3], fn x -> x * 2 end)
[2, 4, 6]
iex> Enum.map([a: 1, b: 2], fn {k, v} -> {k, -v} end)
[a: -1, b: -2]
✔ ~/@code/myapp [my-branch L|…2]
(ins)16:10 $ ~/.local/share/nvim/plugged/alchemist.vim/elixir_sense_client -d./ -c1 -l2 --request=definition < sample.exs
/Users/kenny/@code/myapp/lib/custom_module.ex:1✔ ~/@code/myapp [my-branch L|…2]
(ins)16:11 $ ~/.local/share/nvim/plugged/alchemist.vim/elixir_sense_client -d./ -c14 -l3 --request=definition < sample.exs
/Users/kenny/@code/myapp/lib/custom_module.ex:2
The output of the test commands seems to be missing a trailing newline; a more nicely formatted version of the above:
✔ ~/@code/myapp [my-branch L|✔]
(ins)16:05 $ ~/.local/share/nvim/plugged/alchemist.vim/elixir_sense_client -d./ -c1 -l1 --request=definition < sample.exs
/home/build/elixir/lib/elixir/lib/enum.ex:0
✔ ~/@code/myapp [my-branch L|…2]
(ins)16:08 $ ~/.local/share/nvim/plugged/alchemist.vim/elixir_sense_client -d./ -c6 -l1 --request=definition < sample.exs
/home/build/elixir/lib/elixir/lib/enum.ex:0
✔ ~/@code/myapp [my-branch L|…2]
(ins)16:09 $ ~/.local/share/nvim/plugged/alchemist.vim/elixir_sense_client -d./ -c6 -l1 --request=docs < sample.exs
> Enum.map(enumerable, fun)
### Specs
`@spec map(t, (element -> any)) :: list`
Returns a list where each item is the result of invoking
`fun` on each corresponding item of `enumerable`.
For maps, the function expects a key-value tuple.
## Examples
iex> Enum.map([1, 2, 3], fn x -> x * 2 end)
[2, 4, 6]
iex> Enum.map([a: 1, b: 2], fn {k, v} -> {k, -v} end)
[a: -1, b: -2]
✔ ~/@code/myapp [my-branch L|…2]
(ins)16:10 $ ~/.local/share/nvim/plugged/alchemist.vim/elixir_sense_client -d./ -c1 -l2 --request=definition < sample.exs
/Users/kenny/@code/myapp/lib/custom_module.ex:1
✔ ~/@code/myapp [my-branch L|…2]
(ins)16:11 $ ~/.local/share/nvim/plugged/alchemist.vim/elixir_sense_client -d./ -c14 -l3 --request=definition < sample.exs
/Users/kenny/@code/myapp/lib/custom_module.ex:2
@kenny-evitt so the way that this plugin works, first attempt to use the current socket, if it's not available, it spawn it again. that's why the next action works.
We could possibly improve it and make it a bit smarter to retry to spawn elixir sense but haven't fixed it 😕
@slashmili I figured as much. I just wanted to let you know that someone else ran into this and that it wasn't because ElixirSense or the ElixirSense client wasn't working (which I imagine the debugging output confirms). And I was also, implicitly, offering to test any suggestions you might have, e.g. to further investigate this.
If you can, and want, any hints at where in the code to look to potentially fix this would be appreciated. I can't promise that I'll actually provide much help, but I do plan on using this plugin 'in anger', indefinitely, so I'm invested in both fixing this and helping out with improving or maintaining the plugin more generally too.
Thanks for the fantastic plugin as-is too btw!
- One approach is to retry the given command if
system
function returns non-zero
https://github.com/slashmili/alchemist.vim/blob/5575fc8e18695b050b1c4d51623ae37f12ff7648/after/plugin/alchemist.vim#L11-L27
- The other approach is to improve the python client to try to spawn the server(at least one time) if the server is dead.
https://github.com/slashmili/alchemist.vim/blob/5575fc8e18695b050b1c4d51623ae37f12ff7648/elixir_sense_client#L62-L73
Thinking about it, I'd do option 2 since it doesn't require me to write VimScript
😄
@slashmili If I've enabled debug mode in the ElixirSense client file, I should be able to see errors about this in the log file, right?
Yes, the log file is in /tmp/log.log
though! make sure to change it somewhere more permanent and appropriate
@kenny-evitt one possible solution is
diff --git a/elixir_sense_client b/elixir_sense_client
index 3a9d62c..370f58d 100755
--- a/elixir_sense_client
+++ b/elixir_sense_client
@@ -1,6 +1,6 @@
#!/usr/bin/env python
from __future__ import print_function
-import os, sys, getopt
+import os, sys, getopt, time
from elixir_sense import ElixirSenseClient
debug = False
@@ -69,6 +69,10 @@ def main(argv):
sense = ElixirSenseClient(debug=debug, cwd=cwd, ansi=ansi, elixir_sense_script=alchemist_script, elixir_otp_src=elixir_otp_src)
response = sense.process_command(request, source, line ,column)
+ if response == "error:Socket is not available.":
+ time.sleep(1)
+ response = sense.process_command(request, source, line ,column)
+
sense._log("response:\n%s" % response)
print(response, end="")
In addition, think that the tag fallback is not working properly. If I have my cursor on the method of the following A.B.method
then I will get an error saying tag not found A.B.method
. Without alchemist, the tag is found by searching only method
although we may jump to the method of the same name in the wrong module.
The behaviour of alchemist makes sense, in a sense, because different modules can have methods of the same name, however that's not how C tags files are generated - they are indexed by method name, without the full module prefix.
It would be good for alchemist to be able to find the correct method, but also resolve the duplicate method names by looking at the module prefix.
@dylan-chong I get the 'tag not found' error/message sometimes but usually retrying works.
Hmm not for me. Maybe your retrying avoids the tag fallback by succeeding at elixir sense?
The tag not found bug seems to happen even when a module is not prefixed (in the case of jumping to the definition of an alias). I get the error E426 tag not found. Using the shortcut g<c-]>
which is not overridden by alchemist, Vim can jump to the definition successfully
@dylan-chong I get the 'tag not found' error/message sometimes but usually retrying works.
+1 I get both errors:
- Socket is not available
- Tag not found
.... but if I try again immediately it works fine.
Details elixir 1.7.4 erlang 20.3.8.9 Python: 3.6.10 NVIM v0.3.7
.... but if I try again immediately it works fine.
Yeah same here, I get the error the first time, but if I try again it works.
NVIM 0.4.3 Erlang 23 Elixir 1.11.2