Comments (16)
I have fixed the issue. Here are the steps
- Download the source code zip from here https://github.com/elixir-lang/elixir/releases/tag/v1.12.3
- Unzip the file and rename it to
elixir
cd elixir
make clean test
- Edit .bashrc or .zshrc file and it should be like this
. $HOME/.asdf/asdf.sh
export PATH=$PATH:/Users/khanakia/.asdf/shims
export PATH="$PATH:/Users/khanakia/D1/elixir/bin"
- Make sure you do not have elixir installed using
asdf
- Run these commands
asdf global elixir path:/Users/khanakia/D1/elixir
asdf plugin add elixir
- Verify the asdf plugins by running
asdf current
and this will output
elixir path:/Users/khanakia/D1/elixir /Users/khanakia/.tool-versions
erlang 24.1.4 /Users/khanakia/.tool-versions
- Confirm
elixir -v
Erlang/OTP 24 [erts-12.1.4] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]
Elixir 1.12.3 (compiled with Erlang/OTP 24)
- Now you can open the vscode with elixir-ls plugin installed and it will fetch the core function definition e.g.
IO.puts("demo")
I can simply click the puts and it will open the IO code file
from elixir_sense.
Hi there,
has anyone figured out how to get the language server to find sources on Windows? I see:
Elixir sources not found (checking in d:/home/runner/work/elixir/elixir
I installed Elixir using the standard installer which puts it in the program files directory (I assume with no source). I'd be happy to manually download the source and configure a pointer to it if that's a possibility.
(Note that d:/home/
is not a valid directory on my machine. I'm not sure where it's getting that path from).
(Additionally, asdf
isn't available for Windows and building Elixir from source on Windows appears to be non-trivial - although I'd love to be proved wrong).
from elixir_sense.
In case it is helpful, that repo has Rexbug printing out a trace to help quickly see each function's arguments and return value.
from elixir_sense.
I see now that if I install elixir from source (e.g. with asdf install elixir ref:HEAD
) the tests pass. Would it make sense to 1) call this out in the docs, and 2) consider returning something else that more clearly states why the definition wasn't found?
from elixir_sense.
@balduncle yes, we can only "find definition" or "go to definition" if Elixir was installed from source. Not sure if there's another way to do this. Maybe we could accept an option like src_path
and then users could just download the source and set the option. Ideally, I think the editor could even ask the user if he wants the source to be downloaded and automatically set the option whenever the editor needs to find definitions. Since this will demand work on the editor plugins side, we would need confirmation from those projects maintainers if they are willing to do those changes.
- call this out in the docs
We should definitely have that explicit in the docs, however, remember that the end-user doesn't even know that he should read ElixirSense's docs when something doesn't work as expected, he just uses the editor that uses a plugin that uses ElixirSense under the hood.
- consider returning something else that more clearly states why the definition wasn't found?
I'm open to suggestions here ;)
from elixir_sense.
Yeah, I like the idea of having the editors download the source. It would alleviate tickets like JakeBecker/vscode-elixir-ls#123. I'm willing to try to tackle this for vscode-elixir-ls, for what it's worth.
Fair point on the docs being more valuable for end users if present in a library that calls into ElixirSense.
from elixir_sense.
@msaraiva any update on this?
I tried to install from source asdf install elixir ref:HEAD
but Go To Definition is still not working
from elixir_sense.
@khanakia can yo debug it with?
iex(3)> Enum.module_info[:compile][:source]
'/Users/me/elixir/lib/elixir/lib/enum.ex'
on my machine the sources are in the directory that is returned (I don't use asdf, I build elixir myself)
head -n 1 /Users/me/elixir/lib/elixir/lib/enum.ex
defprotocol Enumerable do
from elixir_sense.
iex(2)> Enum.module_info[:compile][:source]
'/home/build/elixir/lib/elixir/lib/enum.ex'
iex(3)>
The above path does not exists. But i verified this path exists /Users/khanakia/.asdf/installs/elixir/1.12.3-otp-24/lib/elixir/lib/enum.ex
My binaries are located in this folder
/Users/khanakia/.asdf/shims/iex
/Users/khanakia/.asdf/shims/elixir
How can I change the path to point the elixir to a new path?
from elixir_sense.
@lukaszsamson So paths are correct now after I compiled with source. This is the new path it's showing now
iex(1)> Enum.module_info[:compile][:source]
'/Users/khanakia/D1/elixir/lib/elixir/lib/enum.ex'
iex(2)>
But Go to definition still not works as you can see in the attached screenshot
from elixir_sense.
@lukaszsamson Also i just reinstalled the elixir-ls
vscode extension and I can see now the extension is not loaded at all and the reason extension looks for a binary under asdf
path but as I compiled the binaries manually so they exist in the different path now.
As https://github.com/elixir-lsp/vscode-elixir-ls required the elixir to be installed using the asdf path.
Refer to this issue. elixir-lsp/vscode-elixir-ls#208
Show how did you make it work with the custom build then as vscode extension requires asdf LOL ?
from elixir_sense.
Must I install elixir via asdf to use this? Im an Intel Mac user, I installed elixir via brew. And i have the same problems that i cant use the Go to Definition function with the VS Code extension
from elixir_sense.
I have fixed the issue. Here are the steps
- Download the source code zip from here https://github.com/elixir-lang/elixir/releases/tag/v1.12.3
- Unzip the file and rename it to
elixir
cd elixir
make clean test
- Edit .bashrc or .zshrc file and it should be like this
. $HOME/.asdf/asdf.sh export PATH=$PATH:/Users/khanakia/.asdf/shims export PATH="$PATH:/Users/khanakia/D1/elixir/bin"
- Make sure you do not have elixir installed using
asdf
- Run these commands
asdf global elixir path:/Users/khanakia/D1/elixir asdf plugin add elixir
- Verify the asdf plugins by running
asdf current
and this will outputelixir path:/Users/khanakia/D1/elixir /Users/khanakia/.tool-versions erlang 24.1.4 /Users/khanakia/.tool-versions
- Confirm
elixir -v
Erlang/OTP 24 [erts-12.1.4] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] Elixir 1.12.3 (compiled with Erlang/OTP 24)
- Now you can open the vscode with elixir-ls plugin installed and it will fetch the core function definition e.g.
IO.puts("demo")
I can simply click the puts and it will open the IO code file
i tried these steps, however im stucked at step 4, i got the following error after running the command make clean test
rm -rf ebin
rm -rf lib//ebin
rm -rf lib/elixir/src/elixir_parser.erl
rm -rf lib//_build/
rm -rf lib/*/tmp/
rm -rf lib/elixir/test/ebin/
rm -rf lib/mix/test/fixtures/deps_on_git_repo/
rm -rf lib/mix/test/fixtures/git_rebar/
rm -rf lib/mix/test/fixtures/git_repo/
rm -rf lib/mix/test/fixtures/git_sparse_repo/
rm -f erl_crash.dump
rm -f man/elixir.1
rm -f man/elixir.1.bak
rm -f man/iex.1
rm -f man/iex.1.bak
make: erlc: No such file or directory
make: *** [lib/elixir/src/elixir_parser.erl] Error 1
from elixir_sense.
Can i ask the if go to definition function will only on default function such IO.inspect
etc?
Currently i can see the definition of IO.inspect, IO.puts etc.
But, I have a helper.ex file and when i import it into another file(example, users.ex), i can't see the definition of the functions that is in the helper.ex from the users.ex file, is this normal?
from elixir_sense.
@Sky0307 the steps i gave once you perform VS Code Go To Definition will work for everything.
Regarding helper.ex you cannot inspect because you did not compile the file using elixirc. So there are 2 ways:
- Compile the helper.ex file within the same directory and then you will see the VS Code Definition
- Use mix to create a project. That the most common approach everybody uses.
from elixir_sense.
@khanakia Thanks for your help! I actually created my project with mix.
Anyway, I managed to get the extension working!
Here's a few things I did, hope it will help others who facing the same issue.
I am an Intel Mac user, I installed both elixir
and asdf
with brew.
Then, I did the following:
- edit .zshrc file
. /usr/local/opt/asdf/libexec/asdf.sh
export PATH=$PATH:/Users/skylee/.asdf/shims
export PATH="$PATH:/usr/local/Cellar/elixir/1.13.1"
- run the command
asdf global elixir path:/usr/local/Cellar/elixir/1.13.1/
asdf plugin add elixir
asdf current
gives me the following output
elixir path:/usr/local/Cellar/elixir/1.13.1/ /Users/skylee/.tool-versions
erlang path:/usr/local/Cellar/erlang/24.2/ /Users/skylee/.tool-versions
On top of this, I compiled my project with elixir -S mix phx.server
from elixir_sense.
Related Issues (20)
- Type system could handle function captures
- Signature provider reveals opaque type details
- No specs on metadata type suggestions
- Duplicated signatures for local dunctions
- Provide full documentation for code in current buffer
- Local macro is available only after definition
- Incorrect handling of alias and require with warn option
- Suggestion crash on elixir 1.15
- quote used as variable not working correctly with docs and definition provider
- Binding does not respect requires and local macro position
- Multiple meta looks bad in docs
- No spec in signature and docs for module_info on local module
- Invalid handling of MACRO- in params reducer
- Add hidden metadata on doc:false and underscored functions and types
- Variable matching regex is invalid
- Document that this is included in elixir-ls HOT 2
- Language Server crashes when autocompleting `:pg`
- Definition provider does not work for nested phoenix scopes HOT 3
- Error when Module Attribute in Docstring HOT 3
- What does providers being deprecated mean for plugins? HOT 2
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 elixir_sense.