edelvalle / SuperElixir

This is a sublime plug-in that provide IDE like capabilities to sublime when working with the Elixir language.
GNU Lesser General Public License v3.0
31 stars 4 forks source link

Autocompletions not working #8

Closed Rydgel closed 3 years ago

Rydgel commented 6 years ago

Autocompletion does not seem to work properly, When typing, Enum. it does not propose any function from the Enum module. But instead only current file variables.

Did I miss something to configure?

edelvalle commented 6 years ago

Let me check; I'm not using the plugin my self, let me check if something broke.

edelvalle commented 6 years ago

So it seems to be working for me, do you have the elixir binary in a weird place?

You need to configure it in your project settings like it says here: https://github.com/edelvalle/SuperElixir#elixir-interpreter-settings

If you continue experiencing problems press: ctr-` and send me the logs.

Rydgel commented 6 years ago

Actually it seems to work after being triggered multiple times.

alt

I noticed an error in the console so here it is:

Traceback (most recent call last):
  File "/Users/tripnity/Library/Application Support/Sublime Text 3/Packages/SuperElixir/super_elixir/erlang.py", line 339, in binary_to_term
    i, term = _binary_to_term(1, data)
  File "/Users/tripnity/Library/Application Support/Sublime Text 3/Packages/SuperElixir/super_elixir/erlang.py", line 494, in _binary_to_term
    i, value = _binary_to_term(i, data)
  File "/Users/tripnity/Library/Application Support/Sublime Text 3/Packages/SuperElixir/super_elixir/erlang.py", line 429, in _binary_to_term
    i, tmp = _binary_to_term_sequence(i, length, data)
  File "/Users/tripnity/Library/Application Support/Sublime Text 3/Packages/SuperElixir/super_elixir/erlang.py", line 542, in _binary_to_term_sequence
    i, element = _binary_to_term(i, data)
  File "/Users/tripnity/Library/Application Support/Sublime Text 3/Packages/SuperElixir/super_elixir/erlang.py", line 493, in _binary_to_term
    i, key = _binary_to_term(i, data)
  File "/Users/tripnity/Library/Application Support/Sublime Text 3/Packages/SuperElixir/super_elixir/erlang.py", line 369, in _binary_to_term
    tag = b_ord(data[i])
IndexError: index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 591, in on_query_completions
    res = callback.on_query_completions(v, prefix, locations)
  File "/Users/tripnity/Library/Application Support/Sublime Text 3/Packages/SuperElixir/super_elixir/autocomplete.py", line 19, in on_query_completions
    suggestions = sense.suggestions(buffer, line, column)
  File "/Users/tripnity/Library/Application Support/Sublime Text 3/Packages/SuperElixir/super_elixir/sense_client.py", line 153, in suggestions
    column=column,
  File "/Users/tripnity/Library/Application Support/Sublime Text 3/Packages/SuperElixir/super_elixir/sense_client.py", line 108, in _send_request
    data = decode_term(erlang.binary_to_term(response))
  File "/Users/tripnity/Library/Application Support/Sublime Text 3/Packages/SuperElixir/super_elixir/erlang.py", line 346, in binary_to_term
    raise ParseException('missing data')
  File "<string>", line None
SuperElixir.super_elixir.erlang.ParseException: <no detail available>
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 591, in on_query_completions
    res = callback.on_query_completions(v, prefix, locations)
  File "/Users/tripnity/Library/Application Support/Sublime Text 3/Packages/SuperElixir/super_elixir/autocomplete.py", line 19, in on_query_completions
    suggestions = sense.suggestions(buffer, line, column)
  File "/Users/tripnity/Library/Application Support/Sublime Text 3/Packages/SuperElixir/super_elixir/sense_client.py", line 153, in suggestions
    column=column,
  File "/Users/tripnity/Library/Application Support/Sublime Text 3/Packages/SuperElixir/super_elixir/sense_client.py", line 108, in _send_request
    data = decode_term(erlang.binary_to_term(response))
  File "/Users/tripnity/Library/Application Support/Sublime Text 3/Packages/SuperElixir/super_elixir/erlang.py", line 337, in binary_to_term
    raise ParseException('invalid version')
  File "<string>", line None
SuperElixir.super_elixir.erlang.ParseException: <no detail available>
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 591, in on_query_completions
    res = callback.on_query_completions(v, prefix, locations)
  File "/Users/tripnity/Library/Application Support/Sublime Text 3/Packages/SuperElixir/super_elixir/autocomplete.py", line 19, in on_query_completions
    suggestions = sense.suggestions(buffer, line, column)
  File "/Users/tripnity/Library/Application Support/Sublime Text 3/Packages/SuperElixir/super_elixir/sense_client.py", line 153, in suggestions
    column=column,
  File "/Users/tripnity/Library/Application Support/Sublime Text 3/Packages/SuperElixir/super_elixir/sense_client.py", line 108, in _send_request
    data = decode_term(erlang.binary_to_term(response))
  File "/Users/tripnity/Library/Application Support/Sublime Text 3/Packages/SuperElixir/super_elixir/erlang.py", line 337, in binary_to_term
    raise ParseException('invalid version')
  File "<string>", line None
SuperElixir.super_elixir.erlang.ParseException: <no detail available>
Rydgel commented 6 years ago
elixir --version
Erlang/OTP 20 [erts-9.1.4] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Elixir 1.5.2
edelvalle commented 6 years ago

Ok, now I know what's going on.

How this plugins works, Sublime plugin system is in Python and the library to do code introspection, autocompletion (ElixirSense) and all the heavy lifting is in Elixir. The plugin basically glues Sublime and ElixirSense... there is a piece of software here that is quite fucking complex here that is use to decode Erlang binary protocol and translate it back and forth to Python.

What you are experiencing is that the library to do the translation between Erlang binary protocol and Python is breaking because some unexpected result from Erlang to Python.

This is hard to debug, because I will need an example of the binary code that erlang is returning so I can check why it breaks this library.... I will tell you how to get it, but you need to give me some time. Ok?

Rydgel commented 6 years ago

Yup no problem, I'll help.

hickscorp commented 6 years ago

:+1: I think I might have a related issue - The completion (Both top-level and dot based) works for all standard modules, but it doesn't for any of my project or their dependencies.

I'm using Erlang 20.3 and Elixir 1.6.5.