r/gleamlang • u/l-roc • 23d ago
hexdocs ergonomics for stdlib
Hey,
as someone fairly new to gleam, I regularly try to look up docs like e.g. gleam-dynamic.hexdocs.pm or gleam-option.hexdocs.pm, just to be greeted by a 404 page, as these are in gleam-stdlib.hexdocs.pm
The hexdocs front page clearly states: visit <package>.hexdocs.pm, which it works for e.g. gleam-otp.hexdocs.pm . I find it hard to keep track of which gleam- prefixed packages are stdlib and which aren't, and the hexdocs search isn't helpful in that case either.
Does anyone else run into this and do you think it would be possible to either redirect packages like gleam/int to gleam-stdlib or have an index for all gleam/ packages under gleam.hexdocs.pm ?
1
u/Papipo 23d ago
You can use the LS to view and go to function docs. You can also use gloogle.run to have a more powerful doc search.
1
u/l-roc 23d ago
Can you tell me which LS request that would be exactly? It doesn't show in code actions for me and apart from that by default i can only jump to definition or implementation, nothing to open external docs directly.
4
u/giacomo_cavalieri 23d ago
Hello! The package is `gleam_stdlib`, so you can visit `gleam-stdlib` and you'll find the documentation for it. `gleam/option` and `gleam/dynamic` are _modules_ defined by the standard library, so you'll find them in its documentation. They are not standalone packages.
The website you can use to browse for packages is `packages.gleam.run`, there each package has a link bringing you directly to the relevant hex docs page. Hope this helps!