ElixirSublime icon indicating copy to clipboard operation
ElixirSublime copied to clipboard

Code completion not working

Open seemsindie opened this issue 9 years ago • 52 comments

Hello,

Is there anything else i should do to make this work? I have elixir installed, i have my env settings like:

"env": {
    "PATH": "/usr/lib/elixir/bin"
},

And i also Elixir, and ElixirSublime packages installed. But code completion is not working like showed on gif in your readme. Any ideas how to make it work?

image

seemsindie avatar Nov 11 '15 13:11 seemsindie

I've same issue.

sratatata avatar Nov 11 '15 15:11 sratatata

The same for me.

liveforeverx avatar Nov 12 '15 16:11 liveforeverx

What is your Elixir version? See #18

ThomasKliszowski avatar Nov 17 '15 16:11 ThomasKliszowski

Elixir 1.1.1

seemsindie avatar Nov 18 '15 20:11 seemsindie

+1

Elixir (1.1.1)

developerworks avatar Nov 23 '15 03:11 developerworks

➜  sublime_completion  iex -S mix          
Erlang/OTP 18 [erts-7.1] [source] [64-bit] [smp:8:8] [async-threads:10] [kernel-poll:false]

Compiled lib/sublime_completion.ex
Generated sublime_completion app

=INFO REPORT==== 27-Nov-2015::13:03:59 ===
    application: logger
    exited: stopped
    type: temporary
** (Mix) Could not start application sublime_completion: exited in: SublimeCompletion.start(:normal, [])
    ** (EXIT) an exception was raised:
        ** (ArgumentError) argument error
            :erlang.binary_to_integer(nil)
            (sublime_completion) lib/sublime_completion.ex:11: SublimeCompletion.start/2
            (kernel) application_master.erl:273: :application_master.start_it_old/4

developerworks avatar Nov 27 '15 05:11 developerworks

+1

Elixir 1.1.1

inicsmith avatar Nov 27 '15 20:11 inicsmith

There is a solution to this in #18 where you have to add a line to the config.exs in the sublime_completion folder that fixed this for me in elixir 1.1.1

ghost avatar Nov 30 '15 18:11 ghost

Hi guys,

This is still not working for me, I tried the solutions provided in #18 but with no success. Does anyone know how to make it work with Elixir 1.1.1? I've been recently digging into programming and development in Elixir but have found it quite difficult because most of the time I found myself searching the online documentation for things that this package already does.

Any help would be highly appreciated!

_Andrés Alejandro García_

Angarsk8 avatar Dec 06 '15 10:12 Angarsk8

@Angarsk8 I used fix 18 for Elixir 1.1.1

This is my full config.exs

use Mix.Config

config :iex,
          autocomplete_server: IEx.Server

I didn't need :iex in under applications in mix.exs

I did need to add my path to my env user preferences

    "env":
    {
        "PATH": "/usr/local/Cellar/elixir/1.1.1/bin/"
    },

Hope that helps

Craig

inicsmith avatar Dec 06 '15 13:12 inicsmith

