-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add quick search to hexdocs.pm #574
Conversation
Change-Id: Ifd888136b0c7cd9936bf02612bd87fdcce639ba7
Hi! Thanks for this. I think this is a very interesting idea but there a few issues that need to be resolved:
|
Change-Id: I2f858ccab0a13fac426666263d59f4cf215db8a4
mod_name = module_name(t) | ||
|
||
if elixir_module?(mod_name) do | ||
"https://hexdocs.pm/elixir/#{module_name(subject)}.html##{func_name(subject)}/#{params_cnt(t)}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its better to place the base hexdocs url into a module variable
func?(t) -> | ||
mod_name = module_name(t) | ||
|
||
if elixir_module?(mod_name) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can go even further.
With mod_name.__info__(:compile)
we can determine wether the module is from a dependency or not. Therefore, generate hexdocs for modules from dependencies as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, i have fixed it.
s =~ ~r/.*\..*\(.*\)/ | ||
end | ||
|
||
defp elixir_module?(s) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use https://hexdocs.pm/elixir/1.12/Module.html#c:__info__/1 here as well
Change-Id: Ief6e0fd0c13b2e42ddaf1817dfbf20b600971011
@mpanarin thanks for your review. I have made some changes according to your suggestion, now it can jump to both third party dependences and elixir std modules. |
@zhenfeng-zhu please add some tests (for builtin, external, umbrella, erlang modules). Please also fix build on elixir 1.12 |
Now we need some tests and IMO it's good to go |
yeah, I am doing. Thanks for your help. |
Change-Id: Id40baed74aeecf62f086f158185ed03345ef5ee0
@lukaszsamson I have add some tests for hover.But I don’t think it’s perfect yet. Could you give more advice on writing tests? |
@lukaszsamson can this be looked at please? This feature is pretty good and can be built upon |
@mpanarin any update? |
@lukaszsamson @mpanarin @axelson Hope you anyone could review it |
I asked for tests of erlang module and function (e.g. :ets :ets.init should link to erlang docs, but :telemetry should link to hexdocs). |
thanks, i'm trying to do it! |
For this issue, I have a question: I find that both of :ets and : telemetry are erlang modules. Why :ets go to erlang docs , but :telemetry should go to hexdocs? That make me confused, what is the standard of judgment? |
You should ask OTP team why they don’t publish docs to hexdocs 😉 |
Haha, maybe in this pr, I can just not support erlang modlue link to hexdocs. And by the way, in my test file: def fake_dir() do
Path.join(__DIR__, "../../../..") |> Path.expand() |> maybe_convert_path_separators()
end I use the fake_dir is "/Users/lucas/Documents/demos/elixirs/vscode-elixir-ls/elixir-ls", it's a umbrella app. so I guess the work is done |
Change-Id: I77d984c72513b75d84958bdc63db093b7028142f
Hello, With this change, ElixirLS does not work anymore on our projects, because we are working on two projects called like As there is no It looks like adding a simple rescue clause solves the problem:
|
Hi sorry I had to leave my home station quickly. Happy to see that is already solved. Thanks ! |
Change-Id: Ifd888136b0c7cd9936bf02612bd87fdcce639ba7
this pr is a hover enhancement.
before
and after this pr
we can click this hyperlink to hexdocs.pm search page, like this: https://hexdocs.pm/elixir/search.html?q=File.write