Code Monkey home page Code Monkey logo

Comments (17)

joaquinalcerro avatar joaquinalcerro commented on June 1, 2024 6

@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

from alchemist.vim.

slashmili avatar slashmili commented on June 1, 2024 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 😕

from alchemist.vim.

slashmili avatar slashmili commented on June 1, 2024 1
  1. One approach is to retry the given command if system function returns non-zero

function! alchemist#alchemist_client(req, lnum, cnum, lines)
let req = a:req
let cmd = g:alchemist#alchemist_client
if exists('g:alchemist#elixir_erlang_src')
let cmd = cmd . ' -o ' . g:alchemist#elixir_erlang_src
endif
let cmd = cmd . ' -d "' . expand('%:p:h') . '"'
let cmd = cmd . ' --line=' . a:lnum
let cmd = cmd . ' --column=' . a:cnum
let cmd = cmd . ' --request=' . a:req
let result = system(cmd, join(a:lines, "\n"))
if len(matchlist(result, '^error:')) > 0
call s:echo_error('alchemist.vim: failed with message ' . result)
return ''
endif
return result
endfunction

  1. The other approach is to improve the python client to try to spawn the server(at least one time) if the server is dead.

if alchemist_script == "":
alchemist_script = "%s/elixir_sense/run.exs" % where_am_i()
if "" in [request, alchemist_script, request, line, column]:
print("Invalid command, alchemist_script or working directory")
print(alchemist_help())
sys.exit(2)
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)
sense._log("response:\n%s" % response)
print(response, end="")

Thinking about it, I'd do option 2 since it doesn't require me to write VimScript 😄

from alchemist.vim.

slashmili avatar slashmili commented on June 1, 2024 1

Yes, the log file is in /tmp/log.log though! make sure to change it somewhere more permanent and appropriate

from alchemist.vim.

slashmili avatar slashmili commented on June 1, 2024

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

from alchemist.vim.

zlfera avatar zlfera commented on June 1, 2024

Yes, I have compiled project yet. but when I type , the problem has appeared.
screenshot_2018-11-16-20-24-39-465_com termux

from alchemist.vim.

MatheusBueno782 avatar MatheusBueno782 commented on June 1, 2024

hello, same problem here.

from alchemist.vim.

slashmili avatar slashmili commented on June 1, 2024

@destne thanks for reporting it.

I can't say anything until you provide the Debugging output.

from alchemist.vim.

kenny-evitt avatar kenny-evitt commented on June 1, 2024

@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

from alchemist.vim.

kenny-evitt avatar kenny-evitt commented on June 1, 2024

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

from alchemist.vim.

kenny-evitt avatar kenny-evitt commented on June 1, 2024

@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?

from alchemist.vim.

slashmili avatar slashmili commented on June 1, 2024

@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="")

from alchemist.vim.

dylan-chong avatar dylan-chong commented on June 1, 2024

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.

from alchemist.vim.

kenny-evitt avatar kenny-evitt commented on June 1, 2024

@dylan-chong I get the 'tag not found' error/message sometimes but usually retrying works.

from alchemist.vim.

dylan-chong avatar dylan-chong commented on June 1, 2024

Hmm not for me. Maybe your retrying avoids the tag fallback by succeeding at elixir sense?

from alchemist.vim.

dylan-chong avatar dylan-chong commented on June 1, 2024

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

from alchemist.vim.

sic-f avatar sic-f commented on June 1, 2024

.... 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

from alchemist.vim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.