Still nothing! :( I've tried every possible solution, but nothing works! I get this stack trace in the Sublime Text console:

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 359, in on_query_completions
    res = callback.on_query_completions(v, prefix, locations)
  File "/Users/Angarsk8/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 270, in on_query_completions
    if not session.send('COMPLETE', expand_selection(view, locations[0], aliases=aliases)):
  File "/Users/Angarsk8/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 189, in send
    self.socket.send(str.encode(cmd))
AttributeError: 'NoneType' object has no attribute 'send'

_Andrés Alejandro García_

Angarsk8 avatar Dec 06 '15 21:12 Angarsk8

+1 Same issue. Nothing working for me.

edit: Just to add a little more context, I'm getting the same error as Andres exactly. Socket is being set to 'None' and basically staying that way. I don't know enough about python to really know what I'm talking about but it feels like a possible setup issue (perhaps env/path) but I can't figure it out.

seanpowell avatar Dec 22 '15 21:12 seanpowell

I tried to investigate this issue a bit - seems like there is some inconsistency when SublimeText loads this plugin - we are trying to assign environment variable ELIXIR_SUBLIME_PORT in this method https://github.com/vishnevskiy/ElixirSublime/blob/master/elixir_sublime.py#L17 before socket creation happens here https://github.com/vishnevskiy/ElixirSublime/blob/master/elixir_sublime.py#L24. Perhaps I am missing something as I am not Python or Sublime Text plugins expert. I just tried to repeat process of setting this variable manually - and now it works for me.

Update#1: Try to move this line https://github.com/vishnevskiy/ElixirSublime/blob/master/elixir_sublime.py#L17 to the end of the method - e.g. line 29.

Update#2: Added PR: #25

YurkoHoshko avatar Dec 29 '15 22:12 YurkoHoshko

Problem solved! Thank you very much! @YurkoHoshko

potterdai avatar Dec 29 '15 23:12 potterdai

That doesn't work for me! :( @YurkoHoshko

Angarsk8 avatar Dec 29 '15 23:12 Angarsk8

Me neither, sadly. Same issue.

seanpowell avatar Dec 29 '15 23:12 seanpowell

@Angarsk8 @seanpowell You guys should check @YurkoHoshko 's repo https://github.com/YurkoHoshko/ElixirSublime

I downloaded it and replace all the files in my ElixirSublime folder, then it works

potterdai avatar Dec 29 '15 23:12 potterdai

Indeed! It works now! thanks @YurkoHoshko!!

Angarsk8 avatar Dec 30 '15 00:12 Angarsk8

Hmm. Did you all do anything different than simply overwrite the package with the updated repo? I'm still getting the same error.

seanpowell avatar Dec 30 '15 01:12 seanpowell

@seanpowell Could you add my fork as repository for your Sublime Text Package Manager and then try to reinstall this plugin. As far as I remember I had some issues with original plugin from Package Manager repo, because it does not contain latest changes from GitHub repo.

YurkoHoshko avatar Dec 30 '15 09:12 YurkoHoshko

Hey all - I didn't have "Fix Mac Path" installed on Sublime Text. Installing it seemed to do the trick (along with @YurkoHoshko's fork). Thanks @YurkoHoshko and @PotterDai.

seanpowell avatar Dec 30 '15 20:12 seanpowell

I tried pretty much every combination of what people suggested in here.

In the end using @YurkoHoshko's fork in its entirety was the solution, no path fix, env setting, etc. was necessary.

danielspofford avatar Jan 17 '16 06:01 danielspofford

Anyone have it working on windows? Installed from @YurkoHoshko's fork but still the same error. Wondering if path is formatted correctly; don't know what else it could be..

noahhai avatar Jan 27 '16 06:01 noahhai

@YurkoHoshko's fork and Fix Mac Path worked great

fergusmeiklejohn avatar Jan 28 '16 08:01 fergusmeiklejohn

I'm using @YurkoHoshko's fork and Fix Mac Path, but I'm still seeing these errors:

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 377, in on_query_completions
    res = callback.on_query_completions(v, prefix, locations)
  File "/Users/user/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 281, in on_query_completions
    session = ElixirSession.ensure(os.path.dirname(view.file_name()))
  File "/Users/user/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 164, in ensure
    session.connect()
  File "/Users/user/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 183, in connect
    self.socket, _ = _socket.accept()
  File "./socket.py", line 135, in accept
socket.timeout: timed out
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 377, in on_query_completions
    res = callback.on_query_completions(v, prefix, locations)
  File "/Users/user/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 283, in on_query_completions
    if not session.send('COMPLETE', expand_selection(view, locations[0], aliases=aliases)):
  File "/Users/user/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 193, in send
    self.socket.send(str.encode(cmd))
AttributeError: 'NoneType' object has no attribute 'send'

Sublime Text 3 and Elixir 1.2.2 installed via Homebrew.

eproxus avatar Feb 05 '16 16:02 eproxus

