HiPhish
Hello,
I know that I can get the documentation of a symbol in iex by typing h whatever, but is there a way to get this documentation programmatically? For context, I use Neovim and I would like a way of reading the documentation inside an editor buffer instead of a REPL running inside a terminal shell. I have already written info.vim which does similar thing for GNU Info documents. Neovim makes it possible to write remote plugins in Elixir, so if there is some Elixir module to get the documentation as a text string it should be fairly simple to pull off.
Trending in Questions
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app?
Looking for hints regarding:
Addi...
New
Kia ora,
We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
Hi all, I wanted to ask how the community is dealing with post-release steps.
Today we have Ecto migrations, which make sure that the db...
New
Hello,
I have an Elixir backend that implements a custom protocol over TCP. I want to load test the backend and assess the performance o...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #phoenix_html
- #iex
- #graphql
- #ai
- #genstage
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex










First 9 of 9 Posts
emoragaf
Take a look at
himplementation: elixir/lib/iex/lib/iex/introspection.ex at d8d89b431e197dd230ce01bc20f4656d9ef24e5c · elixir-lang/elixir · GitHubIt seems to be using
Code.fetch_docsunderneathHiPhish
Thanks, that looks like what I need. I tried calling it by hand, but I get an error instead:
I looked up the definition of
h, but it uses macros, which I am not yet familiar with.benwilson512
:Kernelis not the same asKernel.Kernelis the same as:'Elixir.Kernel'. TryIEx.Introspection.h(Kernel)HiPhish
Great, that works!
Code.fetch_docs(:'Elixir.Kernel')gives me structured data which I can work with. One more question, how do I specify a function? I have triedCode.fetch_docs(:'Elixir.Kernel.is_atom/1'), but I get{:error, :module_not_found}, same thing without the/1part.EDIT: Never mind, I need to look at the implementation of
Ex.Introspection.h/1, notEx.Introspection.h/1.eksperimental
You can have a look at ExDoc source code, paritcularly to the retriever module.
https://github.com/elixir-lang/ex_doc/blob/master/lib/ex_doc/retriever.ex
Other Elixir modules of interest are:
Have fun!
eksperimental
You can use
Kernel, no need for cumbersome and non-standard:'Elixir.Kernel'. BtwKernelis an alias that resolves to:"Elixir.Kernel".:Kernelis just an atom.axelson
I just wanted to make sure you’re aware that there are existing ElixirLS-powered vim/neovim extension that already support fetching Elixir documentation:
But if you want to create to create this extension for learning purposes, or as an improvement (such as being lighter-weight), then please go ahead
HiPhish
Yes, I am aware of it and I’m using it, it’s a fantastic tool.
That’s the plan, I am working through the guide right now and I want to try my hands at something useful next. Plus, I prefer reading documentation in a separate buffer I can have open to the side rather than a floating window. I could have probably hacked something using the Lua API of the built-in client, but this seems more interesting. Plus it would work even without a language server running.
lukaszsamson
If you are looking for something more lightweight than a full language server than you could try elixir_sense, the lib utilised by elixirLS - elixir_sense/lib/elixir_sense.ex at 28f8467a349c6ed004aac66a2e8d7020cdde2e0d · elixir-lsp/elixir_sense · GitHub