Comments (17)
Hmm It might be because the Hello.UserSocket
is not compiled (https://github.com/slashmili/alchemist.vim/wiki#important-notes)
Can you try to run mix compile
and try the autocomplete again?
That's known issue(not an issue really) because auto complete uses alchemist-server and if there is no beam file for Hello.UserSocket
, it can't find source file for module Hello.UserSocket
from alchemist.vim.
It still doesn't work after mix compile. I was running it with mix
phoenix.server before so I don't think that'd be the issue. Is there a
debug command I can run to give more info?
On Wednesday, August 24, 2016, Milad [email protected] wrote:
Hmm It might be because the Hello.UserSocket is not compiled (
https://github.com/slashmili/alchemist.vim/wiki#important-notes)Can you try to run mix compile and try the autocomplete again?
That's known issue(not an issue really) because auto complete uses
alchemist-server and if there is no beam file for Hello.UserSocket, it
can't find source file for module Hello.UserSocket—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#54 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AB-JyEcACH76qP3spWtA5RgdHYhmJWGvks5qjDR6gaJpZM4Jr696
.
from alchemist.vim.
you can enable debug
variable in ~/.vim/bundle/alchemist.vim/alchemist_client
, the logs go to syslog. try to trigger jump to definition and see what command is executed in syslog, for ex:
Aug 25 10:41:03 Milads-MacBook-Pro alchemist_client[5167]: DEFLX { "Hello.UserSocket", [ context: Elixir, imports: [Hello.EndPoint], aliases: []] }
You will see
DEFLX
andDEFL
in the log.DEFLX
is sent by vim plugin to the client andDEFL
is what actually is sent to alchemist-server.DEFLX
has some extra functionality like finding the line of the code that a module or a function is defined.
then you can run alchemist client directly and execute the command directly:
~/.vim/bundle/alchemist.vim/alchemist_client -d ~/mix/project/path
DEFLX { "Hello.UserSocket", [ context: Elixir, imports: [Hello.EndPoint], aliases: []] }
If it didn't return the file name, check alchemist-server
directly,
$ cd ~/mix/project/path
elixir ~/.dotfiles/.vim/bundle/alchemist.vim/alchemist-server/run.exs --env=dev
DEFL { "Hello.UserSocket,nil", [ context: Elixir, imports: [Hello.EndPoint], aliases: []] }
~/mix/project/path/channels/user_socjet.ex
END-OF-DEFL
After running alchemist server, it's waiting for a command to be entered in STDIN . Past the DEFL
command and enter. If IEx is able to find the source file would return the path.
Let me know if you get file path back from alchemist-server
.
from alchemist.vim.
Running the command in alchemist client didn't work but alchemist-server worked. Here's what I ran (both commands were copied directly from syslog):
from alchemist.vim.
That is indeed strange.
Both of them works for me:
~/d/t/hello $ ~/.vim/bundle/alchemist.vim/alchemist_client -d ./
DEFLX { "Hello.UserSocket", [ context: Elixir, imports: [Hello.Endpoint], aliases: []] }
/Users/milad/dev/tmp/hello/web/channels/user_socket.ex:1
END-OF-DEFLX
~/d/t/hello $ elixir ~/.dotfiles/.vim/bundle/alchemist.vim/alchemist-server/run.exs --env=dev
DEFL { "Hello.UserSocket,nil", [ context: Elixir, imports: [Hello.Endpoint], aliases: []] }
/Users/milad/dev/tmp/hello/web/channels/user_socket.ex
END-OF-DEFL
Is it possible for you to do more debugging in alchemist.vim/alchemist.py
at _send_deflx
function? At line 173
, it gets the result back from alchemist-server and I want to see if it returns it correctly. looks like at 177
the client doesn't get back any file name as result and return(which apparently it shouldn't)
from alchemist.vim.
So am I. I also cannot jumping with E426: tag not found: ***MODULENAME***
error.
from alchemist.vim.
@hykw can you also try the same steps as @troq? Also please mention elixir version that you are running on your machine
from alchemist.vim.
I followed the steps, and found out that at least aliases
doesn't work correctly.
Notice: I replaced the module name in the following snippets with Sample
and TestModule
, so it differs with the actual module name I pushed thru STDIN.
$ elixir alchemist-server/run.exs --env=dev
DEFL { "Sample.TestModule,nil", [ context: Elixir, imports: [Sample.TestModule], aliases: [{Sample, Sample.}]] }
15:22:12.411 [error] GenServer #PID<0.117.0> terminating
** (SyntaxError) nofile:1: syntax error before: '}'
(elixir) src/elixir.erl:184: :elixir.eval/3
(elixir) lib/code.ex:168: Code.eval_string/3
alchemist-server/lib/api/defl.exs:83: Alchemist.API.Defl.normalize/1
alchemist-server/lib/api/defl.exs:13: Alchemist.API.Defl.request/1
alchemist-server/lib/helpers/process_commands.exs:20: Alchemist.Helpers.ProcessCommands.process/2
alchemist-server/lib/server/io.exs:21: Alchemist.Server.IO.handle_info/2
(stdlib) gen_server.erl:615: :gen_server.try_dispatch/4
Last message: :timeout
State: "dev"
** (EXIT from #PID<0.47.0>) an exception was raised:
** (SyntaxError) nofile:1: syntax error before: '}'
(elixir) src/elixir.erl:184: :elixir.eval/3
(elixir) lib/code.ex:168: Code.eval_string/3
alchemist-server/lib/api/defl.exs:83: Alchemist.API.Defl.normalize/1
alchemist-server/lib/api/defl.exs:13: Alchemist.API.Defl.request/1
alchemist-server/lib/helpers/process_commands.exs:20: Alchemist.Helpers.ProcessCommands.process/2
alchemist-server/lib/server/io.exs:21: Alchemist.Server.IO.handle_info/2
(stdlib) gen_server.erl:615: :gen_server.try_dispatch/4
It works to be cut in aliases, but it cannot find the file.
$ elixir alchemist-server/run.exs --env=dev
DEFL { "Sample.TestModule,nil", [ context: Elixir, imports: [Sample.TestModule], aliases: []] }
END-OF-DEFL
Also I found that it correctly finds and jumps to the definitions, when called in routes.ex. In the snippets, Guardian.Plug.VerifySession
, Guardian.Plug.LoadResource
and Sample.Plug.ConnAssigns
are found-able.
pipeline :browser_session do
plug Guardian.Plug.VerifySession
plug Guardian.Plug.LoadResource
plug Sample.Plug.ConnAssigns
end
from alchemist.vim.
Hey @hykw thanks for the details. I'll come back to you later :)
from alchemist.vim.
@hykw So there are few points:
- Autocomplete works after your files are compiled and judging by the name of module, you'r trying to jump to a Test file which is
exs
which doesn't compile... - The sample that you provided has a wrong
alchemist-server
protocol which could be easily fixed by the plugin. I believe you had an unfinished line like:
defmodule Foo
alias Sample.
and before completing the syntax you tried to run ExDef (or maybe you have auto save on or ...). As I mentioned I'll send a patch to not include unfinished like this into alias list
Let me know if my assumptions are correct
from alchemist.vim.
I've prepared a sample project, which reproduces the issue. Doesn't it occure in your environment?
https://github.com/hykw/alchemist-vim_exdef_test
The issue occures in my environment with the following steps:
$ cd src
$ mix phoenix.new
Confirmed the beam files are in _build/dev/lib/sample/ebin/ (I've checked in the files into GitHub, just in case)
$ vi web/router.ex
- Line 2
- cursor is on
e
as inSample.web
(pic1) :ExDef
works. jumped to web/web.ex(pic2)
- cursor is on
- Line 19
- on
t
as inPageController
(pic3) :ExDef
fails(pic4)
- on
c.f.
/var/log/message is following.
Sep 11 14:20:43 myserver alchemist_client: Load server settings from: /tmp/alchemist_server/zShomezShitoshi-hayakawazSazSalchemist-vim_exdef_testzSsrc
Sep 11 14:20:43 myserver alchemist_client: response for PING: PONG\nEND-OF-PING\n
Sep 11 14:20:43 myserver alchemist_client: DEFLX { "PageController", [ context: Elixir, imports: [Sample.Router], aliases: []] }
Sep 11 14:20:43 myserver alchemist_client: DEFL { "PageController,nil", [ context: Elixir, imports: [Sample.Router], aliases: []] }
Sep 11 14:20:43 myserver alchemist_client: response for DEFL: \nEND-OF-DEFL\n
from alchemist.vim.
@hykw thanks a lot for spending time on debugging the issue.
This case is a bit different! which I didn't cover :(
The reason that you can use PageController
in the code is because scope
is a macro that knows PageController
is under Sample
module but it's a bit hard to know that in this plugin.
from alchemist.vim.
I've found the correct/wrong case. It fails if alias is set in a module. It doesn't matter called with absoletely(Foo.Bar.foo()) or relatively(Bar.foo()).
Sample code:
https://github.com/hykw/alchemist-vim_exdef_test/blob/master/src/web/controllers/page_controller.ex
The difference beetween Sample.WrongCase and Sample.CorrectCase are alias
. It doesn't work in Sample.WrongCase but it does work in Sample.CorrectCase!
from alchemist.vim.
Correct it doesn't work in Sample.WrongCase
module because of multi line alias (issue #46) which I didn't manage to fix it yet :( try to put the alias in Sample.WrongCase
in one line and it should work
from alchemist.vim.
Oops, as you mentioned it worked with one line alias.
alias Sample.Module1
def index(conn, _) do
foo = Sample.Module1.foo
end
from alchemist.vim.
@slashmili sorry for being MIA (busy month!). For some reason, ExDef is working as expected now. I'm guessing the bug was caused by an issue with my system state rather than alchemist itself. I'll close the issue for now and reopen if it reoccurs in the future.
from alchemist.vim.
Great 👍
Sorry I couldn't help much
from alchemist.vim.
Related Issues (20)
- socket is not available HOT 17
- K / ExDoc loses last line of documentation HOT 1
- Suggestions dont show up for deoplete HOT 2
- Feature Request: Let alchemist.vim call elixir_sense's "Referrers" code HOT 6
- failed to load deoplete source HOT 2
- something wrong editing the elixir code with spacevim HOT 1
- error on looking up for a function that is imported
- Error when work with YouCompleteMe HOT 1
- Problems installing with vim-plug for VimR (Neovim) on macOS? HOT 1
- Change short keys bindings for ExDoc? HOT 7
- ExDoc and ExDef for functions (or modules) in Embedded Elixir files HOT 1
- ExDoc shortcut fails when non-ascii characters present in source file HOT 7
- ExDoc is wrong arity for function called in 'pipeline' HOT 3
- Python error HOT 2
- When trying to jump to a function definition: Error: "E484: Can't open file: b' ..." HOT 3
- Autocomplete imports already written module HOT 7
- definition_not_found% for local definition in small project (wrong working directory?) HOT 5
- Autocomplete not works on Windows HOT 3
- Doesn't work on Ubuntu 20.04 HOT 6
- Can we change this to '<C-[>'?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alchemist.vim.