worker(Task, [SublimeCompletion, :connect, [3000]]) System.get_env(...port) would be lost in windows. so change this list to [3000] default, will easily fix this error, but it's not good to solve this problem.

mahal907 avatar Feb 06 '16 04:02 mahal907

The error I had was apparently related to an outdated Hex version (see #28).

eproxus avatar Feb 08 '16 09:02 eproxus

Having trouble here. Trying to type IO.puts but not seeing completion. However the linter is working.

SublimeLinter: elixirlinter activated: /usr/local/bin/elixirc It would be helpful if any errors were logged to the Sublime console.

Sublime Text Dev Channel Build 3102 OS X 10.11.3 El Capitan with Elixir 1.2.2 and Erlang/OTP 18 [erts-7.2.1]. Installed via Homebrew as suggested in the documentation.

I tried running the command @developerworks did https://github.com/vishnevskiy/ElixirSublime/issues/22#issuecomment-160044489 and I see the same error. Not sure if that means anything?

Not seeing any difference with @YurkoHoshko's patch #25.

nathany avatar Feb 09 '16 17:02 nathany

I did add the @YurkoHoshko's repo to my sublime Package Control: Add Repository I removed the package and then I installed it again with the new added repo

It works! Thanks a lot :D

aromeronavia avatar Feb 21 '16 03:02 aromeronavia

@setzer777 Thanks, that worked for me, too :+1:

JamesLefrere avatar Feb 21 '16 16:02 JamesLefrere

@YurkoHoshko PR has been merged but still not working for me, using Elixir v1.2.3

nicholasruunu avatar Mar 03 '16 14:03 nicholasruunu

Ok, got it working, first install the deps:

cd "~/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/sublime_completion"
mix deps.get
  1. Choose Y to install.
  2. Add this repository (master) to Package Control.
  3. Remove ElixirSublime and install it again.

I also installed "Fix Mac Path" plugin and added the { "env" { "PATH": /usr/local/bin } } but I'm not sure that's needed.

nicholasruunu avatar Mar 03 '16 15:03 nicholasruunu

Same problem here with El Capitan and Elixir 1.2.4.

Fixed it with all the above (mix.deps, fix mac path, setting env) AND adding autocomplete_server to the confix.exs as described in #18 (without the trailing ,).

rubas avatar Apr 10 '16 16:04 rubas

@YurkoHoshko's repo also worked for me. So strange... Does this repo need to be republished into the Sublime repo?

divmgl avatar Apr 11 '16 07:04 divmgl

@divmgl My PR was merged. Seems like repo was not updated in Package Manager repository, so yes - most probably it needs to be republished.

YurkoHoshko avatar Apr 11 '16 08:04 YurkoHoshko

@vishnevskiy Could you update this repo in Package Manager repositories - because it seems to be quite outdated there. Thanks.

YurkoHoshko avatar Apr 11 '16 08:04 YurkoHoshko

I tried installing directly from this repo.. Didn't work, though the fork from @YurkoHoshko works.

foliot avatar Apr 20 '16 01:04 foliot

If @vishnevskiy could add @YurkoHoshko as a collaborator that would be great

divmgl avatar Apr 20 '16 01:04 divmgl

Actually there is no more need to use my fork now - my PR was merged as well as a couple of other nice fixes - so instead of adding my repository for your Sublime Text Package Manager you can just add this one.

YurkoHoshko avatar Apr 20 '16 10:04 YurkoHoshko

I tried adding this repository to sublime and installing that way, but it gives me the same error others have been getting. The @YurkoHoshko repo is the only way I have gotten it to work.

foliot avatar Apr 20 '16 18:04 foliot

It works for me now :rocket:

Changes made regarding this plugin:

In Sublime Text 3, Preferences -> Package Settings -> SublimeLinter -> Settings-User

        "env": {
            "PATH": "/usr/local/bin/elixir"
        }

(I use ubuntu 14.04 and the "PATH" above is from running which elixir in terminal)

Go to sublime_completion using cd ~/.config/sublime-text-3/Packages/ElixirSublime/sublime_completion (which is a mix project)

In mix.exs file, add iex as an application

  def application do
    [
      applications: [:iex, :logger, :poison],
      mod: {SublimeCompletion, []}
    ]
  end

In config.exs file, add the configuration for iex

  use Mix.Config

  config :iex,
          autocomplete_server: IEx.Server

Restart the Sublime Text 3

Note: My elixir version is 1.2.3 and I am not sure whether these changes(under sublime_completion) will persist if the package gets updated by Package Control. But for time being, it works :+1:

radik909 avatar Apr 22 '16 11:04 radik909

@radik909 's way works for me, even without setting env path

coolzilj avatar Jun 01 '16 16:06 coolzilj

Have been unsuccessful after trying out @radik909 's and @YurkoHoshko 's patches. :(

This is the output of my sublime console.

SublimeLinter: elixirlinter: httpster.ex ['/Users/ananth/.asdf/shims/elixirc', '--warnings-as-errors', '--ignore-module-conflict', '-o', '/var/folders/bp/2k7q4kjd2d957yd2yh6q6syc0000gn/T/SublimeLinter3', '-pa', '/Users/ananth/development/httpster/_build/dev/lib/httpster/ebin'] Traceback (most recent call last): File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 333, in on_activated_async callback.on_activated_async(v) File "/Users/ananth/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 268, in on_activated_async self.on_load_async(view) File "/Users/ananth/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 273, in on_load_async ElixirSession.ensure(os.path.dirname(filename)) File "/Users/ananth/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 164, in ensure session.connect() File "/Users/ananth/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 183, in connect self.socket, _ = _socket.accept() File "./python3.3/socket.py", line 135, in accept socket.timeout: timed out

ananth99 avatar Jun 04 '16 09:06 ananth99

@ananth99

  • I got the same error few days back.
  • I removed the plugin(using Package Control - remove package) and reinstalled it.
  • Then https://github.com/vishnevskiy/ElixirSublime/issues/22#issuecomment-213393356

Give it a try. Might work :+1:

radik909 avatar Jun 22 '16 01:06 radik909

After running into performance issues with Atom I gave Sublime + SublimeElixir a test, but after running into complications, trying the advice above I still am not getting it to work; console gives me the following:

Traceback (most recent call last): File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 377, in on_query_completions res = callback.on_query_completions(v, prefix, locations) File "/Users/simondelacourt/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 283, in on_query_completions if not session.send('COMPLETE', expand_selection(view, locations[0], aliases=aliases)): File "/Users/simondelacourt/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 193, in send self.socket.send(str.encode(cmd)) AttributeError: 'NoneType' object has no attribute 'send' Traceback (most recent call last): File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 333, in on_activated_async callback.on_activated_async(v) File "/Users/simondelacourt/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 268, in on_activated_async self.on_load_async(view) File "/Users/simondelacourt/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 273, in on_load_async ElixirSession.ensure(os.path.dirname(filename)) File "/Users/simondelacourt/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 164, in ensure session.connect() File "/Users/simondelacourt/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 183, in connect self.socket, _ = _socket.accept() File "./python3.3/socket.py", line 135, in accept socket.timeout: timed out Traceback (most recent call last): File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 377, in on_query_completions res = callback.on_query_completions(v, prefix, locations) File "/Users/simondelacourt/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 283, in on_query_completions if not session.send('COMPLETE', expand_selection(view, locations[0], aliases=aliases)): File "/Users/simondelacourt/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 193, in send self.socket.send(str.encode(cmd)) AttributeError: 'NoneType' object has no attribute 'send' Traceback (most recent call last): File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 377, in on_query_completions res = callback.on_query_completions(v, prefix, locations) File "/Users/simondelacourt/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 283, in on_query_completions if not session.send('COMPLETE', expand_selection(view, locations[0], aliases=aliases)): File "/Users/simondelacourt/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 193, in send self.socket.send(str.encode(cmd)) AttributeError: 'NoneType' object has no attribute 'send'

simondelacourt avatar Jun 30 '16 09:06 simondelacourt

Not working for me even after following the steps by @radik909, including removing/re-adding the package.

I get this error in the Sublime 3 console whenever I open any .exs file:

Traceback (most recent call last): File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 258, in on_load_async callback.on_load_async(v) File "/Users/egeersoz/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 273, in on_load_async ElixirSession.ensure(os.path.dirname(filename)) File "/Users/egeersoz/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 164, in ensure session.connect() File "/Users/egeersoz/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 181, in connect self.process = run_mix_task('run --no-halt') File "/Users/egeersoz/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 69, in run_mix_task startupinfo=startupinfo) File "./python3.3/subprocess.py", line 819, in __init__ File "./python3.3/subprocess.py", line 1448, in _execute_child FileNotFoundError: [Errno 2] No such file or directory: 'mix' Traceback (most recent call last): File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 333, in on_activated_async callback.on_activated_async(v) File "/Users/egeersoz/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 268, in on_activated_async self.on_load_async(view) File "/Users/egeersoz/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 273, in on_load_async ElixirSession.ensure(os.path.dirname(filename)) File "/Users/egeersoz/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 164, in ensure session.connect() File "/Users/egeersoz/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 181, in connect self.process = run_mix_task('run --no-halt') File "/Users/egeersoz/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 69, in run_mix_task startupinfo=startupinfo) File "./python3.3/subprocess.py", line 819, in __init__ File "./python3.3/subprocess.py", line 1448, in _execute_child FileNotFoundError: [Errno 2] No such file or directory: 'mix'

egeersoz avatar Jul 24 '16 23:07 egeersoz

I can't make it work, too. (I'm new to Elixir) I'm using a Mac and the latest Elixir (1.3.4). I tried @radik909's advice, but that didn't help.

