alchemist.el
alchemist.el copied to clipboard
Documentation lookup
Hi there!
This is probably my setup's fault since I'm new to everything (Emacs, Elixir, etc) but I can't get simple documentation lookup to work for builtins like quote
.
My setup:
Spacemacs (up-to-date)
Elixir layer in Spacemacs
brew-installed elixir 1.4
I've downloaded the elixir source and can jump to the definition of quote
for example.
I can use alchemist-iex-run
to do d quote
and get docs fine. But when I'm in source and over the quote symbol for example alchemist-help-search-at-point
or alchemist-help
both produce No documentation for [quote] found.
What's strange is that I do see quote/2
as an option in the list of alchemist-help
.
I hope I didn't miss a step in your configuration docs, or am making some other silly mistake, sorry!
Thanks!
I'm also having this problem with not being able to look up documentation. Regardless of what I search for, I get No documentation for [whatever I search for] found
, but I still get to choose from a list of definitions which one I would like documentation for.
I am using Elixir installed with asdf-vm.
Now when I look at it, it seems like both asdf and homebrew installs elixir through downloading a .tar.gz and just unpacks it. This tar ball does not contain the elixir sources and it does not contain any generated documentation. Could that be the issue?
I have the same problem. But with something strange, i can go to the documentation of a function if the company-mode popup is open and i press c-h, that opens the documentation of that function.
But... if there are functions with many arities for example String.split it will only show the /1, or the function with the lower arity.
I am unfortunately having the same issue, and with the same workaround that @diaes256 reported. I'm using a fresh install of alchemist
and company
from MELPA, emacs 24.5.1.
The problem is how alchemist handle the docstrings with code. In the code you will see is extremely important the indentation to reproduce. You can reproduce this problem with the following code inside of any module.
@doc ~S"""
iex> z
iex> x
"""
def foo, do: true
Note the 6 spaces of indentation in the iex>
, for reproducing this effect.
But you can get your docstrings again removing the newline between the iex>
. Or decreasing the 6 spaces of indentation, letting alchemist not interpret the iex>
as code.
@doc ~S"""
iex> z
iex> x
"""
def foo, do: true
This, is why functions like with documentations like this fails in the documentation search. For another example play with the docstring of String.split
But the problem is more general. This also fails:
@doc ~S"""
z
x
"""
def foo, do: true
But one less space of indentation you have your docstring back:
@doc ~S"""
z
x
"""
def foo, do: true
Conclusion: alchemist fails looking for documentation when there is a code separated by a new line.
yeheeee the problems is inside the function alchemist-utils-empty-string-p
: The regex for checking an input of only spaces "^\s+$"
is WRONG if there is just ONE line that is empty it matches:
ELISP> (string-match-p "^\s+$" " \nx\n x")
0 (#o0, #x0, ?\C-@) ; wrong
ELISP> (string-match-p "^\s+$" "121sdfadf")
nil
The result in both cases should nil
. I don't know how to regex multiple lines in emacs. So my solution is to simplily remove that string-match-p
.
Pull request #293