vishnevskiy / elixirsublime Goto Github PK
View Code? Open in Web Editor NEWElixir plugin for SublimeText 3 providing code completion and linting.
License: MIT License
Elixir plugin for SublimeText 3 providing code completion and linting.
License: MIT License
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 358, 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 270, 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 189, in send
self.socket.send(str.encode(cmd))
AttributeError: 'NoneType' object has no attribute 'send'
In Phoenix projects, use Phoneix.X
gives a lint warning saying that it cannot find the proper module.
Steps to reproduce:
See a red dot on line 2 with statement "Error: module Phoenix.Router is not loaded and cannot be found.
Erlang/Elixir process is being started when linter kicks in and is never released. With continuous usage multiple processes are being started and hang around until closing sublime or being killed.
Full process string:
/usr/lib/erlang/erts-7.1/bin/beam.smp -- -root /usr/lib/erlang -progname erl -- -home /home/dexior -- -pa /usr/lib/elixir/bin/../lib/eex/ebin /usr/lib/elixir/bin/../lib/elixir/ebin /usr/lib/elixir/bin/../lib/ex_unit/ebin /usr/lib/elixir/bin/../lib/iex/ebin /usr/lib/elixir/bin/../lib/logger/ebin /usr/lib/elixir/bin/../lib/mix/ebin -noshell -s elixir start_cli -extra /usr/bin/mix run --no-halt
System information:
$ elixir -v
Elixir 1.1.1
$ uname -a
Linux hostname 4.2.4-1-ARCH #1 SMP PREEMPT Fri Oct 23 07:32:38 CEST 2015 x86_64 GNU/Linux
Sublime Text 3 Build 3083
SublimeLinter and ElixirSublime installed via Package Control
Reproduction:
Result:
Hi, I use a few key bindings to help with Mix that fit really well in here.
[
{"command": "exec", "keys": ["alt+m", "alt+t"], "args": {"cmd": ["/usr/bin/mix", "test"]} },
{"command": "exec", "keys": ["alt+m", "alt+c"], "args": {"cmd": ["/usr/bin/mix", "compile"]} },
{"command": "exec", "keys": ["alt+m", "alt+g"], "args": {"cmd": ["/usr/bin/mix", "deps.get"]} }
]
Hi ,
Your plugin looks quite awesome. could you please provide clearer instruction for installing the plugin in sublime editor 3? would love to play with it and see how it works out.
Thanks for the good work.
I added the bin path as the troubleshooting describes but it is still not working. I have installed on both Windows and macOS and I only have this problem on Windows.
In my user setting:
"env":
{
"PATH": "C:\\Program Files (x86)\\Elixir\\bin"
},
The first time a type a letter after starting Sublime I get:
Traceback (most recent call last):
File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 591, in on_query_completions
res = callback.on_query_completions(v, prefix, locations)
File "C:\Users\myName\AppData\Roaming\Sublime Text 3\Packages\ElixirSublime\elixir_sublime.py", line 268, in on_query_completions
session = ElixirSession.ensure(os.path.dirname(view.file_name()))
File "C:\Users\myName\AppData\Roaming\Sublime Text 3\Packages\ElixirSublime\elixir_sublime.py", line 160, in ensure
session.connect()
File "C:\Users\myName\AppData\Roaming\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
And then I get this every letter thereafter:
Traceback (most recent call last):
File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 591, in on_query_completions
res = callback.on_query_completions(v, prefix, locations)
File "C:\Users\myName\AppData\Roaming\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 "C:\Users\myName\AppData\Roaming\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'
Good plugin. Maybe possible to make such for CudaText? (It has py API)
Whenever a newer Hex version is available, there is a chance that the old version somehow breaks. The plugin then breaks on running deps.get
, e.g. with the following output in the ElixirSublime.log
:
A new Hex version is available (v0.10.4), please update with `mix local.hex`
Running dependency resolution
** (UndefinedFunctionError) undefined function Access.Map.get_and_update!/3 (module Access.Map is not available)
The solution is to add the following line before getting dependencies.
run_mix_task('local.hex --force')
_socket.listen(1)
_socket.settimeout(5)
+ run_mix_task('local.hex --force')
run_mix_task('deps.get')
(Diff based on PR #25)
Not sure even how to try and help with this, but installing this package disables the default selection behaviour of shift+click.
Using sublime text 3, build 3065.
I see this in the console:
Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 210, in on_api_ready
m.plugin_loaded()
File "/Users/sam/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 17, in plugin_loaded
run_mix_task('deps.get')
File "/Users/sam/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 65, 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'
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?
Hello there!
I have two modules defined in different files, one is using the struct defined in the other, as the following code explains:
# ./lib/identicon.ex
defmodule Identicon do
def hash_input(input) do
hex = :crypto.hash(:md5, input)
|> :binary.bin_to_list()
# I'm getting the error in the line below
%Identicon.Image{hex: hex}
end
end
# ./lib/image.ex
defmodule Identicon.Image do
defstruct hex: nil, color: nil, grid: nil, pixel_map: nil
end
The exact error I get from elixirlinter
is the following:
Error: Identicon.Image.__struct__/0 is undefined, cannot expand struct Identicon.Image
The application is running perfectly when executed using iex -S mix
.
It seems that I can't load external dependencies for the current file. My question is how to do that? Is there any better approach?
Thanks in advance!
Hi,
I was having issues with the autocomplete upon upgrading to Elixir v1.1.0. The issue is on IEx.Autocomplete.expand:
16:39:33.139 [error] Task #PID<0.130.0> started from SublimeCompletion.Supervisor terminating
** (UndefinedFunctionError) undefined function: nil.current_env/0 (module nil is not available)
nil.current_env()
lib/iex/autocomplete.ex:172: IEx.Autocomplete.env_aliases/0
lib/iex/autocomplete.ex:159: IEx.Autocomplete.expand_alias/1
lib/iex/autocomplete.ex:145: IEx.Autocomplete.expand_elixir_modules/2
(sublime_completion) lib/sublime_completion.ex:129: SublimeCompletion.expand/1
(sublime_completion) lib/sublime_completion.ex:41: SublimeCompletion.read_line/1
(sublime_completion) lib/sublime_completion.ex:29: SublimeCompletion.loop/1
(elixir) lib/task/supervised.ex:74: Task.Supervised.do_apply/2
Function: &SublimeCompletion.connect/1
Args: [50625]
It happens because of the following commit: elixir-lang/elixir@5e21d0d
My simple fix was to add to the sublime_completion config.exs:
config :iex,
autocomplete_server: IEx.Server,
Bruno.
Hello,
Any idea how to fix this
Error: module MyApp.Web is not loaded and could not be found
also the instructions here #5 not working
thanks
Hi,
The emacs plugin, Alchemist, recent broke out it's functionality into a server portion for others to use https://github.com/tonini/alchemist-server. It's still fairly early, but I was wondering if you think it is something that could be useful for ElixirSublime?
Tried to use this Elixir autocompletion and linter, but it could not work.
I have this in my Sublime Text v3 User Settings:
"env":
{
"PATH": "/usr/local/Cellar/elixir/1.0.2/bin"
},
Sometimes beam files can be in sibling projects or in the deps of the umbrella project itself. When this happens, ElixirSublime cannot find them. This makes using ElixirSublime impossible for umbrella projects.
doc
is often injected in place of do
with the ElixirSublime autocomplete enabled. This slows down development and should take lower precedence than do
.
Thanks!
I'm getting
** (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
running iex -S mix
on the sublime_completion folder.
It looks like latest Sublime version doesn't run plugins with user's shell environment, so PATH
doesn't contain required paths and ElixirSublime cannot find mix
.
Specifying PATH
in sublime settings is not a good solution because it changes if you're using kiex or something similar.
SublimeLint does some smart trick to get actual PATH
from user's shell.
It would be nice if ElixirSublime could do something like this to get desired PATH
value.
The linter works but the linter shows this error. I am working on test project on phoenix called HelloPhoenix.
For the code
use HelloPhoenix.Web, :view
And this is the error I get Error: module HelloPhoenix.Web is not loaded and could not be found. But mix does not have any complaints and the project runs on server.
Code completion does not work as shown. Like the Enum module is not showing on auto completion but def
,defmacro
,receive
are working.
I tried to change the user settings but it made no effect
"env":
{
"PATH": "/usr/local/lib/elixir/bin"
}
Using Ubuntu 14.04LTS
Sublime Text 3
If I type the line File.mkdir("tmp")
in Sublime 3, it will make said directory in the working directory of the file.
After some testing, it also happens with File.touch
and I'm sure a few others.
I'm currently playing a bit around with this plugin and was wondering how difficult it would be to implement auto-adding of end
once you write do
.
I come from emacs where this stuff happens automagically so I'm probably a bit spoiled
I'm installing elixir on sublime on a new mac.
OSX 10.11.6 El Capitan
ex files show as Plain Text. Moreover, elixir isn't even a choice among languages in the dropdown in the bottom right corner.
In the console, you do see:
reloading plugin ElixirSublime.elixir_sublime
full console:
https://gist.github.com/dgoldie/a855ca8a6f815eaed3a729803e6577cb
I've tried setting adding the env with elixir path as mentioned in the README.
I've also tried all of the suggestions in
#9
Any help would be appreciated.
When using default arguments in Elixir 1.4 (i.e def foo(n \\ 0)
), the color scheme following the function declaration become messed up.
For example, I have this code:
def filter_url_domain(data, valid_domains \\ @valid_domains) do
Logger.debug "Filtering out valid domains"
data
Both the words debug
and data
show up in orange when they should be white. This error will continue for the rest of the file only effecting function calls and variable names, both of which should be white, but end up orange.
I get this error:
SublimeLinter: #339 elixirlinter 20180314105306_add_new_total_paid_back_fields.exs ERROR:
Linter crashed.
Traceback (most recent call last):
File "lint.backend in /Users/sam/Library/Application Support/Sublime Text 3/Installed Packages/SublimeLinter.sublime-package", line 97, in execute_lint_task
File "lint.linter in /Users/sam/Library/Application Support/Sublime Text 3/Installed Packages/SublimeLinter.sublime-package", line 794, in lint
File "lint.linter in /Users/sam/Library/Application Support/Sublime Text 3/Installed Packages/SublimeLinter.sublime-package", line 500, in get_cmd
File "/Users/sam/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 330, in cmd
for path in find_ebin_folders(find_mix_project(self.filename)):
File "/Users/sam/Library/Application Support/Sublime Text 3/Packages/ElixirSublime/elixir_sublime.py", line 86, in find_ebin_folders
for lib in os.listdir(lib_path):
FileNotFoundError: [Errno 2] No such file or directory: '/Users/sam/code/nested/local-stack/elixir-umbrella/apps/nest_db/_build/dev/lib'
It's looking for the _build
directory in the child app, but it should be looking in the umbrella project root.
Could you share your syntax highlight? The one at https://github.com/elixir-lang/elixir-tmbundle only highlights language keywords for me.
I'm following the Phoenix guide (section: adding pages) and I'm getting this error as well. Phoenix version 1.1.4. The errors I'm getting are:
== Compilation error on file web/views/hello_view.ex ==
** (CompileError) web/views/hello_view.ex:2: module HelloPhoenix.Web is not loaded and could not be found
(elixir) expanding macro: Kernel.use/2
web/views/hello_view.ex:2: HelloPhoenix.HelloView (module)
(elixir) lib/kernel/parallel_compiler.ex:100: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/8
and
== Compilation error on file web/controllers/hello_controller.ex ==
** (CompileError) web/controllers/hello_controller.ex:2: module HelloPhoenix.Web is not loaded and could not be found
(elixir) expanding macro: Kernel.use/2
web/controllers/hello_controller.ex:2: HelloPhoenix.HelloController (module)
(elixir) lib/kernel/parallel_compiler.ex:100: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/8
ideas?
Elixir (Through web installer) installed into default directory C:\Program Files (x86)\Elixir\bin
Erlang and all elixir binaries is work itself (i tried iex and elixir commands).
In sublime text 3 3083 i have installed elixir textmate bundle, ElixirSublime, SublimeLinter3.
Restart sublime.
My User settings
{
"color_scheme": "Packages/User/SublimeLinter/iPlastic (SL).tmTheme",
"ignored_packages":
[
"Vintage"
],
"env": {
"PATH": "C:\\Program Files (x86)\\Elixir\\bin"
}
}
Autocomplete doesnt work, Syntax highlight and Linter does.
How it can be fixed? Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.