Is there anybody with a working version on Mac? :)

StanBright avatar Nov 03 '16 15:11 StanBright

Still an issue for me. Here's my console if it helps.

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 530, in on_activated_async
    callback.on_activated_async(v)
  File "/Users/dave/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 255, in on_activated_async
    self.on_load_async(view)
  File "/Users/dave/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 260, in on_load_async
    ElixirSession.ensure(os.path.dirname(filename))
  File "/Users/dave/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 160, in ensure
    session.connect()
  File "/Users/dave/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 179, in connect
    self.socket, _ = _socket.accept()
  File "./python3.3/socket.py", line 135, in accept
socket.timeout: timed out
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/dave/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 270, in on_query_completions
    if not session.send('COMPLETE', expand_selection(view, locations[0], aliases=aliases)):
  File "/Users/dave/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 189, in send
    self.socket.send(str.encode(cmd))
AttributeError: 'NoneType' object has no attribute 'send'

I don't know jack about sublime plugins or python, but that socket timeout seems suspicious.

Also, I have my env pointing to my elixir binary folder.

DaveSanders avatar Dec 03 '16 18:12 DaveSanders

On a Mac here running Elixir version 1.4.2, I uninstalled everything Elixir, and reinstalled Elixir, then this, then linter (not sure if order matters) and it's working for me now

wess avatar Apr 12 '17 22:04 wess

I got it working on a Mac running elixir version 1.4.2. I uninstalled the plugin and reinstalled and then followed https://github.com/vishnevskiy/ElixirSublime/issues/22#issuecomment-213393356

nhooyr avatar May 09 '17 22:05 nhooyr

I can't make the code completion to work on Ubuntu, sublime text 3, with elixir 1.4.2 I followed the instructions given in this comment #22 I have installed ElixirSublime, SublimeLinter, and Elixir-tmbundle

jpyamamoto avatar May 13 '17 19:05 jpyamamoto

Not sure why, but it only works for me if I install the package control version, not the one from this repository.

nhooyr avatar May 31 '17 01:05 nhooyr