project
stringlengths
1
38
source
stringclasses
7 values
doc
stringlengths
0
48M
shards
hex
Shards β€” shards v1.1.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/cabol/shards/blob/v1.1.0/README.md#L1 "View Source") Shards ========================================================================================================= > ### > [ets-tables-on-steroids](#ets-tables-on-steroids) > ETS tables on steroids! > > > Sharding for ETS tables out-of-box. > > ![CI](https://github.com/cabol/shards/workflows/CI/badge.svg) [![Codecov](https://codecov.io/gh/cabol/shards/branch/master/graphs/badge.svg)](https://codecov.io/gh/cabol/shards/branch/master/graphs/badge.svg) [![Hex Version](https://img.shields.io/hexpm/v/shards.svg)](https://hex.pm/packages/shards) [![Docs](https://img.shields.io/badge/docs-hexpm-blue.svg)](https://hexdocs.pm/shards) [![License](https://img.shields.io/hexpm/l/shards.svg)](license.html) Why might we need **Sharding/Partitioning** for the ETS tables? The main reason is to keep the lock contention under control enabling ETS tables to scale out and support higher levels of concurrency without lock issues; specially write-locks, which most of the cases might cause significant performance degradation. Therefore, one of the most common and proven strategies to deal with these problems is [Sharding](https://en.wikipedia.org/wiki/Shard_(database_architecture)) or [Partitioning](https://en.wikipedia.org/wiki/Partition_(database)); the principle is pretty similar to [DHTs](https://en.wikipedia.org/wiki/Distributed_hash_table). This is where [shards](https://hexdocs.pm/shards/shards.html) comes in. [Shards](https://hexdocs.pm/shards/shards.html) is an Erlang/Elixir library fully compatible with the [ETS API](http://erlang.org/doc/man/ets.html), but it implements sharding or partitioning on top of the ETS tables, completely transparent and out-of-box. See the **[getting started](https://hexdocs.pm/shards/getting-started.html)** guide and the **[online documentation](https://hexdocs.pm/shards/)**. [installation](#installation) Installation -------------------------------------------- ### [erlang](#erlang) Erlang In your `rebar.config`: ``` {deps, [ {shards, "1.1.0"} ]}. ``` ### [elixir](#elixir) Elixir In your `mix.exs`: ``` def deps do [{:shards, "~> 1.1"}] end ``` > For more information and examples, see the [getting started](https://hexdocs.pm/shards/getting-started.html) > guide. > > [important-links](#important-links) Important links ----------------------------------------------------- * [Blog Post](http://cabol.github.io/posts/2016/04/14/sharding-support-for-ets.html) - Transparent and out-of-box sharding support for ETS tables in Erlang/Elixir. * Projects using **shards**: + [shards\_dist](https://github.com/cabol/shards_dist) - Distributed version of `shards`. It was moved to a separate repo since `v1.0.0`. + [Nebulex](https://github.com/cabol/nebulex) – Distributed Caching framework for Elixir. + [ExShards](https://github.com/cabol/ex_shards) – Elixir wrapper for `shards`; with extra and nicer functions. + [KVX](https://github.com/cabol/kvx) – Simple Elixir in-memory Key/Value Store using `shards` (default adapter). + [Cacherl](https://github.com/ferigis/cacherl) Distributed Cache using `shards`. [testing](#testing) Testing ----------------------------- ``` $ make test ``` You can find tests results in `_build/test/logs`, and coverage in `_build/test/cover`. > **NOTE:** `shards` comes with a helper `Makefile`, but it is just a simple > wrapper on top of `rebar3`, therefore, you can do everything using `rebar3` > directly as well (e.g.: `rebar3 do ct, cover`). > > [generating-edoc](#generating-edoc) Generating Edoc ----------------------------------------------------- ``` $ make docs ``` > **NOTE:** Once you run the previous command, you will find the generated HTML > documentation within `doc` folder; open `doc/index.html`. > > [contributing](#contributing) Contributing -------------------------------------------- Contributions to **shards** are very welcome and appreciated! Use the [issue tracker](https://github.com/cabol/shards/issues) for bug reports or feature requests. Open a [pull request](https://github.com/cabol/shards/pulls) when you are ready to contribute. When submitting a pull request you should not update the [CHANGELOG.md](changelog.html), and also make sure you test your changes thoroughly, include unit tests alongside new or changed code. Before to submit a PR it is highly recommended to run `make check` before and ensure all checks run successfully. [copyright-and-license](#copyright-and-license) Copyright and License ----------------------------------------------------------------------- Copyright (c) 2016 Carlos Andres BolaΓ±os R.A. **Shards** source code is licensed under the [MIT License](license.html). [← Previous Page Getting Started](getting-started.html) [Next Page β†’ Changelog](changelog.html) shards β€” shards v1.1.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L94 "View Source") shards (shards v1.1.0) =============================================================================================================================== Partitioned/Sharded ETS tables. [features](#module-features) Features --------------------------------------- * `shards` implements the ETS API to keep compatibility and make the usage straightforward; exactly the same if you were using `ets`. * Sharded or partitioned tables under-the-hood. This feature is managed entirely by `shards` and it is 100% transparent for the client. Provides a logical view of a single ETS table, but internally, it is composed by `N` number of `partitions` and each partition has associated an ETS table. * High performance and scalability. `shards` keeps the lock contention under control enabling ETS tables to scale out and support higher levels of concurrency without lock issues; specially write-locks, which most of the cases might cause significant performance degradation. [partitioned-table](#module-partitioned-table) Partitioned Table ------------------------------------------------------------------ When a table is created with `shards:new/2`, a new supervision tree is created to represent the partitioned table. There is a main supervisor `shards_partition_sup` that create an ETS table to store the metadata and also starts the children which are the partitions to create. Each partition is owned by `shards_partition` (it is a `gen_server`) and it creates an ETS table for storing data mapped to that partition. The supervision tree looks like: ``` [shards\_partition]--><ETS-Table> / [shards\_partition\_sup]--<-[shards\_partition]--><ETS-Table> | \ <Metadata-ETS-Table> [shards\_partition]--><ETS-Table> ``` The returned value by `shards:new/2` may be an atom if it is a named table or a reference otherwise, and in the second case the returned reference is the one of the metadata table, which is the main entry point and it is owned by the main supervisor. See `shards:new/2` for more information. [usage](#module-usage) Usage ------------------------------ ``` > Tab = shards:new(tab, []). #Ref<0.1541908042.2337144842.31535> > shards:insert(Tab, [{a, 1}, {b, 2}, {c, 3}]). true > shards:lookup(Tab, a). [{a,1}] > shards:lookup(Tab, b). [{b,2}] > shards:lookup(Tab, c). [{c,3}] > shards:lookup\_element(Tab, c, 2). 3 > shards:lookup(Tab, d). [] > shards:delete(Tab, c). true > shards:lookup(Tab, c). [] ``` As you can see, the usage is exactly the same if you were using `ets`, you can try the rest of the ETS API but with `shards` module. [important](#module-important) Important ------------------------------------------ Despite `shards` aims to keep 100% compatibility with current ETS API, the semantic for some of the functions may be a bit different due to the nature of sharding; it is not the same having all the entries in a single table than distributed across multiple ones. For example, for query-based functions like `select`, `match`, etc., the returned entries are the same but not necessary the same order than `ets`. For `first`, `next`, and `last` they behave the similar in the sense by means of them a partitioned table is traversed, so the final result is the same, but the order in which the entries are traversed may be different. Therefore, it is highly recommended to read the documentation of the functions. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [access/0](#t:access/0) [continuation/0](#t:continuation/0) [ets\_continuation/0](#t:ets_continuation/0) [filename/0](#t:filename/0) [info\_item/0](#t:info_item/0) [info\_tuple/0](#t:info_tuple/0) [option/0](#t:option/0) [shards\_opt/0](#t:shards_opt/0) [tab/0](#t:tab/0) [tabinfo\_item/0](#t:tabinfo_item/0) [tweaks/0](#t:tweaks/0) [type/0](#t:type/0) [Functions](#functions) ------------------------ [all()](#all/0) Equivalent to [ets:all()](https://www.erlang.org/doc/man/ets.html#all-0). [delete(Tab)](#delete/1) Equivalent to `ets:delete/1`.*See also:* [ets:delete/1](https://www.erlang.org/doc/man/ets.html#delete-1). [delete(Tab, Key)](#delete/2) Equivalent to [delete(Tab, Key, shards\_meta:get(Tab))](#delete/3). [delete(Tab, Key, Meta)](#delete/3) Equivalent to `ets:delete/2`.*See also:* [ets:delete/2](https://www.erlang.org/doc/man/ets.html#delete-2). [delete\_all\_objects(Tab)](#delete_all_objects/1) Equivalent to [delete\_all\_objects(Tab, shards\_meta:get(Tab))](#delete_all_objects/2). [delete\_all\_objects(Tab, Meta)](#delete_all_objects/2) Equivalent to `ets:delete_all_objects/1`.*See also:* [ets:delete\_all\_objects/1](https://www.erlang.org/doc/man/ets.html#delete_all_objects-1). [delete\_object(Tab, Object)](#delete_object/2) Equivalent to [delete\_object(Tab, Object, shards\_meta:get(Tab))](#delete_object/3). [delete\_object(Tab, Object, Meta)](#delete_object/3) Equivalent to `ets:delete_object/2`.*See also:* [ets:delete\_object/2](https://www.erlang.org/doc/man/ets.html#delete_object-2). [file2tab(Filename)](#file2tab/1) Equivalent to [file2tab(Filename, [])](#file2tab/2). [file2tab(Filename, Options)](#file2tab/2) Equivalent to `shards:file2tab/2`. Moreover, it restores the supervision tree for the `shards` corresponding to the given file, such as if they had been created using `shards:new/2`.*See also:* [ets:file2tab/2](https://www.erlang.org/doc/man/ets.html#file2tab-2). [first(Tab)](#first/1) Equivalent to [first(Tab, shards\_meta:get(Tab))](#first/2). [first(Tab, Meta)](#first/2) Equivalent to `ets:first/1`. [foldl(Fun, Acc, Tab)](#foldl/3) Equivalent to [foldl(Fun, Acc, Tab, shards\_meta:get(Tab))](#foldl/4). [foldl(Fun, Acc0, Tab, Meta)](#foldl/4) Equivalent to `ets:foldl/3`. [foldr(Fun, Acc, Tab)](#foldr/3) Equivalent to [foldr(Fun, Acc, Tab, shards\_meta:get(Tab))](#foldr/4). [foldr(Fun, Acc0, Tab, Meta)](#foldr/4) Equivalent to `ets:foldr/3`. [get\_meta(Tab, Key)](#get_meta/2) Equivalent to [get\_meta(Tab, Key, undefined)](#get_meta/3). [get\_meta(Tab, Key, Def)](#get_meta/3) Wrapper for `shards_meta:get/3`. [i()](#i/0) Equivalent to [ets:i()](https://www.erlang.org/doc/man/ets.html#i-0). [info(Tab)](#info/1) Similar to ets:info/1' but extra information about the partitioned table is added. [info(Tab, Item)](#info/2) Equivalent to `ets:info/2`. [insert(Tab, ObjOrObjs)](#insert/2) Equivalent to [insert(Tab, ObjOrObjs, shards\_meta:get(Tab))](#insert/3). [insert(Tab, ObjOrObjs, Meta)](#insert/3) Equivalent to `ets:insert/2`. [insert\_new(Tab, ObjOrObjs)](#insert_new/2) Equivalent to [insert\_new(Tab, ObjOrObjs, shards\_meta:get(Tab))](#insert_new/3). [insert\_new(Tab, ObjOrObjs, Meta)](#insert_new/3) Equivalent to `ets:insert_new/2`. [is\_compiled\_ms(Term)](#is_compiled_ms/1) Equivalent to [ets:is\_compiled\_ms(Term)](https://www.erlang.org/doc/man/ets.html#is_compiled_ms-1). [last(Tab)](#last/1) Equivalent to `ets:last/1`. [lookup(Tab, Key)](#lookup/2) Equivalent to [lookup(Tab, Key, shards\_meta:get(Tab))](#lookup/3). [lookup(Tab, Key, Meta)](#lookup/3) Equivalent to `ets:lookup/2`.*See also:* [ets:lookup/2](https://www.erlang.org/doc/man/ets.html#lookup-2). [lookup\_element(Tab, Key, Pos)](#lookup_element/3) Equivalent to [lookup\_element(Tab, Key, Pos, shards\_meta:get(Tab))](#lookup_element/4). [lookup\_element(Tab, Key, Pos, Meta)](#lookup_element/4) Equivalent to `ets:lookup_element/3`.*See also:* [ets:lookup\_element/3](https://www.erlang.org/doc/man/ets.html#lookup_element-3). [match(Continuation)](#match/1) Equivalent to `ets:match/1`. [match(Tab, Pattern)](#match/2) Equivalent to [match(Tab, Pattern, shards\_meta:get(Tab))](#match/3). [match(Tab, Pattern, LimitOrMeta)](#match/3) If 3rd argument is `pos_integer()` this function behaves like `ets:match/3`, otherwise, the 3rd argument is assumed as `shards_meta:t()` and it behaves like `ets:match/2`. [match(Tab, Pattern, Limit, Meta)](#match/4) Equivalent to `ets:match/3`. [match\_delete(Tab, Pattern)](#match_delete/2) Equivalent to [match\_delete(Tab, Pattern, shards\_meta:get(Tab))](#match_delete/3). [match\_delete(Tab, Pattern, Meta)](#match_delete/3) Equivalent to `ets:match_delete/2`.*See also:* [ets:match\_delete/2](https://www.erlang.org/doc/man/ets.html#match_delete-2). [match\_object(Cont)](#match_object/1) Equivalent to `ets:match_object/1`. [match\_object(Tab, Pattern)](#match_object/2) Equivalent to [match\_object(Tab, Pattern, shards\_meta:get(Tab))](#match_object/3). [match\_object(Tab, Pattern, LimitOrMeta)](#match_object/3) If 3rd argument is `pos_integer()` this function behaves like `ets:match_object/3`, otherwise, the 3rd argument is assumed as `shards_meta:t()` and it behaves like `ets:match_object/2`. [match\_object(Tab, Pattern, Limit, Meta)](#match_object/4) Equivalent to `ets:match_object/3`. [match\_spec\_compile(MatchSpec)](#match_spec_compile/1) Equivalent to [ets:match\_spec\_compile(MatchSpec)](https://www.erlang.org/doc/man/ets.html#match_spec_compile-1). [match\_spec\_run(List, CompiledMatchSpec)](#match_spec_run/2) Equivalent to [ets:match\_spec\_run(List, CompiledMatchSpec)](https://www.erlang.org/doc/man/ets.html#match_spec_run-2). [member(Tab, Key)](#member/2) Equivalent to [member(Tab, Key, shards\_meta:get(Tab))](#member/3). [member(Tab, Key, Meta)](#member/3) Equivalent to `ets:member/2`.*See also:* [ets:member/2](https://www.erlang.org/doc/man/ets.html#member-2). [new(Name, Options)](#new/2) This operation is equivalent to `ets:new/2`, but when is called, instead of create a single ETS table, it creates a new supervision tree for the partitioned table. [next(Tab, Key1)](#next/2) Equivalent to [next(Tab, Key1, shards\_meta:get(Tab))](#next/3). [next(Tab, Key1, Meta)](#next/3) Equivalent to `ets:next/2`. [partition\_owners(TabOrPid)](#partition_owners/1) Returns the partition PIDs associated with the given table `TabOrPid`. [prev(Tab, Key1)](#prev/2) Equivalent to `ets:next/2`. [put\_meta(Tab, Key, Val)](#put_meta/3) Wrapper for `shards_meta:put/3`. [rename(Tab, Name)](#rename/2) Equivalent to [rename(Tab, Name, shards\_meta:get(Tab))](#rename/3). [rename(Tab, Name, Meta)](#rename/3) Equivalent to `ets:rename/2`. [safe\_fixtable(Tab, Fix)](#safe_fixtable/2) Equivalent to [safe\_fixtable(Tab, Fix, shards\_meta:get(Tab))](#safe_fixtable/3). [select(Cont)](#select/1) Equivalent to `ets:select/1`. [select(Tab, MatchSpec)](#select/2) Equivalent to [select(Tab, MatchSpec, shards\_meta:get(Tab))](#select/3). [select(Tab, MatchSpec, LimitOrMeta)](#select/3) If 3rd argument is `pos_integer()` this function behaves like `ets:select/3`, otherwise, the 3rd argument is assumed as `shards_meta:t()` and it behaves like `ets:select/2`. [select(Tab, MatchSpec, Limit, Meta)](#select/4) Equivalent to `ets:select/3`. [select\_count(Tab, MatchSpec)](#select_count/2) Equivalent to [select\_count(Tab, MatchSpec, shards\_meta:get(Tab))](#select_count/3). [select\_count(Tab, MatchSpec, Meta)](#select_count/3) Equivalent to `ets:select_count/2`.*See also:* [ets:select\_count/2](https://www.erlang.org/doc/man/ets.html#select_count-2). [select\_delete(Tab, MatchSpec)](#select_delete/2) Equivalent to [select\_delete(Tab, MatchSpec, shards\_meta:get(Tab))](#select_delete/3). [select\_delete(Tab, MatchSpec, Meta)](#select_delete/3) Equivalent to `ets:select_delete/2`.*See also:* [ets:select\_delete/2](https://www.erlang.org/doc/man/ets.html#select_delete-2). [select\_replace(Tab, MatchSpec)](#select_replace/2) Equivalent to [select\_replace(Tab, MatchSpec, shards\_meta:get(Tab))](#select_replace/3). [select\_replace(Tab, MatchSpec, Meta)](#select_replace/3) Equivalent to `ets:select_replace/2`.*See also:* [ets:select\_replace/2](https://www.erlang.org/doc/man/ets.html#select_replace-2). [select\_reverse(Cont)](#select_reverse/1) Equivalent to `ets:select_reverse/1`. [select\_reverse(Tab, MatchSpec)](#select_reverse/2) Equivalent to [select\_reverse(Tab, MatchSpec, shards\_meta:get(Tab))](#select_reverse/3). [select\_reverse(Tab, MatchSpec, LimitOrMeta)](#select_reverse/3) If 3rd argument is `pos_integer()` this function behaves like `ets:select_reverse/3`, otherwise, the 3rd argument is assumed as `shards_meta:t()` and it behaves like `ets:select_reverse/2`. [select\_reverse(Tab, MatchSpec, Limit, Meta)](#select_reverse/4) Equivalent to `ets:select_reverse/3`. [setopts(Tab, Opts)](#setopts/2) Equivalent to [setopts(Tab, Opts, shards\_meta:get(Tab))](#setopts/3). [setopts(Tab, Opts, Meta)](#setopts/3) Equivalent to `ets:setopts/2`. [tab2file(Tab, Filename)](#tab2file/2) Equivalent to [tab2file(Tab, Filename, [])](#tab2file/3). [tab2file(Tab, Filename, Options)](#tab2file/3) Equivalent to `ets:tab2file/3`. [tab2list(Tab)](#tab2list/1) Equivalent to [tab2list(Tab, shards\_meta:get(Tab))](#tab2list/2). [tab2list(Tab, Meta)](#tab2list/2) Equivalent to `ets:tab2list/1`.*See also:* [ets:tab2list/1](https://www.erlang.org/doc/man/ets.html#tab2list-1). [tabfile\_info(Filename)](#tabfile_info/1) Equivalent to `ets:tabfile_info/1`. [table(Tab)](#table/1) Equivalent to [table(Tab, [])](#table/2). [table(Tab, Options)](#table/2) Equivalent to [table(Tab, Options, shards\_meta:get(Tab))](#table/3). [table(Tab, Options, Meta)](#table/3) Similar to `ets:table/2`, but it returns a list of `qlc:query_handle()`; one per partition.*See also:* [ets:table/2](https://www.erlang.org/doc/man/ets.html#table-2). [table\_meta(Tab)](#table_meta/1) Returns the metadata associated with the given table `Tab`. [take(Tab, Key)](#take/2) Equivalent to [take(Tab, Key, shards\_meta:get(Tab))](#take/3). [take(Tab, Key, Meta)](#take/3) Equivalent to `ets:take/2`.*See also:* [ets:take/2](https://www.erlang.org/doc/man/ets.html#take-2). [test\_ms(Tuple, MatchSpec)](#test_ms/2) Equivalent to [ets:test\_ms(Tuple, MatchSpec)](https://www.erlang.org/doc/man/ets.html#test_ms-2). [update\_counter(Tab, Key, UpdateOp)](#update_counter/3) Equivalent to [update\_counter(Tab, Key, UpdateOp, shards\_meta:get(Tab))](#update_counter/4). [update\_counter(Tab, Key, UpdateOp, DefaultOrMeta)](#update_counter/4) Equivalent to `ets:update_counter/4`. [update\_counter(Tab, Key, UpdateOp, Default, Meta)](#update_counter/5) Equivalent to `ets:update_counter/4`.*See also:* [ets:update\_counter/4](https://www.erlang.org/doc/man/ets.html#update_counter-4). [update\_element(Tab, Key, ElementSpec)](#update_element/3) Equivalent to [update\_element(Tab, Key, ElementSpec, shards\_meta:get(Tab))](#update_element/4). [update\_element(Tab, Key, ElementSpec, Meta)](#update_element/4) Equivalent to `ets:update_element/3`.*See also:* [ets:update\_element/3](https://www.erlang.org/doc/man/ets.html#update_element-3). [Link to this section](#types) Types ===================================== [Link to this type](#t:access/0 "Link to this type") access/0 ======== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L166 "View Source") ``` -type access() :: public | protected | private. ``` [Link to this type](#t:continuation/0 "Link to this type") continuation/0 ============== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L241 "View Source") ``` -type continuation() :: {Tab :: [tab](#t:tab/0)(), MatchSpec :: [ets:match\_spec](https://www.erlang.org/doc/man/ets.html#type-match_spec)(), Limit :: pos_integer(), Partition :: non_neg_integer(), Continuation :: [ets\_continuation](#t:ets_continuation/0)()}. ``` [Link to this type](#t:ets_continuation/0 "Link to this type") ets\_continuation/0 =================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L168 "View Source") ``` -type ets_continuation() :: '$end_of_table' | {[tab](#t:tab/0)(), integer(), integer(), [ets:comp\_match\_spec](https://www.erlang.org/doc/man/ets.html#type-comp_match_spec)(), list(), integer()} | {[tab](#t:tab/0)(), _, _, integer(), [ets:comp\_match\_spec](https://www.erlang.org/doc/man/ets.html#type-comp_match_spec)(), list(), integer(), integer()}. ``` [Link to this type](#t:filename/0 "Link to this type") filename/0 ========== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L250 "View Source") ``` -type filename() :: string() | binary() | atom(). ``` [Link to this type](#t:info_item/0 "Link to this type") info\_item/0 ============ [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L214 "View Source") ``` -type info_item() :: compressed | fixed | heir | keypos | memory | name | named_table | node | owner | protection | safe_fixed | size | stats | type | write_concurrency | read_concurrency | shards. ``` [Link to this type](#t:info_tuple/0 "Link to this type") info\_tuple/0 ============= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L197 "View Source") ``` -type info_tuple() :: {compressed, boolean()} | {heir, pid() | none} | {keypos, pos_integer()} | {memory, non_neg_integer()} | {name, atom()} | {named_table, boolean()} | {node, node()} | {owner, pid()} | {protection, [access](#t:access/0)()} | {size, non_neg_integer()} | {type, [type](#t:type/0)()} | {write_concurrency, boolean()} | {read_concurrency, boolean()} | {shards, [atom()]}. ``` [Link to this type](#t:option/0 "Link to this type") option/0 ======== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L186 "View Source") ``` -type option() :: [type](#t:type/0)() | [access](#t:access/0)() | named_table | {keypos, pos_integer()} | {heir, pid(), HeirData :: term()} | {heir, none} | [tweaks](#t:tweaks/0)() | [shards\_opt](#t:shards_opt/0)(). ``` [Link to this type](#t:shards_opt/0 "Link to this type") shards\_opt/0 ============= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L180 "View Source") ``` -type shards_opt() :: {partitions, pos_integer()} | {keyslot_fun, [shards\_meta:keyslot\_fun](shards_meta.html#t:keyslot_fun/0)()} | {restore, term(), term()}. ``` [Link to this type](#t:tab/0 "Link to this type") tab/0 ===== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L163 "View Source") ``` -type tab() :: atom() | [ets:tid](https://www.erlang.org/doc/man/ets.html#type-tid)(). ``` [Link to this type](#t:tabinfo_item/0 "Link to this type") tabinfo\_item/0 =============== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L222 "View Source") ``` -type tabinfo_item() :: {name, atom()} | {type, [type](#t:type/0)()} | {protection, [access](#t:access/0)()} | {named_table, boolean()} | {keypos, non_neg_integer()} | {size, non_neg_integer()} | {extended_info, [md5sum | object_count]} | {version, {Major :: non_neg_integer(), Minor :: non_neg_integer()}} | {shards, [atom()]}. ``` [Link to this type](#t:tweaks/0 "Link to this type") tweaks/0 ======== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L174 "View Source") ``` -type tweaks() :: {write_concurrency, boolean()} | {read_concurrency, boolean()} | compressed. ``` [Link to this type](#t:type/0 "Link to this type") type/0 ====== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L167 "View Source") ``` -type type() :: set | ordered_set | bag | duplicate_bag. ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#all/0 "Link to this function") all() ===== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L309 "View Source") Equivalent to [ets:all()](https://www.erlang.org/doc/man/ets.html#all-0). [Link to this function](#delete/1 "Link to this function") delete(Tab) =========== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L318 "View Source") ``` -spec delete(Tab :: [tab](#t:tab/0)()) -> true. ``` Equivalent to `ets:delete/1`.*See also:* [ets:delete/1](https://www.erlang.org/doc/man/ets.html#delete-1). [Link to this function](#delete/2 "Link to this function") delete(Tab, Key) ================ [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L325 "View Source") Equivalent to [delete(Tab, Key, shards\_meta:get(Tab))](#delete/3). [Link to this function](#delete/3 "Link to this function") delete(Tab, Key, Meta) ====================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L337 "View Source") ``` -spec delete(Tab, Key, Meta) -> true when Tab :: [tab](#t:tab/0)(), Key :: term(), Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(). ``` Equivalent to `ets:delete/2`.*See also:* [ets:delete/2](https://www.erlang.org/doc/man/ets.html#delete-2). [Link to this function](#delete_all_objects/1 "Link to this function") delete\_all\_objects(Tab) ========================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L342 "View Source") Equivalent to [delete\_all\_objects(Tab, shards\_meta:get(Tab))](#delete_all_objects/2). [Link to this function](#delete_all_objects/2 "Link to this function") delete\_all\_objects(Tab, Meta) =============================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L353 "View Source") ``` -spec delete_all_objects(Tab, Meta) -> true when Tab :: [tab](#t:tab/0)(), Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(). ``` Equivalent to `ets:delete_all_objects/1`.*See also:* [ets:delete\_all\_objects/1](https://www.erlang.org/doc/man/ets.html#delete_all_objects-1). [Link to this function](#delete_object/2 "Link to this function") delete\_object(Tab, Object) =========================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L358 "View Source") Equivalent to [delete\_object(Tab, Object, shards\_meta:get(Tab))](#delete_object/3). [Link to this function](#delete_object/3 "Link to this function") delete\_object(Tab, Object, Meta) ================================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L370 "View Source") ``` -spec delete_object(Tab, Object, Meta) -> true when Tab :: [tab](#t:tab/0)(), Object :: tuple(), Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(). ``` Equivalent to `ets:delete_object/2`.*See also:* [ets:delete\_object/2](https://www.erlang.org/doc/man/ets.html#delete_object-2). [Link to this function](#file2tab/1 "Link to this function") file2tab(Filename) ================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L376 "View Source") Equivalent to [file2tab(Filename, [])](#file2tab/2). [Link to this function](#file2tab/2 "Link to this function") file2tab(Filename, Options) =========================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L392 "View Source") ``` -spec file2tab(Filename, Options) -> {ok, Tab} | {error, Reason} when Filename :: [filename](#t:filename/0)(), Tab :: [tab](#t:tab/0)(), Options :: [Option], Option :: {verify, boolean()}, Reason :: term(). ``` Equivalent to `shards:file2tab/2`. Moreover, it restores the supervision tree for the `shards` corresponding to the given file, such as if they had been created using `shards:new/2`.*See also:* [ets:file2tab/2](https://www.erlang.org/doc/man/ets.html#file2tab-2). [Link to this function](#first/1 "Link to this function") first(Tab) ========== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L421 "View Source") Equivalent to [first(Tab, shards\_meta:get(Tab))](#first/2). [Link to this function](#first/2 "Link to this function") first(Tab, Meta) ================ [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L436 "View Source") ``` -spec first(Tab, Meta) -> Key | '$end_of_table' when Tab :: [tab](#t:tab/0)(), Key :: term(), Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(). ``` Equivalent to `ets:first/1`. However, the order in which results are returned might be not the same as the original ETS function, since it is a sharded table.*See also:* [ets:first/1](https://www.erlang.org/doc/man/ets.html#first-1). [Link to this function](#foldl/3 "Link to this function") foldl(Fun, Acc, Tab) ==================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L451 "View Source") Equivalent to [foldl(Fun, Acc, Tab, shards\_meta:get(Tab))](#foldl/4). [Link to this function](#foldl/4 "Link to this function") foldl(Fun, Acc0, Tab, Meta) =========================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L470 "View Source") ``` -spec foldl(Fun, Acc0, Tab, Meta) -> Acc1 when Fun :: fun((Element :: term(), AccIn) -> AccOut), Tab :: [tab](#t:tab/0)(), Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(), Acc0 :: term(), Acc1 :: term(), AccIn :: term(), AccOut :: term(). ``` Equivalent to `ets:foldl/3`. However, the order in which the entries are traversed may be different since they are distributed across multiple partitions.*See also:* [ets:foldl/3](https://www.erlang.org/doc/man/ets.html#foldl-3). [Link to this function](#foldr/3 "Link to this function") foldr(Fun, Acc, Tab) ==================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L474 "View Source") Equivalent to [foldr(Fun, Acc, Tab, shards\_meta:get(Tab))](#foldr/4). [Link to this function](#foldr/4 "Link to this function") foldr(Fun, Acc0, Tab, Meta) =========================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L493 "View Source") ``` -spec foldr(Fun, Acc0, Tab, Meta) -> Acc1 when Fun :: fun((Element :: term(), AccIn) -> AccOut), Tab :: [tab](#t:tab/0)(), Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(), Acc0 :: term(), Acc1 :: term(), AccIn :: term(), AccOut :: term(). ``` Equivalent to `ets:foldr/3`. However, the order in which the entries are traversed may be different since they are distributed across multiple partitions.*See also:* [ets:foldr/3](https://www.erlang.org/doc/man/ets.html#foldr-3). [Link to this function](#get_meta/2 "Link to this function") get\_meta(Tab, Key) =================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L275 "View Source") Equivalent to [get\_meta(Tab, Key, undefined)](#get_meta/3). [Link to this function](#get_meta/3 "Link to this function") get\_meta(Tab, Key, Def) ======================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L284 "View Source") ``` -spec get_meta(Tab, Key, Def) -> Val when Tab :: [tab](#t:tab/0)(), Key :: term(), Def :: term(), Val :: term(). ``` Wrapper for `shards_meta:get/3`. [Link to this function](#i/0 "Link to this function") i() === [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L504 "View Source") Equivalent to [ets:i()](https://www.erlang.org/doc/man/ets.html#i-0). [Link to this function](#info/1 "Link to this function") info(Tab) ========= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L531 "View Source") ``` -spec info(Tab) -> InfoList | undefined when Tab :: [tab](#t:tab/0)(), InfoList :: [InfoTuple], InfoTuple :: [info\_tuple](#t:info_tuple/0)(). ``` Similar to ets:info/1' but extra information about the partitioned table is added. [extra-info](#info/1-extra-info) Extra Info: ---------------------------------------------- * `{partitions, post_integer()}` - Number of partitions. * `{keyslot_fun, shards_meta:keyslot_fun()}` - Functions used for compute the keyslot. * `{parallel, boolean()}` - Whether the parallel mode is enabled or not. *See also:* [ets:info/1](https://www.erlang.org/doc/man/ets.html#info-1). [Link to this function](#info/2 "Link to this function") info(Tab, Item) =============== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L547 "View Source") ``` -spec info(Tab, Item) -> Value | undefined when Tab :: [tab](#t:tab/0)(), Item :: [info\_item](#t:info_item/0)(), Value :: term(). ``` Equivalent to `ets:info/2`. See the added items by `shards:info/1`.*See also:* [ets:info/2](https://www.erlang.org/doc/man/ets.html#info-2). [Link to this function](#insert/2 "Link to this function") insert(Tab, ObjOrObjs) ====================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L564 "View Source") Equivalent to [insert(Tab, ObjOrObjs, shards\_meta:get(Tab))](#insert/3). [Link to this function](#insert/3 "Link to this function") insert(Tab, ObjOrObjs, Meta) ============================ [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L583 "View Source") ``` -spec insert(Tab, ObjOrObjs, Meta) -> true | no_return() when Tab :: [tab](#t:tab/0)(), ObjOrObjs :: tuple() | [tuple()], Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(). ``` Equivalent to `ets:insert/2`. Despite this functions behaves exactly the same as `ets:insert/2` and produces the same result, there is a big difference due to the nature of the sharding distribution model, **IT IS NOT ATOMIC**. Therefore, if it fails by inserting an object at some partition, previous inserts execution on other partitions are not rolled back, but an error is raised instead.*See also:* [ets:insert/2](https://www.erlang.org/doc/man/ets.html#insert-2). [Link to this function](#insert_new/2 "Link to this function") insert\_new(Tab, ObjOrObjs) =========================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L591 "View Source") Equivalent to [insert\_new(Tab, ObjOrObjs, shards\_meta:get(Tab))](#insert_new/3). [Link to this function](#insert_new/3 "Link to this function") insert\_new(Tab, ObjOrObjs, Meta) ================================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L624 "View Source") ``` -spec insert_new(Tab, ObjOrObjs, Meta) -> boolean() when Tab :: [tab](#t:tab/0)(), ObjOrObjs :: tuple() | [tuple()], Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(). ``` Equivalent to `ets:insert_new/2`. Despite this functions behaves exactly the same as `ets:insert_new/2` and produces the same result, there is a big difference due to the nature of the sharding distribution model, **IT IS NOT ATOMIC**. Opposite to `shards:insert/2`, this function tries to roll-back previous inserts execution on other partitions if it fails by inserting an object at some partition, but there might be race conditions during roll-back execution. **Example:** ``` > shards:insert\_new(mytab, {k1, 1}). true > shards:insert\_new(mytab, {k1, 1}). false > shards:insert\_new(mytab, [{k1, 1}, {k2, 2}]). false ``` *See also:* [ets:insert\_new/2](https://www.erlang.org/doc/man/ets.html#insert_new-2). [Link to this function](#is_compiled_ms/1 "Link to this function") is\_compiled\_ms(Term) ====================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L652 "View Source") Equivalent to [ets:is\_compiled\_ms(Term)](https://www.erlang.org/doc/man/ets.html#is_compiled_ms-1). [Link to this function](#last/1 "Link to this function") last(Tab) ========= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L666 "View Source") ``` -spec last(Tab) -> Key | '$end_of_table' when Tab :: [tab](#t:tab/0)(), Key :: term(). ``` Equivalent to `ets:last/1`. However, the order in which results are returned might be not the same as the original ETS function, since it is a sharded table.*See also:* [ets:last/1](https://www.erlang.org/doc/man/ets.html#last-1). [Link to this function](#lookup/2 "Link to this function") lookup(Tab, Key) ================ [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L675 "View Source") Equivalent to [lookup(Tab, Key, shards\_meta:get(Tab))](#lookup/3). [Link to this function](#lookup/3 "Link to this function") lookup(Tab, Key, Meta) ====================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L688 "View Source") ``` -spec lookup(Tab, Key, Meta) -> [Object] when Tab :: [tab](#t:tab/0)(), Key :: term(), Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(), Object :: tuple(). ``` Equivalent to `ets:lookup/2`.*See also:* [ets:lookup/2](https://www.erlang.org/doc/man/ets.html#lookup-2). [Link to this function](#lookup_element/3 "Link to this function") lookup\_element(Tab, Key, Pos) ============================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L693 "View Source") Equivalent to [lookup\_element(Tab, Key, Pos, shards\_meta:get(Tab))](#lookup_element/4). [Link to this function](#lookup_element/4 "Link to this function") lookup\_element(Tab, Key, Pos, Meta) ==================================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L707 "View Source") ``` -spec lookup_element(Tab, Key, Pos, Meta) -> Elem when Tab :: [tab](#t:tab/0)(), Key :: term(), Pos :: pos_integer(), Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(), Elem :: term() | [term()]. ``` Equivalent to `ets:lookup_element/3`.*See also:* [ets:lookup\_element/3](https://www.erlang.org/doc/man/ets.html#lookup_element-3). [Link to this function](#match/1 "Link to this function") match(Continuation) =================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L770 "View Source") ``` -spec match(Continuation) -> {[Match], [continuation](#t:continuation/0)()} | '$end_of_table' when Match :: [term()], Continuation :: [continuation](#t:continuation/0)(). ``` Equivalent to `ets:match/1`. The order in which results are returned might be not the same as the original ETS function.*See also:* [ets:match/1](https://www.erlang.org/doc/man/ets.html#match-1). [Link to this function](#match/2 "Link to this function") match(Tab, Pattern) =================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L712 "View Source") Equivalent to [match(Tab, Pattern, shards\_meta:get(Tab))](#match/3). [Link to this function](#match/3 "Link to this function") match(Tab, Pattern, LimitOrMeta) ================================ [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L733 "View Source") ``` -spec match(Tab, Pattern, LimitOrMeta) -> {[Match], Cont} | '$end_of_table' | [Match] when Tab :: [tab](#t:tab/0)(), Pattern :: [ets:match\_pattern](https://www.erlang.org/doc/man/ets.html#type-match_pattern)(), LimitOrMeta :: pos_integer() | [shards\_meta:t](shards_meta.html#t:t/0)(), Match :: [term()], Cont :: [continuation](#t:continuation/0)(). ``` If 3rd argument is `pos_integer()` this function behaves like `ets:match/3`, otherwise, the 3rd argument is assumed as `shards_meta:t()` and it behaves like `ets:match/2`. The order in which results are returned might be not the same as the original ETS function.*See also:* [ets:match/2](https://www.erlang.org/doc/man/ets.html#match-2), [ets:match/3](https://www.erlang.org/doc/man/ets.html#match-3). [Link to this function](#match/4 "Link to this function") match(Tab, Pattern, Limit, Meta) ================================ [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L755 "View Source") ``` -spec match(Tab, Pattern, Limit, Meta) -> {[Match], Cont} | '$end_of_table' when Tab :: [tab](#t:tab/0)(), Pattern :: [ets:match\_pattern](https://www.erlang.org/doc/man/ets.html#type-match_pattern)(), Limit :: pos_integer(), Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(), Match :: [term()], Cont :: [continuation](#t:continuation/0)(). ``` Equivalent to `ets:match/3`. The order in which results are returned might be not the same as the original ETS function.*See also:* [ets:match/3](https://www.erlang.org/doc/man/ets.html#match-3). [Link to this function](#match_delete/2 "Link to this function") match\_delete(Tab, Pattern) =========================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L774 "View Source") Equivalent to [match\_delete(Tab, Pattern, shards\_meta:get(Tab))](#match_delete/3). [Link to this function](#match_delete/3 "Link to this function") match\_delete(Tab, Pattern, Meta) ================================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L786 "View Source") ``` -spec match_delete(Tab, Pattern, Meta) -> true when Tab :: [tab](#t:tab/0)(), Pattern :: [ets:match\_pattern](https://www.erlang.org/doc/man/ets.html#type-match_pattern)(), Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(). ``` Equivalent to `ets:match_delete/2`.*See also:* [ets:match\_delete/2](https://www.erlang.org/doc/man/ets.html#match_delete-2). [Link to this function](#match_object/1 "Link to this function") match\_object(Cont) =================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L849 "View Source") ``` -spec match_object(Cont) -> {[Object], Cont} | '$end_of_table' when Object :: tuple(), Cont :: [continuation](#t:continuation/0)(). ``` Equivalent to `ets:match_object/1`. The order in which results are returned might be not the same as the original ETS function.*See also:* [ets:match\_object/1](https://www.erlang.org/doc/man/ets.html#match_object-1). [Link to this function](#match_object/2 "Link to this function") match\_object(Tab, Pattern) =========================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L792 "View Source") Equivalent to [match\_object(Tab, Pattern, shards\_meta:get(Tab))](#match_object/3). [Link to this function](#match_object/3 "Link to this function") match\_object(Tab, Pattern, LimitOrMeta) ======================================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L812 "View Source") ``` -spec match_object(Tab, Pattern, LimitOrMeta) -> {[Object], Cont} | '$end_of_table' | [Object] when Tab :: [tab](#t:tab/0)(), Pattern :: [ets:match\_pattern](https://www.erlang.org/doc/man/ets.html#type-match_pattern)(), LimitOrMeta :: pos_integer() | [shards\_meta:t](shards_meta.html#t:t/0)(), Object :: tuple(), Cont :: [continuation](#t:continuation/0)(). ``` If 3rd argument is `pos_integer()` this function behaves like `ets:match_object/3`, otherwise, the 3rd argument is assumed as `shards_meta:t()` and it behaves like `ets:match_object/2`. The order in which results are returned might be not the same as the original ETS function.*See also:* [ets:match\_object/3](https://www.erlang.org/doc/man/ets.html#match_object-3). [Link to this function](#match_object/4 "Link to this function") match\_object(Tab, Pattern, Limit, Meta) ======================================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L834 "View Source") ``` -spec match_object(Tab, Pattern, Limit, Meta) -> {[Object], Cont} | '$end_of_table' when Tab :: [tab](#t:tab/0)(), Pattern :: [ets:match\_pattern](https://www.erlang.org/doc/man/ets.html#type-match_pattern)(), Limit :: pos_integer(), Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(), Object :: tuple(), Cont :: [continuation](#t:continuation/0)(). ``` Equivalent to `ets:match_object/3`. The order in which results are returned might be not the same as the original ETS function.*See also:* [ets:match\_object/3](https://www.erlang.org/doc/man/ets.html#match_object-3). [Link to this function](#match_spec_compile/1 "Link to this function") match\_spec\_compile(MatchSpec) =============================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L853 "View Source") Equivalent to [ets:match\_spec\_compile(MatchSpec)](https://www.erlang.org/doc/man/ets.html#match_spec_compile-1). [Link to this function](#match_spec_run/2 "Link to this function") match\_spec\_run(List, CompiledMatchSpec) ========================================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L857 "View Source") Equivalent to [ets:match\_spec\_run(List, CompiledMatchSpec)](https://www.erlang.org/doc/man/ets.html#match_spec_run-2). [Link to this function](#member/2 "Link to this function") member(Tab, Key) ================ [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L861 "View Source") Equivalent to [member(Tab, Key, shards\_meta:get(Tab))](#member/3). [Link to this function](#member/3 "Link to this function") member(Tab, Key, Meta) ====================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L873 "View Source") ``` -spec member(Tab, Key, Meta) -> boolean() when Tab :: [tab](#t:tab/0)(), Key :: term(), Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(). ``` Equivalent to `ets:member/2`.*See also:* [ets:member/2](https://www.erlang.org/doc/man/ets.html#member-2). [Link to this function](#new/2 "Link to this function") new(Name, Options) ================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L944 "View Source") ``` -spec new(Name, Options) -> Tab when Name :: atom(), Options :: [[option](#t:option/0)()], Tab :: [tab](#t:tab/0)(). ``` This operation is equivalent to `ets:new/2`, but when is called, instead of create a single ETS table, it creates a new supervision tree for the partitioned table. The supervision tree is composed by a main supervisor `shards_partition_sup` and `N` number of workers or partitions handled by `shards_partition` (partition owner). Each worker creates an ETS table to handle the partition. Also, the main supervisor `shards_partition_sup` creates an ETS table to keep the metadata for the partitioned table. Returns an atom if the created table is a named table, otherwise, a reference is returned. In the last case, the returned reference is the one of the metadata table, which is the main entry-point and it is owned by the main supervisor `shards_partition_sup`. ### [options](#new/2-options) Options: In addition to the options given by `ets:new/2`, this functions provides the next options:* `{partitions, N}` - Specifies the number of partitions for the sharded table. By default, `N = erlang:system_info(schedulers_online)`. * `{keyslot_fun, F}` - Specifies the function used to compute the partition where the action will be evaluated. Defaults to `erlang:phash2/2`. * `{parallel, P}` - Specifies whether `shards` should work in parallel mode or not, for the applicable functions, e.g.: `select`, `match`, etc. By default is set to `false`. * `{parallel_timeout, T}` - When `parallel` is set to `true`, it specifies the max timeout for a parallel execution. Defaults to `infinity`. ### [access](#new/2-access) Access: Currently, only `public` access is supported by `shards:new/2`. Since a partitioned table is started with its own supervision tree when created, it is very tricky to provide `private` or `protected` access since there are multiple partitions (or ETS tables) and they are owned by the supervisor's children, and the supervisor along with their children (or partitions) are managed by `shards` under-the-hood; it is completely transparent for the client. ### [examples](#new/2-examples) Examples: ``` > Tab = shards:new(tab1, []). #Ref<0.1541908042.2337144842.31535> > shards:new(tab2, [named\_table]). tab2 ``` See also the **"Partitioned Table"** section at the module documentation for more information.*See also:* [ets:new/2](https://www.erlang.org/doc/man/ets.html#new-2). [Link to this function](#next/2 "Link to this function") next(Tab, Key1) =============== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L983 "View Source") Equivalent to [next(Tab, Key1, shards\_meta:get(Tab))](#next/3). [Link to this function](#next/3 "Link to this function") next(Tab, Key1, Meta) ===================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L999 "View Source") ``` -spec next(Tab, Key1, Meta) -> Key2 | '$end_of_table' when Tab :: [tab](#t:tab/0)(), Key1 :: term(), Key2 :: term(), Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(). ``` Equivalent to `ets:next/2`. However, the order in which results are returned might be not the same as the original ETS function, since it is a sharded table.*See also:* [ets:next/2](https://www.erlang.org/doc/man/ets.html#next-2). [Link to this function](#partition_owners/1 "Link to this function") partition\_owners(TabOrPid) =========================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L299 "View Source") ``` -spec partition_owners(TabOrPid) -> [OwnerPid] when TabOrPid :: pid() | [tab](#t:tab/0)(), OwnerPid :: pid(). ``` Returns the partition PIDs associated with the given table `TabOrPid`. [Link to this function](#prev/2 "Link to this function") prev(Tab, Key1) =============== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1027 "View Source") ``` -spec prev(Tab, Key1) -> Key2 | '$end_of_table' when Tab :: [tab](#t:tab/0)(), Key1 :: term(), Key2 :: term(). ``` Equivalent to `ets:next/2`. However, the order in which results are returned might be not the same as the original ETS function, since it is a sharded table.*See also:* [ets:prev/2](https://www.erlang.org/doc/man/ets.html#prev-2). [Link to this function](#put_meta/3 "Link to this function") put\_meta(Tab, Key, Val) ======================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L292 "View Source") ``` -spec put_meta(Tab, Key, Val) -> ok when Tab :: [shards:tab](shards.html#t:tab/0)(), Key :: term(), Val :: term(). ``` Wrapper for `shards_meta:put/3`. [Link to this function](#rename/2 "Link to this function") rename(Tab, Name) ================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1036 "View Source") Equivalent to [rename(Tab, Name, shards\_meta:get(Tab))](#rename/3). [Link to this function](#rename/3 "Link to this function") rename(Tab, Name, Meta) ======================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1052 "View Source") ``` -spec rename(Tab, Name, Meta) -> Name when Tab :: [tab](#t:tab/0)(), Name :: atom(), Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(). ``` Equivalent to `ets:rename/2`. Renames the table name and all its associated shard tables. If something unexpected occurs during the process, an exception will be raised.*See also:* [ets:rename/2](https://www.erlang.org/doc/man/ets.html#rename-2). [Link to this function](#safe_fixtable/2 "Link to this function") safe\_fixtable(Tab, Fix) ======================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1059 "View Source") Equivalent to [safe\_fixtable(Tab, Fix, shards\_meta:get(Tab))](#safe_fixtable/3). [Link to this function](#select/1 "Link to this function") select(Cont) ============ [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1137 "View Source") ``` -spec select(Cont) -> {[Match], Cont} | '$end_of_table' when Match :: term(), Cont :: [continuation](#t:continuation/0)(). ``` Equivalent to `ets:select/1`. The order in which results are returned might be not the same as the original ETS function.*See also:* [ets:select/1](https://www.erlang.org/doc/man/ets.html#select-1). [Link to this function](#select/2 "Link to this function") select(Tab, MatchSpec) ====================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1080 "View Source") Equivalent to [select(Tab, MatchSpec, shards\_meta:get(Tab))](#select/3). [Link to this function](#select/3 "Link to this function") select(Tab, MatchSpec, LimitOrMeta) =================================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1100 "View Source") ``` -spec select(Tab, MatchSpec, LimitOrMeta) -> {[Match], Cont} | '$end_of_table' | [Match] when Tab :: [tab](#t:tab/0)(), MatchSpec :: [ets:match\_spec](https://www.erlang.org/doc/man/ets.html#type-match_spec)(), LimitOrMeta :: pos_integer() | [shards\_meta:t](shards_meta.html#t:t/0)(), Match :: term(), Cont :: [continuation](#t:continuation/0)(). ``` If 3rd argument is `pos_integer()` this function behaves like `ets:select/3`, otherwise, the 3rd argument is assumed as `shards_meta:t()` and it behaves like `ets:select/2`. The order in which results are returned might be not the same as the original ETS function.*See also:* [ets:select/3](https://www.erlang.org/doc/man/ets.html#select-3). [Link to this function](#select/4 "Link to this function") select(Tab, MatchSpec, Limit, Meta) =================================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1122 "View Source") ``` -spec select(Tab, MatchSpec, Limit, Meta) -> {[Match], Cont} | '$end_of_table' when Tab :: [tab](#t:tab/0)(), MatchSpec :: [ets:match\_spec](https://www.erlang.org/doc/man/ets.html#type-match_spec)(), Limit :: pos_integer(), Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(), Match :: term(), Cont :: [continuation](#t:continuation/0)(). ``` Equivalent to `ets:select/3`. The order in which results are returned might be not the same as the original ETS function.*See also:* [ets:select/3](https://www.erlang.org/doc/man/ets.html#select-3). [Link to this function](#select_count/2 "Link to this function") select\_count(Tab, MatchSpec) ============================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1141 "View Source") Equivalent to [select\_count(Tab, MatchSpec, shards\_meta:get(Tab))](#select_count/3). [Link to this function](#select_count/3 "Link to this function") select\_count(Tab, MatchSpec, Meta) =================================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1154 "View Source") ``` -spec select_count(Tab, MatchSpec, Meta) -> NumMatched when Tab :: [tab](#t:tab/0)(), MatchSpec :: [ets:match\_spec](https://www.erlang.org/doc/man/ets.html#type-match_spec)(), Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(), NumMatched :: non_neg_integer(). ``` Equivalent to `ets:select_count/2`.*See also:* [ets:select\_count/2](https://www.erlang.org/doc/man/ets.html#select_count-2). [Link to this function](#select_delete/2 "Link to this function") select\_delete(Tab, MatchSpec) ============================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1160 "View Source") Equivalent to [select\_delete(Tab, MatchSpec, shards\_meta:get(Tab))](#select_delete/3). [Link to this function](#select_delete/3 "Link to this function") select\_delete(Tab, MatchSpec, Meta) ==================================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1173 "View Source") ``` -spec select_delete(Tab, MatchSpec, Meta) -> NumDeleted when Tab :: [tab](#t:tab/0)(), MatchSpec :: [ets:match\_spec](https://www.erlang.org/doc/man/ets.html#type-match_spec)(), Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(), NumDeleted :: non_neg_integer(). ``` Equivalent to `ets:select_delete/2`.*See also:* [ets:select\_delete/2](https://www.erlang.org/doc/man/ets.html#select_delete-2). [Link to this function](#select_replace/2 "Link to this function") select\_replace(Tab, MatchSpec) =============================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1179 "View Source") Equivalent to [select\_replace(Tab, MatchSpec, shards\_meta:get(Tab))](#select_replace/3). [Link to this function](#select_replace/3 "Link to this function") select\_replace(Tab, MatchSpec, Meta) ===================================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1192 "View Source") ``` -spec select_replace(Tab, MatchSpec, Meta) -> NumReplaced when Tab :: [tab](#t:tab/0)(), MatchSpec :: [ets:match\_spec](https://www.erlang.org/doc/man/ets.html#type-match_spec)(), Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(), NumReplaced :: non_neg_integer(). ``` Equivalent to `ets:select_replace/2`.*See also:* [ets:select\_replace/2](https://www.erlang.org/doc/man/ets.html#select_replace-2). [Link to this function](#select_reverse/1 "Link to this function") select\_reverse(Cont) ===================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1255 "View Source") ``` -spec select_reverse(Cont) -> {[Match], Cont} | '$end_of_table' when Cont :: [continuation](#t:continuation/0)(), Match :: term(). ``` Equivalent to `ets:select_reverse/1`. The order in which results are returned might be not the same as the original ETS function.*See also:* [ets:select\_reverse/1](https://www.erlang.org/doc/man/ets.html#select_reverse-1). [Link to this function](#select_reverse/2 "Link to this function") select\_reverse(Tab, MatchSpec) =============================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1198 "View Source") Equivalent to [select\_reverse(Tab, MatchSpec, shards\_meta:get(Tab))](#select_reverse/3). [Link to this function](#select_reverse/3 "Link to this function") select\_reverse(Tab, MatchSpec, LimitOrMeta) ============================================ [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1218 "View Source") ``` -spec select_reverse(Tab, MatchSpec, LimitOrMeta) -> {[Match], Cont} | '$end_of_table' | [Match] when Tab :: [tab](#t:tab/0)(), MatchSpec :: [ets:match\_spec](https://www.erlang.org/doc/man/ets.html#type-match_spec)(), LimitOrMeta :: pos_integer() | [shards\_meta:t](shards_meta.html#t:t/0)(), Match :: term(), Cont :: [continuation](#t:continuation/0)(). ``` If 3rd argument is `pos_integer()` this function behaves like `ets:select_reverse/3`, otherwise, the 3rd argument is assumed as `shards_meta:t()` and it behaves like `ets:select_reverse/2`. The order in which results are returned might be not the same as the original ETS function.*See also:* [ets:select\_reverse/3](https://www.erlang.org/doc/man/ets.html#select_reverse-3). [Link to this function](#select_reverse/4 "Link to this function") select\_reverse(Tab, MatchSpec, Limit, Meta) ============================================ [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1240 "View Source") ``` -spec select_reverse(Tab, MatchSpec, Limit, Meta) -> {[Match], Cont} | '$end_of_table' when Tab :: [tab](#t:tab/0)(), MatchSpec :: [ets:match\_spec](https://www.erlang.org/doc/man/ets.html#type-match_spec)(), Limit :: pos_integer(), Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(), Match :: term(), Cont :: [continuation](#t:continuation/0)(). ``` Equivalent to `ets:select_reverse/3`. The order in which results are returned might be not the same as the original ETS function.*See also:* [ets:select\_reverse/3](https://www.erlang.org/doc/man/ets.html#select_reverse-3). [Link to this function](#setopts/2 "Link to this function") setopts(Tab, Opts) ================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1259 "View Source") Equivalent to [setopts(Tab, Opts, shards\_meta:get(Tab))](#setopts/3). [Link to this function](#setopts/3 "Link to this function") setopts(Tab, Opts, Meta) ======================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1276 "View Source") ``` -spec setopts(Tab, Opts, Meta) -> true when Tab :: [tab](#t:tab/0)(), Opts :: Opt | [Opt], Opt :: {heir, pid(), HeirData} | {heir, none}, Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(), HeirData :: term(). ``` Equivalent to `ets:setopts/2`. Returns `true` if the function was applied successfully on each partition, otherwise, `false` is returned.*See also:* [ets:setopts/2](https://www.erlang.org/doc/man/ets.html#setopts-2). [Link to this function](#tab2file/2 "Link to this function") tab2file(Tab, Filename) ======================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1282 "View Source") Equivalent to [tab2file(Tab, Filename, [])](#tab2file/3). [Link to this function](#tab2file/3 "Link to this function") tab2file(Tab, Filename, Options) ================================ [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1301 "View Source") ``` -spec tab2file(Tab, Filename, Options) -> ok | {error, Reason} when Tab :: [tab](#t:tab/0)(), Filename :: [filename](#t:filename/0)(), Options :: [Option], Option :: {extended_info, [md5sum | object_count]} | {sync, boolean()}, Reason :: term(). ``` Equivalent to `ets:tab2file/3`. This function generates one file per partition using `ets:tab2file/3`, and also generates a master file with the given `Filename` that holds the information of the created partition files so that they can be recovered by calling `ets:file2tab/1,2`.*See also:* [ets:tab2file/3](https://www.erlang.org/doc/man/ets.html#tab2file-3). [Link to this function](#tab2list/1 "Link to this function") tab2list(Tab) ============= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1341 "View Source") Equivalent to [tab2list(Tab, shards\_meta:get(Tab))](#tab2list/2). [Link to this function](#tab2list/2 "Link to this function") tab2list(Tab, Meta) =================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1353 "View Source") ``` -spec tab2list(Tab, Meta) -> [Object] when Tab :: [tab](#t:tab/0)(), Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(), Object :: tuple(). ``` Equivalent to `ets:tab2list/1`.*See also:* [ets:tab2list/1](https://www.erlang.org/doc/man/ets.html#tab2list-1). [Link to this function](#tabfile_info/1 "Link to this function") tabfile\_info(Filename) ======================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1367 "View Source") ``` -spec tabfile_info(Filename) -> {ok, TableInfo} | {error, Reason} when Filename :: [filename](#t:filename/0)(), TableInfo :: [[tabinfo\_item](#t:tabinfo_item/0)()], Reason :: term(). ``` Equivalent to `ets:tabfile_info/1`. Adds extra information about the partitions.*See also:* [ets:tabfile\_info/1](https://www.erlang.org/doc/man/ets.html#tabfile_info-1). [Link to this function](#table/1 "Link to this function") table(Tab) ========== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1402 "View Source") Equivalent to [table(Tab, [])](#table/2). [Link to this function](#table/2 "Link to this function") table(Tab, Options) =================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1406 "View Source") Equivalent to [table(Tab, Options, shards\_meta:get(Tab))](#table/3). [Link to this function](#table/3 "Link to this function") table(Tab, Options, Meta) ========================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1424 "View Source") ``` -spec table(Tab, Options, Meta) -> QueryHandle when Tab :: [tab](#t:tab/0)(), QueryHandle :: [qlc:query\_handle](https://www.erlang.org/doc/man/qlc.html#type-query_handle)(), Options :: [Option] | Option, Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(), Option :: {n_objects, NObjects} | {traverse, TraverseMethod}, NObjects :: default | pos_integer(), MatchSpec :: [ets:match\_spec](https://www.erlang.org/doc/man/ets.html#type-match_spec)(), TraverseMethod :: first_next | last_prev | select | {select, MatchSpec}. ``` Similar to `ets:table/2`, but it returns a list of `qlc:query_handle()`; one per partition.*See also:* [ets:table/2](https://www.erlang.org/doc/man/ets.html#table-2). [Link to this function](#table_meta/1 "Link to this function") table\_meta(Tab) ================ [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L272 "View Source") ``` -spec table_meta(Tab :: [tab](#t:tab/0)()) -> [shards\_meta:t](shards_meta.html#t:t/0)(). ``` Returns the metadata associated with the given table `Tab`. [Link to this function](#take/2 "Link to this function") take(Tab, Key) ============== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1432 "View Source") Equivalent to [take(Tab, Key, shards\_meta:get(Tab))](#take/3). [Link to this function](#take/3 "Link to this function") take(Tab, Key, Meta) ==================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1445 "View Source") ``` -spec take(Tab, Key, Meta) -> [Object] when Tab :: [tab](#t:tab/0)(), Key :: term(), Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(), Object :: tuple(). ``` Equivalent to `ets:take/2`.*See also:* [ets:take/2](https://www.erlang.org/doc/man/ets.html#take-2). [Link to this function](#test_ms/2 "Link to this function") test\_ms(Tuple, MatchSpec) ========================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1428 "View Source") Equivalent to [ets:test\_ms(Tuple, MatchSpec)](https://www.erlang.org/doc/man/ets.html#test_ms-2). [Link to this function](#update_counter/3 "Link to this function") update\_counter(Tab, Key, UpdateOp) =================================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1450 "View Source") Equivalent to [update\_counter(Tab, Key, UpdateOp, shards\_meta:get(Tab))](#update_counter/4). [Link to this function](#update_counter/4 "Link to this function") update\_counter(Tab, Key, UpdateOp, DefaultOrMeta) ================================================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1467 "View Source") ``` -spec update_counter(Tab, Key, UpdateOp, DefaultOrMeta) -> Result | [Result] when Tab :: [tab](#t:tab/0)(), Key :: term(), UpdateOp :: term(), DefaultOrMeta :: tuple() | [shards\_meta:t](shards_meta.html#t:t/0)(), Result :: integer(). ``` Equivalent to `ets:update_counter/4`. If the 4th argument is `shards_meta:t()`, it behaves like `ets:update_counter/3`.*See also:* [ets:update\_counter/4](https://www.erlang.org/doc/man/ets.html#update_counter-4). [Link to this function](#update_counter/5 "Link to this function") update\_counter(Tab, Key, UpdateOp, Default, Meta) ================================================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1489 "View Source") ``` -spec update_counter(Tab, Key, UpdateOp, Default, Meta) -> Result | [Result] when Tab :: [tab](#t:tab/0)(), Key :: term(), UpdateOp :: term(), Default :: tuple(), Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(), Result :: integer(). ``` Equivalent to `ets:update_counter/4`.*See also:* [ets:update\_counter/4](https://www.erlang.org/doc/man/ets.html#update_counter-4). [Link to this function](#update_element/3 "Link to this function") update\_element(Tab, Key, ElementSpec) ====================================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1494 "View Source") Equivalent to [update\_element(Tab, Key, ElementSpec, shards\_meta:get(Tab))](#update_element/4). [Link to this function](#update_element/4 "Link to this function") update\_element(Tab, Key, ElementSpec, Meta) ============================================ [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards.erl#L1507 "View Source") ``` -spec update_element(Tab, Key, ElementSpec, Meta) -> boolean() when Tab :: [tab](#t:tab/0)(), Key :: term(), ElementSpec :: {Pos, Value} | [{Pos, Value}], Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(). ``` Equivalent to `ets:update_element/3`.*See also:* [ets:update\_element/3](https://www.erlang.org/doc/man/ets.html#update_element-3). shards\_enum β€” shards v1.1.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_enum.erl#L6 "View Source") shards\_enum (shards v1.1.0) ========================================================================================================================================= Provides a set of utilities to work with enumerables. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [map(Fun, Enumerable)](#map/2) Returns a list where each element is the result of invoking `Fun` on each corresponding element of `Enumerable`. [pmap(Fun, Enumerable)](#pmap/2) Equivalent to [pmap(Fun, infinity, Enumerable)](#pmap/3). [pmap(Fun, Timeout, Enumerable)](#pmap/3) Similar to `shards_enum:map/2` but it runs in parallel. [reduce(Fun, Acc0, Enumerable)](#reduce/3) Invokes `Fun` for each element in the `Enumerable` with the accumulator. [reduce\_while(Fun, Acc0, Enumerable)](#reduce_while/3) Reduces enumerable until `Fun` returns `{halt, AccOut}`. [Link to this section](#functions) Functions ============================================= [Link to this function](#map/2 "Link to this function") map(Fun, Enumerable) ==================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_enum.erl#L34 "View Source") ``` -spec map(Fun, Enumerable) -> [Result] when Fun :: fun((Elem) -> Result), Elem :: term(), Result :: term(), Enumerable :: [term()] | map() | non_neg_integer(). ``` Returns a list where each element is the result of invoking `Fun` on each corresponding element of `Enumerable`. For maps, the function expects a key-value tuple. [Link to this function](#pmap/2 "Link to this function") pmap(Fun, Enumerable) ===================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_enum.erl#L151 "View Source") Equivalent to [pmap(Fun, infinity, Enumerable)](#pmap/3). [Link to this function](#pmap/3 "Link to this function") pmap(Fun, Timeout, Enumerable) ============================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_enum.erl#L163 "View Source") ``` -spec pmap(Fun, Timeout, Enumerable) -> [Result] when Fun :: fun((Elem) -> Result), Elem :: term(), Timeout :: timeout(), Result :: term(), Enumerable :: [term()] | map() | non_neg_integer(). ``` Similar to `shards_enum:map/2` but it runs in parallel. [Link to this function](#reduce/3 "Link to this function") reduce(Fun, Acc0, Enumerable) ============================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_enum.erl#L70 "View Source") ``` -spec reduce(Fun, Acc0, Enumerable) -> Acc1 when Fun :: fun((Elem, AccIn) -> AccOut), Elem :: term(), AccIn :: term(), AccOut :: term(), Acc0 :: term(), Acc1 :: term(), Enumerable :: [term()] | map() | non_neg_integer(). ``` Invokes `Fun` for each element in the `Enumerable` with the accumulator. The initial value of the accumulator is `Acc0`. The function is invoked for each element in the enumerable with the accumulator. The result returned by the function is used as the accumulator for the next iteration. The function returns the last accumulator. [Link to this function](#reduce_while/3 "Link to this function") reduce\_while(Fun, Acc0, Enumerable) ==================================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_enum.erl#L116 "View Source") ``` -spec reduce_while(Fun, Acc0, Enumerable) -> Acc1 when Fun :: fun((Elem, AccIn) -> FunRes), FunRes :: {cont | halt, AccOut}, Elem :: term(), AccIn :: term(), AccOut :: term(), Acc0 :: term(), Acc1 :: term(), Enumerable :: [term()] | map() | non_neg_integer(). ``` Reduces enumerable until `Fun` returns `{halt, AccOut}`. The return value for `Fun` is expected to be * `{cont, AccOut}` to continue the reduction with `AccOut` as the new accumulator or * `{halt, AccOut}` to halt the reduction If fun returns `{halt, AccOut}` the reduction is halted and the function returns `AccOut`. Otherwise, if the enumerable is exhausted, the function returns the accumulator of the last `{cont, AccOut}`. shards\_group β€” shards v1.1.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_group.erl#L34 "View Source") shards\_group (shards v1.1.0) ============================================================================================================================================ This module provides a dynamic supervisor for creating and/or deleting tables dynamically in runtime and as part of an existing supervision tree; any application supervision tree using `shards`. [usage](#module-usage) Usage ------------------------------ To use `shards` and make the creates tables part of your application supervision tree, you have to add to your main supervisor: ``` % Supervisor init callback init(GroupName) -> Children = [ shards\_group:child\_spec(GroupName) ], {ok, {{one\_for\_one, 10, 10}, Children}}. ``` After your application starts, you can create and delete tables like so: ``` > {ok, Pid, Tab} = shards\_group:new\_table(GroupName, mytab, [named\_table]). {ok,<0.194.0>,#Ref<0.3052443831.2753691659.260835>} > shards\_group:del\_table(GroupName, mytab). ok ``` [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [child\_spec(Name)](#child_spec/1) [del\_table(SupRef, Tab)](#del_table/2) [init(\_)](#init/1) [new\_table(SupRef, TabName, Options)](#new_table/3) [start\_link()](#start_link/0) Equivalent to [start\_link(shards\_group)](#start_link/1). [start\_link(Name)](#start_link/1) [start\_table(Name, Opts)](#start_table/2) [stop(Pid)](#stop/1) Equivalent to [stop(Pid, 5000)](#stop/2). [stop(SupRef, Timeout)](#stop/2) [Link to this section](#functions) Functions ============================================= [Link to this function](#child_spec/1 "Link to this function") child\_spec(Name) ================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_group.erl#L82 "View Source") ``` -spec child_spec(Name) -> ChildSpec when Name :: atom() | undefined, ChildSpec :: [supervisor:child\_spec](https://www.erlang.org/doc/man/supervisor.html#type-child_spec)(). ``` [Link to this function](#del_table/2 "Link to this function") del\_table(SupRef, Tab) ======================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_group.erl#L103 "View Source") ``` -spec del_table(SupRef, Tab) -> ok | {error, Reason} when SupRef :: atom(), Tab :: [shards:tab](shards.html#t:tab/0)(), Reason :: not_found | simple_one_for_one. ``` [Link to this function](#init/1 "Link to this function") init(\_) ======== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_group.erl#L119 "View Source") [Link to this function](#new_table/3 "Link to this function") new\_table(SupRef, TabName, Options) ==================================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_group.erl#L96 "View Source") ``` -spec new_table(SupRef, TabName, Options) -> {ok, TabPid, Tab} | {error, Reason} when SupRef :: atom() | pid(), TabName :: atom(), Options :: [[shards:option](shards.html#t:option/0)()], TabPid :: pid(), Tab :: [shards:tab](shards.html#t:tab/0)(), Reason :: term(). ``` [Link to this function](#start_link/0 "Link to this function") start\_link() ============= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_group.erl#L58 "View Source") Equivalent to [start\_link(shards\_group)](#start_link/1). [Link to this function](#start_link/1 "Link to this function") start\_link(Name) ================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_group.erl#L64 "View Source") ``` -spec start_link(Name) -> StartRet when Name :: atom() | undefined, StartRet :: {ok, pid()} | {error, term()}. ``` [Link to this function](#start_table/2 "Link to this function") start\_table(Name, Opts) ======================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_group.erl#L109 "View Source") [Link to this function](#stop/1 "Link to this function") stop(Pid) ========= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_group.erl#L70 "View Source") Equivalent to [stop(Pid, 5000)](#stop/2). [Link to this function](#stop/2 "Link to this function") stop(SupRef, Timeout) ===================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_group.erl#L76 "View Source") ``` -spec stop(SupRef, Timeout) -> ok when SupRef :: atom() | pid(), Timeout :: timeout(). ``` shards\_lib β€” shards v1.1.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_lib.erl#L6 "View Source") shards\_lib (shards v1.1.0) ======================================================================================================================================= Common Shards Utilities. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [kv\_list/0](#t:kv_list/0) [Functions](#functions) ------------------------ [get\_sup\_child(SupPid, Id)](#get_sup_child/2) Searches the childern of the supervisor `SupPid` for a child whose Nth element compares equal to `Id`. [keyfind(Key, KVList)](#keyfind/2) Equivalent to [keyfind(Key, KVList, undefined)](#keyfind/3). [keyfind(Key, KVList, Default)](#keyfind/3) Returns the value to the given `Key` or `Default` if it doesn't exist. [keypop(Key, KVList1)](#keypop/2) Equivalent to [keypop(Key, KVList1, undefined)](#keypop/3). [keypop(Key, KVList1, Default)](#keypop/3) Searches the list of tuples `KVList1` for a tuple whose Nth element compares equal to `Key`. Returns `{Value, KVList2}` if such a tuple is found, otherwise `{Default, KVList1}`. `KVList2` is a copy of `KVList1` where the first occurrence of Tuple has been removed. [keyupdate(Fun, Keys, TupleList)](#keyupdate/3) Equivalent to [keyupdate(Fun, Keys, undefined, TupleList)](#keyupdate/4). [keyupdate(Fun, Keys, Init, KVList1)](#keyupdate/4) Updates the given `Keys` by the result of calling `Fun(OldValue)`. If `Key` doesn't exist, then `Init` is set. [object\_key(ObjOrObjs, Meta)](#object_key/2) Returns the key for the given object or list of objects. [read\_tabfile(Filename)](#read_tabfile/1) Reads the file info related to a tabfile saved previously. [to\_string(Data)](#to_string/1) Converts the input data to a string. [write\_tabfile(Filename, Content)](#write_tabfile/2) Writes to a file a content related to a table. [Link to this section](#types) Types ===================================== [Link to this type](#t:kv_list/0 "Link to this type") kv\_list/0 ========== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_lib.erl#L23 "View Source") ``` -type kv_list() :: [{term(), term()}]. ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#get_sup_child/2 "Link to this function") get\_sup\_child(SupPid, Id) =========================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_lib.erl#L51 "View Source") ``` -spec get_sup_child(SupPid, Id) -> Child when SupPid :: pid(), Id :: term(), Child :: pid() | undefined | restarting. ``` Searches the childern of the supervisor `SupPid` for a child whose Nth element compares equal to `Id`. [Link to this function](#keyfind/2 "Link to this function") keyfind(Key, KVList) ==================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_lib.erl#L56 "View Source") Equivalent to [keyfind(Key, KVList, undefined)](#keyfind/3). [Link to this function](#keyfind/3 "Link to this function") keyfind(Key, KVList, Default) ============================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_lib.erl#L63 "View Source") ``` -spec keyfind(term(), [kv\_list](#t:kv_list/0)(), term()) -> term(). ``` Returns the value to the given `Key` or `Default` if it doesn't exist. [Link to this function](#keypop/2 "Link to this function") keypop(Key, KVList1) ==================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_lib.erl#L95 "View Source") Equivalent to [keypop(Key, KVList1, undefined)](#keypop/3). [Link to this function](#keypop/3 "Link to this function") keypop(Key, KVList1, Default) ============================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_lib.erl#L110 "View Source") ``` -spec keypop(Key, KVList1, Default) -> {Value, KVList2} when Key :: term(), KVList1 :: [kv\_list](#t:kv_list/0)(), Default :: term(), Value :: term(), KVList2 :: [kv\_list](#t:kv_list/0)(). ``` Searches the list of tuples `KVList1` for a tuple whose Nth element compares equal to `Key`. Returns `{Value, KVList2}` if such a tuple is found, otherwise `{Default, KVList1}`. `KVList2` is a copy of `KVList1` where the first occurrence of Tuple has been removed. [Link to this function](#keyupdate/3 "Link to this function") keyupdate(Fun, Keys, TupleList) =============================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_lib.erl#L70 "View Source") Equivalent to [keyupdate(Fun, Keys, undefined, TupleList)](#keyupdate/4). [Link to this function](#keyupdate/4 "Link to this function") keyupdate(Fun, Keys, Init, KVList1) =================================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_lib.erl#L83 "View Source") ``` -spec keyupdate(Fun, Keys, Init, KVList1) -> KVList2 when Fun :: fun((Key :: term(), Value :: term()) -> term()), Keys :: [term()], Init :: term(), KVList1 :: [kv\_list](#t:kv_list/0)(), KVList2 :: [kv\_list](#t:kv_list/0)(). ``` Updates the given `Keys` by the result of calling `Fun(OldValue)`. If `Key` doesn't exist, then `Init` is set. [Link to this function](#object_key/2 "Link to this function") object\_key(ObjOrObjs, Meta) ============================ [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_lib.erl#L37 "View Source") ``` -spec object_key(ObjOrObjs, Meta) -> term() when ObjOrObjs :: tuple() | [tuple()], Meta :: [shards\_meta:t](shards_meta.html#t:t/0)(). ``` Returns the key for the given object or list of objects. [Link to this function](#read_tabfile/1 "Link to this function") read\_tabfile(Filename) ======================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_lib.erl#L143 "View Source") ``` -spec read_tabfile([shards:filename](shards.html#t:filename/0)()) -> term() | no_return(). ``` Reads the file info related to a tabfile saved previously. [Link to this function](#to_string/1 "Link to this function") to\_string(Data) ================ [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_lib.erl#L123 "View Source") ``` -spec to_string(Data :: term()) -> string() | no_return(). ``` Converts the input data to a string. [Link to this function](#write_tabfile/2 "Link to this function") write\_tabfile(Filename, Content) ================================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_lib.erl#L153 "View Source") ``` -spec write_tabfile([shards:filename](shards.html#t:filename/0)(), term()) -> ok | {error, term()}. ``` Writes to a file a content related to a table. shards\_meta β€” shards v1.1.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L13 "View Source") shards\_meta (shards v1.1.0) ========================================================================================================================================== This module encapsulates the partitioned table metadata. Different properties must be stored somewhere so `shards` can work properly. Shards perform logic on top of ETS tables, for example, compute the partition based on the `Key` where the action will be applied. To do so, it needs the number of partitions, the function to select the partition, and also the partition identifier to perform the ETS action. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [keyslot\_fun/0](#t:keyslot_fun/0) [meta\_map/0](#t:meta_map/0) [partition\_pids/0](#t:partition_pids/0) [partition\_tids/0](#t:partition_tids/0) [t/0](#t:t/0) [Functions](#functions) ------------------------ [ets\_opts(Meta)](#ets_opts/1) [from\_map(Map)](#from_map/1) Builds a new `meta` from the given `Map`. [get(Tab)](#get/1) Returns the `tab_info` within the metadata. [get(Tab, Key)](#get/2) Equivalent to [get(Tab, Key, undefined)](#get/3). [get(Tab, Key, Def)](#get/3) Returns the value for the given `Key` in the metadata, or `Def` if `Key` is not set. [get\_partition\_pids(Tab)](#get_partition_pids/1) Returns a list with the partition PIDs. [get\_partition\_tids(Tab)](#get_partition_tids/1) Returns a list with the partition TIDs. [init(Name, Opts)](#init/2) Initializes the metadata ETS table. [is\_metadata(Meta)](#is_metadata/1) Returns `true` if `Meta` is a metadata data type, otherwise, `false` is returned. [keypos(Meta)](#keypos/1) [keyslot\_fun(Meta)](#keyslot_fun/1) [lookup(Tab, Key)](#lookup/2) Returns the value associated to the key `Key` in the metadata table `Tab`. If `Key` is not found, the error `{unknown_table, Tab}` is raised. [new()](#new/0) Returns a metadata data type with the default values. [parallel(Meta)](#parallel/1) [parallel\_timeout(Meta)](#parallel_timeout/1) [partitions(Meta)](#partitions/1) [put(Tab, Key, Val)](#put/3) Stores the value `Val` under the given key `Key` into the metadata table `Tab`. [rename(Tab, Name)](#rename/2) Renames the metadata ETS table. [tab\_pid(Meta)](#tab_pid/1) [to\_map(Meta)](#to_map/1) Converts the given `Meta` into a `map`. [Link to this section](#types) Types ===================================== [Link to this type](#t:keyslot_fun/0 "Link to this type") keyslot\_fun/0 ============== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L67 "View Source") ``` -type keyslot_fun() :: fun((Key :: term(), Range :: pos_integer()) -> non_neg_integer()). ``` [Link to this type](#t:meta_map/0 "Link to this type") meta\_map/0 =========== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L84 "View Source") ``` -type meta_map() :: #{tab_pid => pid(), keypos => pos_integer(), partitions => pos_integer(), keyslot_fun => [keyslot\_fun](#t:keyslot_fun/0)(), parallel => boolean(), parallel_timeout => timeout(), ets_opts => [term()]}. ``` [Link to this type](#t:partition_pids/0 "Link to this type") partition\_pids/0 ================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L63 "View Source") ``` -type partition_pids() :: [{non_neg_integer(), pid()}]. ``` [Link to this type](#t:partition_tids/0 "Link to this type") partition\_tids/0 ================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L60 "View Source") ``` -type partition_tids() :: [{non_neg_integer(), [ets:tid](https://www.erlang.org/doc/man/ets.html#type-tid)()}]. ``` [Link to this type](#t:t/0 "Link to this type") t/0 === [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L81 "View Source") ``` -type t() :: #meta{}. ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#ets_opts/1 "Link to this function") ets\_opts(Meta) =============== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L290 "View Source") ``` -spec ets_opts([t](#t:t/0)() | [shards:tab](shards.html#t:tab/0)()) -> [term()]. ``` [Link to this function](#from_map/1 "Link to this function") from\_map(Map) ============== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L115 "View Source") ``` -spec from_map(Map :: #{atom() => term()}) -> [t](#t:t/0)(). ``` Builds a new `meta` from the given `Map`. [Link to this function](#get/1 "Link to this function") get(Tab) ======== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L204 "View Source") ``` -spec get(Tab :: [shards:tab](shards.html#t:tab/0)()) -> [t](#t:t/0)() | no_return(). ``` Returns the `tab_info` within the metadata. [Link to this function](#get/2 "Link to this function") get(Tab, Key) ============= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L207 "View Source") Equivalent to [get(Tab, Key, undefined)](#get/3). [Link to this function](#get/3 "Link to this function") get(Tab, Key, Def) ================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L219 "View Source") ``` -spec get(Tab, Key, Def) -> Val when Tab :: [shards:tab](shards.html#t:tab/0)(), Key :: term(), Def :: term(), Val :: term(). ``` Returns the value for the given `Key` in the metadata, or `Def` if `Key` is not set. [Link to this function](#get_partition_pids/1 "Link to this function") get\_partition\_pids(Tab) ========================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L239 "View Source") ``` -spec get_partition_pids(Tab :: [shards:tab](shards.html#t:tab/0)()) -> [partition\_pids](#t:partition_pids/0)(). ``` Returns a list with the partition PIDs. [Link to this function](#get_partition_tids/1 "Link to this function") get\_partition\_tids(Tab) ========================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L233 "View Source") ``` -spec get_partition_tids(Tab :: [shards:tab](shards.html#t:tab/0)()) -> [partition\_tids](#t:partition_tids/0)(). ``` Returns a list with the partition TIDs. [Link to this function](#init/2 "Link to this function") init(Name, Opts) ================ [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L156 "View Source") ``` -spec init(Name, Opts) -> Tab when Name :: atom(), Opts :: [[shards:option](shards.html#t:option/0)()], Tab :: [shards:tab](shards.html#t:tab/0)(). ``` Initializes the metadata ETS table. [Link to this function](#is_metadata/1 "Link to this function") is\_metadata(Meta) ================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L146 "View Source") ``` -spec is_metadata(Meta :: term()) -> boolean(). ``` Returns `true` if `Meta` is a metadata data type, otherwise, `false` is returned. [Link to this function](#keypos/1 "Link to this function") keypos(Meta) ============ [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L260 "View Source") ``` -spec keypos([t](#t:t/0)() | [shards:tab](shards.html#t:tab/0)()) -> pos_integer(). ``` [Link to this function](#keyslot_fun/1 "Link to this function") keyslot\_fun(Meta) ================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L272 "View Source") ``` -spec keyslot_fun([t](#t:t/0)() | [shards:tab](shards.html#t:tab/0)()) -> [keyslot\_fun](#t:keyslot_fun/0)(). ``` [Link to this function](#lookup/2 "Link to this function") lookup(Tab, Key) ================ [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L181 "View Source") ``` -spec lookup(Tab, Key) -> term() when Tab :: [shards:tab](shards.html#t:tab/0)(), Key :: term(). ``` Returns the value associated to the key `Key` in the metadata table `Tab`. If `Key` is not found, the error `{unknown_table, Tab}` is raised. [Link to this function](#new/0 "Link to this function") new() ===== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L109 "View Source") ``` -spec new() -> [t](#t:t/0)(). ``` Returns a metadata data type with the default values. [Link to this function](#parallel/1 "Link to this function") parallel(Meta) ============== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L278 "View Source") ``` -spec parallel([t](#t:t/0)() | [shards:tab](shards.html#t:tab/0)()) -> boolean(). ``` [Link to this function](#parallel_timeout/1 "Link to this function") parallel\_timeout(Meta) ======================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L284 "View Source") ``` -spec parallel_timeout([t](#t:t/0)() | [shards:tab](shards.html#t:tab/0)()) -> timeout(). ``` [Link to this function](#partitions/1 "Link to this function") partitions(Meta) ================ [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L266 "View Source") ``` -spec partitions([t](#t:t/0)() | [shards:tab](shards.html#t:tab/0)()) -> pos_integer(). ``` [Link to this function](#put/3 "Link to this function") put(Tab, Key, Val) ================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L196 "View Source") ``` -spec put(Tab, Key, Val) -> ok when Tab :: [shards:tab](shards.html#t:tab/0)(), Key :: term(), Val :: term(). ``` Stores the value `Val` under the given key `Key` into the metadata table `Tab`. [Link to this function](#rename/2 "Link to this function") rename(Tab, Name) ================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L171 "View Source") ``` -spec rename(Tab, Name) -> Name when Tab :: [shards:tab](shards.html#t:tab/0)(), Name :: atom(). ``` Renames the metadata ETS table. [Link to this function](#tab_pid/1 "Link to this function") tab\_pid(Meta) ============== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L254 "View Source") ``` -spec tab_pid([t](#t:t/0)() | [shards:tab](shards.html#t:tab/0)()) -> pid(). ``` [Link to this function](#to_map/1 "Link to this function") to\_map(Meta) ============= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_meta.erl#L130 "View Source") ``` -spec to_map([t](#t:t/0)()) -> [meta\_map](#t:meta_map/0)(). ``` Converts the given `Meta` into a `map`. shards\_opts β€” shards v1.1.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_opts.erl#L6 "View Source") shards\_opts (shards v1.1.0) ========================================================================================================================================= Utilities for parsing the given shards/ets options.. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [parse(Opts)](#parse/1) [Link to this section](#functions) Functions ============================================= [Link to this function](#parse/1 "Link to this function") parse(Opts) =========== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_opts.erl#L32 "View Source") ``` -spec parse([[shards:option](shards.html#t:option/0)()]) -> [shards\_meta:meta\_map](shards_meta.html#t:meta_map/0)(). ``` shards\_partition β€” shards v1.1.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_partition.erl#L9 "View Source") shards\_partition (shards v1.1.0) =================================================================================================================================================== Partition Owner. The partition owner is a `gen_server` that creates and holds the ETS table associated with the partition. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [apply\_ets\_fun(Pid, EtsFun, Args)](#apply_ets_fun/3) [compute(Key, Meta)](#compute/2) [handle\_call(Request, From, State)](#handle_call/3) [handle\_cast(Request, State)](#handle_cast/2) [handle\_info(Reason, State)](#handle_info/2) [init(\_)](#init/1) [pid(Tab, Partition)](#pid/2) [retrieve\_tab(Pid)](#retrieve_tab/1) [start\_link(Tab, PartitionedTablePid, PartitionIndex, Options)](#start_link/4) [stop(Pid)](#stop/1) Equivalent to [stop(Server, 5000)](#stop/2). [stop(Pid, Timeout)](#stop/2) [tid(Tab, Partition)](#tid/2) [tid(Tab, Key, Meta)](#tid/3) [Link to this section](#functions) Functions ============================================= [Link to this function](#apply_ets_fun/3 "Link to this function") apply\_ets\_fun(Pid, EtsFun, Args) ================================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_partition.erl#L63 "View Source") ``` -spec apply_ets_fun(Pid :: pid(), EtsFun :: atom(), Args :: [term()]) -> term(). ``` [Link to this function](#compute/2 "Link to this function") compute(Key, Meta) ================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_partition.erl#L91 "View Source") ``` -spec compute(Key :: term(), Meta :: [shards\_meta:t](shards_meta.html#t:t/0)()) -> non_neg_integer(). ``` [Link to this function](#handle_call/3 "Link to this function") handle\_call(Request, From, State) ================================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_partition.erl#L131 "View Source") [Link to this function](#handle_cast/2 "Link to this function") handle\_cast(Request, State) ============================ [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_partition.erl#L140 "View Source") [Link to this function](#handle_info/2 "Link to this function") handle\_info(Reason, State) =========================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_partition.erl#L144 "View Source") [Link to this function](#init/1 "Link to this function") init(\_) ======== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_partition.erl#L101 "View Source") [Link to this function](#pid/2 "Link to this function") pid(Tab, Partition) =================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_partition.erl#L87 "View Source") ``` -spec pid(Tab :: [shards:tab](shards.html#t:tab/0)(), Partition :: non_neg_integer()) -> pid(). ``` [Link to this function](#retrieve_tab/1 "Link to this function") retrieve\_tab(Pid) ================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_partition.erl#L67 "View Source") ``` -spec retrieve_tab(Pid :: pid()) -> atom() | [ets:tid](https://www.erlang.org/doc/man/ets.html#type-tid)(). ``` [Link to this function](#start_link/4 "Link to this function") start\_link(Tab, PartitionedTablePid, PartitionIndex, Options) ============================================================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_partition.erl#L55 "View Source") ``` -spec start_link(Tab :: atom() | [ets:tid](https://www.erlang.org/doc/man/ets.html#type-tid)(), PartitionedTablePid :: pid(), PartitionIndex :: non_neg_integer(), Options :: [term()]) -> {ok, pid()} | ignore | {error, term()}. ``` [Link to this function](#stop/1 "Link to this function") stop(Pid) ========= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_partition.erl#L71 "View Source") Equivalent to [stop(Server, 5000)](#stop/2). [Link to this function](#stop/2 "Link to this function") stop(Pid, Timeout) ================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_partition.erl#L75 "View Source") ``` -spec stop(Pid :: pid(), Timeout :: timeout()) -> ok. ``` [Link to this function](#tid/2 "Link to this function") tid(Tab, Partition) =================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_partition.erl#L79 "View Source") ``` -spec tid(Tab :: [shards:tab](shards.html#t:tab/0)(), Partition :: non_neg_integer()) -> [ets:tid](https://www.erlang.org/doc/man/ets.html#type-tid)(). ``` [Link to this function](#tid/3 "Link to this function") tid(Tab, Key, Meta) =================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_partition.erl#L83 "View Source") ``` -spec tid(Tab :: [shards:tab](shards.html#t:tab/0)(), Key :: term(), Meta :: [shards\_meta:t](shards_meta.html#t:t/0)()) -> [ets:tid](https://www.erlang.org/doc/man/ets.html#type-tid)(). ``` shards\_partition\_sup β€” shards v1.1.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_partition_sup.erl#L13 "View Source") shards\_partition\_sup (shards v1.1.0) ============================================================================================================================================================= This supervisor represents a partitioned table, which is composed by a group of ETS tables, each of them owned by `shards_partition`. This supervisor holds and handles the supervision tree for a partitioned table. Every time a new partioned table is created, a new supervision tree is created to handle its lifecycle, and this module is the main supervisor for that tree. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [opts/0](#t:opts/0) [Functions](#functions) ------------------------ [init(\_)](#init/1) [start\_link(Name, Opts)](#start_link/2) [stop(SupRef)](#stop/1) Equivalent to [stop(Pid, 5000)](#stop/2). [stop(SupRef, Timeout)](#stop/2) [Link to this section](#types) Types ===================================== [Link to this type](#t:opts/0 "Link to this type") opts/0 ====== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_partition_sup.erl#L31 "View Source") ``` -type opts() :: #{atom() => term()}. ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#init/1 "Link to this function") init(\_) ======== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_partition_sup.erl#L59 "View Source") [Link to this function](#start_link/2 "Link to this function") start\_link(Name, Opts) ======================= [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_partition_sup.erl#L41 "View Source") ``` -spec start_link(Name, Opts) -> OnStart when Name :: atom(), Opts :: [opts](#t:opts/0)(), OnStart :: {ok, pid()} | ignore | {error, term()}. ``` [Link to this function](#stop/1 "Link to this function") stop(SupRef) ============ [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_partition_sup.erl#L45 "View Source") Equivalent to [stop(Pid, 5000)](#stop/2). [Link to this function](#stop/2 "Link to this function") stop(SupRef, Timeout) ===================== [View Source](https://github.com/cabol/shards/blob/v1.1.0/src/shards_partition_sup.erl#L51 "View Source") ``` -spec stop(SupRef, Timeout) -> ok when SupRef :: atom() | pid(), Timeout :: timeout(). ``` Getting Started β€” shards v1.1.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/cabol/shards/blob/v1.1.0/guides/getting-started.md#L1 "View Source") Getting Started ================================================================================================================================== [table-of-contents](#table-of-contents) Table of Contents ----------------------------------------------------------- * **[Prelude](#prelude)** * **[Installation](#installation)** + [Erlang](#erlang) + [Elixir](#elixir) * **[Creating partitioned tables](#creating-partitioned-tables)** * **[Inserting entries](#inserting-entries)** * **[Retrieving entries](#retrieving-entries)** * **[Making partitioned tables part of an application's supervision tree](#making-partitioned-tables-part-of-an-applications-supervision-tree)** + [Erlang example](#erlang-example) + [Elixir example](#elixir-example) * **[Advanced topics](#advanced-topics)** + **[Caching the metadata](#caching-the-metadata)** [prelude](#prelude) Prelude ----------------------------- In this guide, we're going to learn some basics about `shards`, how to create partitioned tables and how to use them; which is the easiest part, since it is the same ETS API. [installation](#installation) Installation -------------------------------------------- ### [erlang](#erlang) Erlang In your `rebar.config`: ``` {deps, [ {shards, "1.1.0"} ]}. ``` ### [elixir](#elixir) Elixir In your `mix.exs`: ``` def deps do [{:shards, "~> 1.1"}] end ``` [creating-partitioned-tables](#creating-partitioned-tables) Creating partitioned tables ----------------------------------------------------------------------------------------- Exactly as ETS, `shards:new/2` function receives 2 arguments, the name of the table and the options. But in addition to the options given by `ets:new/2`, `shards` provides the next ones: * `{partitions, pos_integer()}` - Allows to set the desired number of partitions. By default, the number of partitions is the total of online schedulers (`erlang:system_info(schedulers_online)`). * `{keyslot_fun, shards_meta:keyslot_fun()}` - Function used to compute the partition where the action will be evaluated based on the key. Defaults to `erlang:phash2/2`. * `{parallel, boolean()}` - Specifies whether `shards` should work in parallel mode or not, for the applicable functions, e.g.: `select`, `match`, etc. By default is set to `false`. * `{parallel_timeout, timeout()}` - When `parallel` is set to `true`, it specifies the max timeout for a parallel execution. Defaults to `infinity`. Wen a new table is created, the [metadata](https://github.com/cabol/shards/blob/master/src/shards_meta.erl) is created for that table as well. The purpose of the **metadata** is to store information related to that table, such as: number of partitions, keyslot function, etc. To learn more about it, check out [shards\_meta](https://github.com/cabol/shards/blob/master/src/shards_meta.erl). **Erlang:** ``` % create a named table with 4 shards > shards:new(tab1, [named\_table, {partitions, 4}]). tab1 % create another one with default options > shards:new(tab2, []). #Ref<0.893853601.1266286595.53859> ``` **Elixir:** ``` # create a named table with 4 shards iex> :shards.new(:tab1, [:named\_table, partitions: 4]) :tab1 # create another one with default options iex> :shards.new(:tab2, []) #Reference<0.1257361217.1909325839.17166> ``` > **NOTE:** You can also start the observer by calling `observer:start()` > to see how a partitioned table looks like. > > [inserting-entries](#inserting-entries) Inserting entries ----------------------------------------------------------- **Erlang:** ``` > shards:insert(tab1, {k1, 1}). true > shards:insert(tab1, [{k1, 1}, {k2, 2}]). true > shards:insert\_new(tab1, {k3, 3}). true > shards:insert\_new(tab1, {k3, 3}). false > shards:insert\_new(tab1, [{k3, 3}, {k4, 4}]). false ``` **Elixir:** ``` iex> :shards.insert(:tab1, k1: 1) true iex> :shards.insert(:tab1, k1: 1, k2: 2) true iex> :shards.insert\_new(:tab1, k3: 3) true iex> :shards.insert\_new(:tab1, k3: 3) false iex> :shards.insert\_new(:tab1, k3: 3, k4: 4) false ``` [retrieving-entries](#retrieving-entries) Retrieving entries -------------------------------------------------------------- **Erlang:** ``` % inserting some objects > shards:insert(tab1, [{k1, 1}, {k2, 2}, {k3, 3}]). true % let's check those objects > shards:lookup(tab1, k1). [{k1,1}] > shards:lookup(tab1, k2). [{k2,2}] > shards:lookup(tab1, k3). [{k3,3}] > shards:lookup(tab1, k4). [] > shards:lookup\_element(tab1, k3, 2). 3 % delete an object and then check > shards:delete(tab1, k3). true > shards:lookup(tab1, k3). [] % now let's find all stored objects using select > MatchSpec = ets:fun2ms(fun({K, V}) -> {K, V} end). [{{'$1','$2'},[],[{{'$1','$2'}}]}] > shards:select(tab1, MatchSpec). [{k2,2},{k1,1}] ``` **Elixir:** ``` iex> :shards.insert(:tab1, k1: 1, k2: 2, k3: 3) true iex> :shards.lookup(:tab1, :k1) [k1: 1] iex> :shards.lookup(:tab1, :k2) [k2: 2] iex> :shards.lookup(:tab1, :k3) [k3: 3] iex> :shards.lookup(:tab1, :k4) [] iex> :shards.lookup\_element(:tab1, :k3, 2) 3 iex> :shards.delete(:tab1, :k3) true iex> :shards.lookup(:tab1, :k3) [] iex> ms = :ets.fun2ms(& &1) [{:"$1", [], [:"$1"]}] iex> :shards.select(:tab1, ms) [k2: 2, k1: 1] ``` As you may have noticed using `shards` is extremely easy, it's only matters of using the same ETS API but with `shards` module. You can try the rest of the ETS API but using `shards`. [making-partitioned-tables-part-of-an-application-s-supervision-tree](#making-partitioned-tables-part-of-an-application-s-supervision-tree) Making partitioned tables part of an application's supervision tree ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- There might be some cases we may want to start the tables as part of an existing supervision tree. To do so, we can create a dynamic supervisor for taking care of creating/deleting the tables and add the dynamic supervisor as part of our app supervision tree. Shards provides the module `shards_group`, which is a dynamic supervisor that can bee added to an existing application and/or supervision tree. Besides, `shards_group` brings with the function to create tables making them part of the dynamic supervisor and also with the function to delete them and remove them from the dynamic supervisor. But let's see how it works! ### [erlang-example](#erlang-example) Erlang example Supposing you have an application `myapp` and the main supervisor `myapp_sup`, the only piece of configuration is to setup the `shards_group` as a supervisor within the application's supervision tree, like so: ``` -module(myapp\_sup). -export([start\_link/1, init/1]). start\_link() -> supervisor:start\_link({name, ?MODULE}, ?MODULE, []). init(\_) -> Children = [ % Dynamic supervisor with default name shards\_group % See shards\_group:child\_spec/1 shards\_group:child\_spec() ], {ok, {{one\_for\_one, 10, 10}, Children}}. ``` > The call `shards_group:child_spec()` will return the spec using the default > name for the dynamic supervisor `shards_group`, but can pass the desired name > by calling `shards_group:child_spec(desired_name)`. > > Once the app is started, you can use `shards_group` to create/delete tables and `shards` for the rest of the API functions, like so: ``` % create a table as part of the app supervision tree > shards\_group:new\_table(myapp\_dynamic\_sup, tab1, [named\_table]). {ok,<0.194.0>,#Ref<0.3052443831.2753691659.260835>} > shards:insert(tab1, [{a, 1}, {b, 2}]). true > shards:lookup\_element(tab1, a, 2). 1 % let's create another table > {ok, \_Pid, Tab} = shards\_group:new\_table(myapp\_dynamic\_sup, tab2, []). {ok,<0.195.0>,#Ref<0.3052443831.2753691659.260836>} > shards:insert(tab2, [{c, 3}, {d, 4}]). true > shards:lookup\_element(tab1, c, 2). 3 % you can open the observer to see hoe the tables look like > observer:start(). ok % deleting a table > shards\_group:del\_table(myapp\_dynamic\_sup, tab1). true ``` ### [elixir-example](#elixir-example) Elixir example In Elixir is much easier it provides the [`DynamicSupervisor`](https://hexdocs.pm/elixir/DynamicSupervisor.html) module out-of-box, so we have two options, either use `:shards_group` like before in the Erlang example, or use [`DynamicSupervisor`](https://hexdocs.pm/elixir/DynamicSupervisor.html) and create a simple module to encapsulate the logic of creating/deleting tables. Since we already know how `:shards_group` works in the previous example, let's take the second option. First of all, let's create the module to encapsulate the logic of creating and deleting the tables: ``` defmodule MyApp.DynamicShards do @moduledoc false # creates a table with shards as part of the DynamicSupervisor which at # the same time is part of the app supervision tree def new(name, opts) do {:ok, \_pid, tab} = DynamicSupervisor.start\_child(\_\_MODULE\_\_, table\_spec(name, opts)) tab end # deletes the table and also removes the table supervisor from the # DynamicSupervisor def delete(tab) do DynamicSupervisor.terminate\_child(\_\_MODULE\_\_, :shards\_meta.tab\_pid(tab)) end # this functions encapsulates the logic of creating the sharded table # as child of the DynamicSupervisor def start\_table(name, opts) do tab = :shards.new(name, opts) pid = :shards\_meta.tab\_pid(tab) {:ok, pid, tab} end # DynamicSupervisor child spec defp table\_spec(name, opts) do %{ id: name, start: {\_\_MODULE\_\_, :start\_table, [name, opts]}, type: :supervisor } end end ``` The final piece of configuration is to setup a [`DynamicSupervisor`](https://hexdocs.pm/elixir/DynamicSupervisor.html) as a supervisor within the application's supervision tree, which we can do in `lib/my_app/application.ex`, inside the `start/2` function: ``` def start(\_type, \_args) do children = [ {DynamicSupervisor, strategy: :one\_for\_one, name: MyApp.DynamicShards} ] ... ``` Now we can use `:shards`: ``` iex> MyApp.DynamicShards.new(:t1, [:named\_table]) :t1 iex> t2 = MyApp.DynamicShards.new(:t2, []) #Reference<0.2506606486.3592028173.65798> iex> :shards.insert(:t1, a: 1, b: 2) true iex> :shards.insert(t2, c: 3, d: 4) true iex> :shards.lookup\_element(:t1, :a, 2) 1 iex> :shards.lookup\_element(t2, :c, 2) 3 # open the observer iex> :observer.start() ok # delete a table iex> MyApp.DynamicShards.delete(:t1) :ok ``` [advanced-topics](#advanced-topics) Advanced topics ----------------------------------------------------- [storing-and-retrieving-custom-metadata-entries](#storing-and-retrieving-custom-metadata-entries) Storing and retrieving custom metadata entries -------------------------------------------------------------------------------------------------------------------------------------------------- Since `shards` uses an internal ETS table for the metadata, it also provides helper functions for storing and retrieving custom metadata entries. ``` > Tab = shards:new(mytab, [named\_table, {partitions, 4}]). mytab > shards:put\_meta(Tab, foo, bar). ok > shards:get\_meta(Tab, foo). bar % Non-existing key > shards:get\_meta(Tab, foo\_foo). undefined % With default > shards:get\_meta(Tab, foo\_foo, bar\_bar). bar\_bar ``` **Elixir:** ``` iex> tab = :shards.new(:mytab, [:named\_table, partitions: 4]) :mytab iex> :shards.put\_meta(tab, "foo", "bar") :ok iex> :shards.get\_meta(tab, "foo") "bar" # Non-existing key iex> :shards.get\_meta(tab, "foo foo") :undefined # With default iex> :shards.get\_meta(tab, "foo foo", "bar bar") "bar bar" ``` ### [caching-the-metadata](#caching-the-metadata) Caching the metadata Like it is explained in [shards module](https://hexdocs.pm/shards/shards.html), when a partitioned table is created there is a metadata associated to it, to resolve the number of partitions and other needed attributes. Hence, every time a function is executed, `shards` has to resolve the metadata first; but this is done internally by `shards`. Nevertheless, `shards` allows to pass the metadata as last argument for most of the functions (check the docs to see what functions allow it), in case you are able to cache it and use it later for further operations. This is possible because the metadata is something doesn't change, so it can be easily cached and avoid `shards` the extra step to retrieve it from the meta table. But be aware this is just an ETS lookup, so the improvement is terms of performance may be insignificant, for that reason it is recommendable to evaluate very carefully each scenario and and see if its really worth it. > The overall recommendation is to let `shards` take care of retrieving the > metadata and everything else, just use the base `shards` API (ETS API). > > In case you want to cache the metadata: **Erlang:** ``` > Tab = shards:new(mytab, [named\_table, {partitions, 4}]). mytab > Meta = shards:table\_meta(Tab). {meta,<0.174.0>,1,4,fun erlang:phash2/2,false,[named\_table]} ``` **Elixir:** ``` iex> tab = :shards.new(:mytab, [:named\_table, partitions: 4]) :mytab iex> meta = :shards.meta(tab) {:meta, #PID<0.163.0>, 1, 4, &:erlang.phash2/2, false, [:named\_table]} ``` Then, you can use it for most of the functions (check the docs): **Erlang:** ``` > shards:insert(Tab, [{a, 1}, {b, 2}], Meta). true > shards:lookup(Tab, a, Meta). [{a,1}] > shards:lookup\_element(Tab, a, 2, Meta). 1 ``` **Elixir:** ``` iex> :shards.insert(tab, [a: 1, b: 2], meta) true iex> :shards.lookup(tab, :a, meta) [a: 1] iex> :shards.lookup\_element(tab, :a, 2, meta) 1 ``` > **NOTE:** See [shards](https://hexdocs.pm/shards/shards.html) docs for more > information about the functions that support receiving the metadata; most of > them allow the metadata parameter, but there are few exceptions you should > know. > > [← Previous Page API Reference](api-reference.html) [Next Page β†’ Shards](readme.html)
vaultex
hex
:lock: Vaultex β€” vaultex v1.0.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } :lock: Vaultex ============== [![Hex.pm](https://img.shields.io/hexpm/v/vaultex.svg)](https://hex.pm/packages/vaultex) [![Hex.pm](https://img.shields.io/hexpm/dt/vaultex.svg)](https://hex.pm/packages/vaultex) A very simple elixir client that authenticates, reads, writes, and deletes secrets from HashiCorp's Vault. As listed on [Vault Libraries](https://www.vaultproject.io/api/libraries.html#elixir). Installation --------------- The package can be installed as: 1) Add `vaultex` to your list of dependencies in `mix.exs`: ``` def deps do [{:vaultex, "~> 0.8"}] end ``` 2) Ensure `vaultex` is started before your application: ``` def application do [applications: [:vaultex]] end ``` Configuration ---------------- You can configure your vault endpoint with a single environment variable: * `VAULT_ADDR` Or a single application variable: * `:vaultex, :vault_addr` An example value for `VAULT_ADDR` is `http://127.0.0.1:8200`. Alternatively the vault endpoint can be specified with environment variables: * `VAULT_HOST` * `VAULT_PORT` * `VAULT_SCHEME` Or application variables: * `:vaultex, :host` * `:vaultex, :port` * `:vaultex, :scheme` These default to `localhost`, `8200`, `http` respectively. You can skip SSL certificate verification with `:vaultex, vault_ssl_verify: true` option or `VAULT_SSL_VERIFY=true` environment variable. If you do want to use SSL verification, set the `VAULT_CACERT` environment variable to the SSL certificate location. (See the [Vault documentaion](https://www.vaultproject.io/docs/commands/#vault_cacert) for more details.) Usages --------- To read a secret you must provide the path to the secret and the authentication backend and credentials you will use to login. See the [Vaultex.Client.auth/2](https://hexdocs.pm/vaultex/Vaultex.Client.html#auth/2) docs for supported auth backends. Authenticate to different authentication backends. ``` iex> Vaultex.Client.auth(:app\_id, {app\_id, user\_id}) iex> Vaultex.Client.auth(:userpass, {username, password}) iex> Vaultex.Client.auth(:ldap, {username, password}) iex> Vaultex.Client.auth(:github, {github\_token}) iex> Vaultex.Client.auth(:approle, {role\_id, secret\_id}) iex> Vaultex.Client.auth(:token, {token}) iex> Vaultex.Client.auth(:kubernetes, %{jwt: "jwt", role: "role"}) iex> Vaultex.Client.auth(:radius, %{username: "user", password: "password"}) iex> Vaultex.Client.auth(:aws\_iam, {role, server}) ``` Reading secret from authenticated backends. ``` iex> Vaultex.Client.read "secret/bar", :github, {github\_token} {:ok, %{"value" => bar"}} iex> Vaultex.Client.read\_dynamic "secret/dynamic/bar", :github, {github\_token} {:ok, %{ "data" => %{"value" => "bar"}, "lease\_duration" => 60, "lease\_id" => "secret/dynamic/foo/b4z", "renewable" => true }} ``` Additional actions on the secret. ``` iex> Vaultex.Client.renew\_lease("secret/dynamic/foo/b4z", 100, :github, {github\_token}) {:ok, %{ "lease\_id" => "secret/dynamic/foo/b4z", "lease\_duration" => 160, "renewable" => true }} iex> Vaultex.Client.write "secret/foo", %{"value" => "bar"}, :app\_id, {app\_id, user\_id} iex> Vaultex.Client.delete "secret/foo", :app\_id, {app\_id, user\_id} ``` Notes for `aws_iam` method ----------------------------- The AWS IAM authentication method requires you to have [ExAws](https://github.com/ex-aws/ex_aws) installed as a dependency and correctly configured. No additional ExAws modules are required. For more details see the [Vault AWS docs](https://www.vaultproject.io/docs/auth/aws.html). * If `role` id set to `nil` Vault will try to infer the vault role to use. * `server` may be set to `nil` or to the value to pass in the `X-Vault-AWS-IAM-Server-ID` header. Releasing ------------ To release you need to bump the version and add some changes to the change log, you can do this with: ``` mix eliver.bump ``` Vaultex β€” vaultex v1.0.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } vaultex v1.0.1 Vaultex [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex.ex#L1 "View Source") ======================================================================================================================== Interface with Hashicorp's vault. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [start(type, args)](#start/2) Callback implementation for [`Application.start/2`](https://hexdocs.pm/elixir/Application.html#c:start/2). [Link to this section](#functions) Functions ============================================= [Link to this function](#start/2 "Link to this function") start(type, args) ================= [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex.ex#L9 "View Source") Callback implementation for [`Application.start/2`](https://hexdocs.pm/elixir/Application.html#c:start/2). Vaultex.Auth β€” vaultex v1.0.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } vaultex v1.0.1 Vaultex.Auth [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex/auth.ex#L1 "View Source") ================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [handle(method, credentials, state)](#handle/3) [Link to this section](#functions) Functions ============================================= [Link to this function](#handle/3 "Link to this function") handle(method, credentials, state) ================================== [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex/auth.ex#L2 "View Source") Vaultex.Auth.AWSIAM β€” vaultex v1.0.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } vaultex v1.0.1 Vaultex.Auth.AWSIAM [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex/aws_iam.ex#L1 "View Source") ============================================================================================================================================ Helper functions for AWS IAM instance metadata role authentication [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [credentials(role, server)](#credentials/2) [Link to this section](#functions) Functions ============================================= [Link to this function](#credentials/2 "Link to this function") credentials(role, server) ========================= [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex/aws_iam.ex#L9 "View Source") Vaultex.Client β€” vaultex v1.0.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } vaultex v1.0.1 Vaultex.Client [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex/client.ex#L1 "View Source") ====================================================================================================================================== Provides a functionality to authenticate and read from a vault endpoint. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [auth(method, credentials, timeout \\ 5000)](#auth/3) Authenticates with vault using a tuple. This can be executed before attempting to read secrets from vault. [child\_spec(init\_arg)](#child_spec/1) Returns a specification to start this module under a supervisor. [delete(key, auth\_method, credentials, timeout \\ 5000)](#delete/4) Deletes a secret in Vault given a path. [init(state)](#init/1) Callback implementation for [`GenServer.init/1`](https://hexdocs.pm/elixir/GenServer.html#c:init/1). [read(key, auth\_method, credentials, timeout \\ 5000)](#read/4) Reads a secret from vault given a path. [read\_dynamic(key, auth\_method, credentials, timeout \\ 5000)](#read_dynamic/4) Reads a dynamic secret from vault given a path and returns the secret along with lease information. [renew\_lease(lease\_id, increment, auth\_method, credentials, timeout \\ 5000)](#renew_lease/5) Renews a lease for a dynamic secret [start\_link()](#start_link/0) [write(key, value, auth\_method, credentials, timeout \\ 5000)](#write/5) Writes a secret to Vault given a path. [Link to this section](#functions) Functions ============================================= [Link to this function](#auth/3 "Link to this function") auth(method, credentials, timeout \\ 5000) ========================================== [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex/client.ex#L54 "View Source") Specs ----- ``` auth( method :: :approle, credentials :: {role_id :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), secret_id :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()}, timeout :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil ) :: {:ok | :error, [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` ``` auth( method :: :app_id, credentials :: {app_id :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), user_id :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()}, timeout :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil ) :: {:ok | :error, [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` ``` auth( method :: :userpass, credentials :: {username :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), password :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()}, timeout :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil ) :: {:ok | :error, [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` ``` auth( method :: :github, credentials :: {github_token :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()}, timeout :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil ) :: {:ok | :error, [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` ``` auth( method :: :token, credentials :: {token :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()}, timeout :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil ) :: {:ok, :authenticated} ``` Authenticates with vault using a tuple. This can be executed before attempting to read secrets from vault. Parameters ------------- * method: Auth backend to use for authenticating, can be one of `:approle, :app_id, :userpass, :github, :token` * credentials: A tuple or map used for authentication depending on the method, `{role_id, secret_id}` for `:approle`, `{app_id, user_id}` for `:app_id`, `{username, password}` for `:userpass`, `{github_token}` for `:github`, `{token}` for `:token`, or json-encodable map for unhandled methods, i.e. `%{jwt: "jwt", role: "role"}` for `:kubernetes` * timeout: A integer greater than zero which specifies how many milliseconds to wait for a reply Examples ----------- ``` iex> Vaultex.Client.auth(:approle, {role\_id, secret\_id}, 5000) {:ok, :authenticated} iex> Vaultex.Client.auth(:app\_id, {app\_id, user\_id}) {:ok, :authenticated} iex> Vaultex.Client.auth(:userpass, {username, password}) {:error, ["Something didn't work"]} iex> Vaultex.Client.auth(:github, {github\_token}) {:ok, :authenticated} iex> Vaultex.Client.auth(:jwt, %{jwt: jwt, role: role}) {:ok, :authenticated} ``` [Link to this function](#child_spec/1 "Link to this function") child\_spec(init\_arg) ====================== [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex/client.ex#L6 "View Source") Returns a specification to start this module under a supervisor. See [`Supervisor`](https://hexdocs.pm/elixir/Supervisor.html). [Link to this function](#delete/4 "Link to this function") delete(key, auth\_method, credentials, timeout \\ 5000) ======================================================= [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex/client.ex#L216 "View Source") Deletes a secret in Vault given a path. Parameters ------------- * key: A String path where the secret will be deleted. * auth\_method and credentials: See Vaultex.Client.auth * timeout: A integer greater than zero which specifies how many milliseconds to wait for a reply Examples ----------- ``` iex> Vaultex.Client.delete("secret/foo", :app\_role, {role\_id, secret\_id}, 5000) :ok iex> Vaultex.Client.delete("secret/foo", :app\_id, {app\_id, user\_id}) :ok ``` [Link to this function](#init/1 "Link to this function") init(state) =========== [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex/client.ex#L18 "View Source") Callback implementation for [`GenServer.init/1`](https://hexdocs.pm/elixir/GenServer.html#c:init/1). [Link to this function](#read/4 "Link to this function") read(key, auth\_method, credentials, timeout \\ 5000) ===================================================== [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex/client.ex#L84 "View Source") Reads a secret from vault given a path. Parameters ------------- * key: A String path to be used for querying vault. * auth\_method and credentials: See Vaultex.Client.auth * timeout: A integer greater than zero which specifies how many milliseconds to wait for a reply Examples ----------- ``` iex> Vaultex.Client.read("secret/foobar", :approle, {role\_id, secret\_id}, 5000) {:ok, %{"value" => "bar"}} iex> Vaultex.Client.read("secret/foo", :app\_id, {app\_id, user\_id}) {:ok, %{"value" => "bar"}} iex> Vaultex.Client.read("secret/baz", :userpass, {username, password}) {:error, ["Key not found"]} iex> Vaultex.Client.read("secret/bar", :github, {github\_token}) {:ok, %{"value" => "bar"}} iex> Vaultex.Client.read("secret/bar", :plugin\_defined\_auth, credentials) {:ok, %{"value" => "bar"}} ``` [Link to this function](#read_dynamic/4 "Link to this function") read\_dynamic(key, auth\_method, credentials, timeout \\ 5000) ============================================================== [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex/client.ex#L117 "View Source") Reads a dynamic secret from vault given a path and returns the secret along with lease information. Parameters ------------- * key: A String path to be used for querying vault. * auth\_method and credentials: See Vaultex.Client.auth * timeout: A integer greater than zero which specifies how many milliseconds to wait for a reply Examples ----------- ``` iex> Vaultex.Client.read\_dynamic("secret/dynamic/foobar", :approle, {role\_id, secret\_id}, 5000) {:ok, %{"data" => %{"value" => "bar"}, "lease\_duration" => 60, "lease\_id" => "secret/dynamic/foo/b4z", "renewable" => true}} iex> Vaultex.Client.read\_dynamic("secret/dynamic/foo", :app\_id, {app\_id, user\_id}) {:ok, %{"data" => %{"value" => "bar"}, "lease\_duration" => 60, "lease\_id" => "secret/dynamic/foo/b4z", "renewable" => true}} iex> Vaultex.Client.read\_dynamic("secret/dynamic/baz", :userpass, {username, password}) {:error, ["Key not found"]} iex> Vaultex.Client.read\_dynamic("secret/dynamic/bar", :github, {github\_token}) {:ok, %{"data" => %{"value" => "bar"}, "lease\_duration" => 60, "lease\_id" => "secret/dynamic/foo/b4z", "renewable" => true}} iex> Vaultex.Client.read\_dynamic("secret/dynamic/bar", :plugin\_defined\_auth, credentials) {:ok, %{"data" => %{"value" => "bar"}, "lease\_duration" => 60, "lease\_id" => "secret/dynamic/foo/b4z", "renewable" => true}} ``` [Link to this function](#renew_lease/5 "Link to this function") renew\_lease(lease\_id, increment, auth\_method, credentials, timeout \\ 5000) ============================================================================== [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex/client.ex#L152 "View Source") Renews a lease for a dynamic secret Parameters ------------- * lease\_id: A String that is the lease ID returned when reading a dynamic secret * increment: An Integer that represents the time in seconds to extend the lease by * auth\_method and credentials: See Vaultex.Client.auth * timeout: A integer greater than zero which specifies how many milliseconds to wait for a reply Examples ----------- ``` iex> Vaultex.Client.renew\_lease("secret/dynamic/foo/b4z", 100, :app\_role, {role\_id, secret\_id}, 5000) {:ok, %{"lease\_id" => "secret/dynamic/foo/b4z", "lease\_duration" => 160, "renewable" => true}} ``` [Link to this function](#start_link/0 "Link to this function") start\_link() ============= [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex/client.ex#L14 "View Source") [Link to this function](#write/5 "Link to this function") write(key, value, auth\_method, credentials, timeout \\ 5000) ============================================================= [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex/client.ex#L184 "View Source") Writes a secret to Vault given a path. Parameters ------------- * key: A String path where the secret will be written. * value: A String => String map that will be stored in Vault * auth\_method and credentials: See Vaultex.Client.auth * timeout: A integer greater than zero which specifies how many milliseconds to wait for a reply Examples ----------- ``` iex> Vaultex.Client.write("secret/foo", %{"value" => "bar"}, :app\_role, {role\_id, secret\_id}, 5000) :ok iex> Vaultex.Client.write("secret/foo", %{"value" => "bar"}, :app\_id, {app\_id, user\_id}) :ok ``` Vaultex.Delete β€” vaultex v1.0.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } vaultex v1.0.1 Vaultex.Delete [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex/delete.ex#L1 "View Source") ====================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [handle(key, state)](#handle/2) [Link to this section](#functions) Functions ============================================= [Link to this function](#handle/2 "Link to this function") handle(key, state) ================== [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex/delete.ex#L2 "View Source") Vaultex.Leases β€” vaultex v1.0.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } vaultex v1.0.1 Vaultex.Leases [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex/leases.ex#L1 "View Source") ====================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [handle(atom, lease, increment, state)](#handle/4) [Link to this section](#functions) Functions ============================================= [Link to this function](#handle/4 "Link to this function") handle(atom, lease, increment, state) ===================================== [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex/leases.ex#L2 "View Source") Vaultex.Read β€” vaultex v1.0.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } vaultex v1.0.1 Vaultex.Read [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex/read.ex#L1 "View Source") ================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [handle(key, state)](#handle/2) [Link to this section](#functions) Functions ============================================= [Link to this function](#handle/2 "Link to this function") handle(key, state) ================== [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex/read.ex#L2 "View Source") Vaultex.RedirectableRequests β€” vaultex v1.0.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } vaultex v1.0.1 Vaultex.RedirectableRequests [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex/redirectable_requests.ex#L1 "View Source") =================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [request(method, url, params, headers, options \\ [])](#request/5) [Link to this section](#functions) Functions ============================================= [Link to this function](#request/5 "Link to this function") request(method, url, params, headers, options \\ []) ==================================================== [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex/redirectable_requests.ex#L6 "View Source") Vaultex.Test.TestDoubles.MockHTTPoison β€” vaultex v1.0.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } vaultex v1.0.1 Vaultex.Test.TestDoubles.MockHTTPoison [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/test_doubles/mock_httpoison.ex#L1 "View Source") =========================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [request(atom, url, params, arg4, arg5)](#request/5) [Link to this section](#functions) Functions ============================================= [Link to this function](#request/5 "Link to this function") request(atom, url, params, arg4, arg5) ====================================== [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/test_doubles/mock_httpoison.ex#L3 "View Source") Vaultex.Write β€” vaultex v1.0.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } vaultex v1.0.1 Vaultex.Write [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex/write.ex#L1 "View Source") ==================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [handle(key, value, state)](#handle/3) [Link to this section](#functions) Functions ============================================= [Link to this function](#handle/3 "Link to this function") handle(key, value, state) ========================= [View Source](https://github.com/findmypast/vaultex/blob/v1.0.1/lib/vaultex/write.ex#L2 "View Source")
one_piece_result
hex
OnePiece.Result β€” OnePiece.Result v0.4.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L1 "View Source") OnePiece.Result (OnePiece.Result v0.4.0) ================================================================================================================================================================================================================ Handles [`t/0`](#t:t/0) responses. Inspired by Rust `std::result::Result` package. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [err()](#t:err/0) An Error result. [ok()](#t:ok/0) An Ok result. [t()](#t:t/0) An Result Tuple. [Functions](#functions) ------------------------ [and\_err(first\_result, second\_result)](#and_err/2) Do an `and` with a [`err/0`](#t:err/0). [and\_ok(first\_result, second\_result)](#and_ok/2) Do an `and` with a [`ok/0`](#t:ok/0). [collect(result\_list)](#collect/1) Iterate over [`t/0`](#t:t/0) list unwrapping the [`ok/0`](#t:ok/0) values. It fails at the first [`err/0`](#t:err/0). [contains\_err?(arg, value)](#contains_err?/2) Returns true if the [`err/0`](#t:err/0) result contains the given value. [contains\_ok?(arg, value)](#contains_ok?/2) Returns true if the [`ok/0`](#t:ok/0) result contains the given value. [err(reason)](#err/1) Wraps a value into an [`err/0`](#t:err/0) result. [expect\_err!(arg, message)](#expect_err!/2) Returns the contained [`ok/0`](#t:ok/0) value, or raise an exception with the given error message. [expect\_ok!(arg, message)](#expect_ok!/2) Returns the contained [`ok/0`](#t:ok/0) value, or raise an exception with the given error message. [flatten(value)](#flatten/1) Converts from a nested [`t/0`](#t:t/0) to flatten [`t/0`](#t:t/0). [is\_err?(arg)](#is_err?/1) Returns true if the argument is an [`err/0`](#t:err/0). [is\_err\_and?(arg, func)](#is_err_and?/2) Returns true if the result is [`err/0`](#t:err/0) and the value inside of it matches a predicate. [is\_err\_result(val)](#is_err_result/1) Is valid if and only if an [`err/0`](#t:err/0) is supplied. [is\_ok?(arg)](#is_ok?/1) Returns true if the argument is a [`ok/0`](#t:ok/0). [is\_ok\_and?(arg, func)](#is_ok_and?/2) Returns true if the result is [`ok/0`](#t:ok/0) and the value inside of it matches a predicate. [is\_ok\_result(val)](#is_ok_result/1) Is valid if and only if an [`ok/0`](#t:ok/0) is supplied. [map\_err(result, on\_error)](#map_err/2) When the value contained in an [`err/0`](#t:err/0) result then applies a function or returns the mapped value, wrapping the returning value in a [`err/0`](#t:err/0), propagating the [`ok/0`](#t:ok/0) result as it is. [map\_ok(error, on\_ok)](#map_ok/2) When the value contained in an [`ok/0`](#t:ok/0) result then applies a function or returns the mapped value, wrapping the returning value in a [`ok/0`](#t:ok/0), propagating the [`err/0`](#t:err/0) result as it is. [map\_ok\_or(arg, on\_ok, on\_error)](#map_ok_or/3) Applies a `on_ok` function to the contained value if [`ok/0`](#t:ok/0) otherwise applies a `on_err` function or return the `on_err` value if [`err/0`](#t:err/0). [ok(value)](#ok/1) Wraps a value into an [`ok/0`](#t:ok/0) result. [reject\_nil(response, on\_nil)](#reject_nil/2) When `nil` is passed then calls the `on_nil` function and wrap the result into a [`err/0`](#t:err/0). When [`t/0`](#t:t/0) is passed then returns it as it is. Otherwise, wraps the value into a [`ok/0`](#t:ok/0). [tap\_err(result, func)](#tap_err/2) Tap into [`err/0`](#t:err/0) results. [tap\_ok(result, func)](#tap_ok/2) Tap into [`ok/0`](#t:ok/0) results. [unwrap(arg)](#unwrap/1) Returns the contained [`ok/0`](#t:ok/0) value or `t:error/0` value from a [`t/0`](#t:t/0). [unwrap\_err!(arg)](#unwrap_err!/1) Unwrap an [`err/0`](#t:err/0) result, or raise an exception. [unwrap\_ok(arg, on\_error)](#unwrap_ok/2) Returns the contained [`ok/0`](#t:ok/0) value or a provided default. [unwrap\_ok!(arg)](#unwrap_ok!/1) Unwrap an [`ok/0`](#t:ok/0) result, or raise an exception. [when\_err(resp, on\_err)](#when_err/2) Applies a function or returns the value if the result is [`err/0`](#t:err/0), otherwise returns the [`ok/0`](#t:ok/0) value. [when\_ok(error, on\_ok)](#when_ok/2) Applies a function or returns the value when a [`ok/0`](#t:ok/0) is given, or propagates the error. [Link to this section](#types) Types ===================================== [Link to this type](#t:err/0 "Link to this type") err() ===== [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L18 "View Source") ``` @type err() :: {:error, [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` An Error result. [Link to this type](#t:ok/0 "Link to this type") ok() ==== [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L13 "View Source") ``` @type ok() :: {:ok, [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` An Ok result. [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L23 "View Source") ``` @type t() :: [ok](#t:ok/0)() | [err](#t:err/0)() ``` An Result Tuple. [Link to this section](#functions) Functions ============================================= [Link to this function](#and_err/2 "Link to this function") and\_err(first\_result, second\_result) ======================================= [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L513 "View Source") ``` @spec and_err(first_result :: [t](#t:t/0)(), second_result :: [t](#t:t/0)()) :: [t](#t:t/0)() ``` Do an `and` with a [`err/0`](#t:err/0). When passing any [`ok/0`](#t:ok/0) result, it returns the first [`ok/0`](#t:ok/0) value. Otherwise, when passing two [`err/0`](#t:err/0) results, then returns the second [`err/0`](#t:err/0). ``` iex> 21 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.and\_err(OnePiece.Result.ok(42)) {:ok, 21} iex> 42 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.and\_err(OnePiece.Result.err("something went wrong")) {:ok, 42} iex> "something went wrong" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.and\_err(OnePiece.Result.ok(42)) {:ok, 42} iex> "something went wrong" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.and\_err(OnePiece.Result.err("late error")) {:error, "late error"} ``` [Link to this function](#and_ok/2 "Link to this function") and\_ok(first\_result, second\_result) ====================================== [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L330 "View Source") ``` @spec and_ok(first_result :: [t](#t:t/0)(), second_result :: [t](#t:t/0)()) :: [t](#t:t/0)() ``` Do an `and` with a [`ok/0`](#t:ok/0). When passing two [`ok/0`](#t:ok/0) result, it returns the second [`ok/0`](#t:ok/0) value. When a [`ok/0`](#t:ok/0) and a [`err/0`](#t:err/0) result, then returns the [`err/0`](#t:err/0). Otherwise, when passing two [`err/0`](#t:err/0) result, it returns the earliest [`err/0`](#t:err/0). ``` iex> 21 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.and\_ok(OnePiece.Result.ok(42)) {:ok, 42} iex> 21 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.and\_ok(OnePiece.Result.err("something went wrong")) {:error, "something went wrong"} iex> "something went wrong" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.and\_ok(OnePiece.Result.ok(42)) {:error, "something went wrong"} iex> "something went wrong" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.and\_ok(OnePiece.Result.err("late error")) {:error, "something went wrong"} ``` [Link to this function](#collect/1 "Link to this function") collect(result\_list) ===================== [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L662 "View Source") ``` @spec collect([Enum.t](https://hexdocs.pm/elixir/Enum.html#t:t/0)()) :: [t](#t:t/0)() ``` Iterate over [`t/0`](#t:t/0) list unwrapping the [`ok/0`](#t:ok/0) values. It fails at the first [`err/0`](#t:err/0). ``` iex> OnePiece.Result.collect([ ...> OnePiece.Result.ok(21), ...> OnePiece.Result.ok(42), ...> OnePiece.Result.ok(84), ...> ]) {:ok, [21,42,84]} iex> OnePiece.Result.collect([ ...> OnePiece.Result.ok(21), ...> OnePiece.Result.err("oops"), ...> OnePiece.Result.ok(84), ...> ]) {:error, "oops"} ``` [Link to this function](#contains_err?/2 "Link to this function") contains\_err?(arg, value) ========================== [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L205 "View Source") ``` @spec contains_err?(result :: [t](#t:t/0)(), value :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Returns true if the [`err/0`](#t:err/0) result contains the given value. ``` iex> "oops" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.contains\_err?("oops") true iex> "oops" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.contains\_err?("nop") false iex> 42 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.contains\_err?("ops") false ``` [Link to this function](#contains_ok?/2 "Link to this function") contains\_ok?(arg, value) ========================= [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L182 "View Source") ``` @spec contains_ok?(result :: [t](#t:t/0)(), value :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Returns true if the [`ok/0`](#t:ok/0) result contains the given value. ``` iex> 42 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.contains\_ok?(42) true iex> 21 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.contains\_ok?(42) false iex> "oops" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.contains\_ok?(42) false ``` [Link to this function](#err/1 "Link to this function") err(reason) =========== [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L41 "View Source") ``` @spec err(reason :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [err](#t:err/0)() ``` Wraps a value into an [`err/0`](#t:err/0) result. ``` iex> OnePiece.Result.err("oops") {:error, "oops"} ``` [Link to this function](#expect_err!/2 "Link to this function") expect\_err!(arg, message) ========================== [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L565 "View Source") ``` @spec expect_err!(result :: [t](#t:t/0)(), message :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Returns the contained [`ok/0`](#t:ok/0) value, or raise an exception with the given error message. ``` iex> try do ...> 42 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.expect\_err!("expected a oops") ...> rescue ...> e -> e.message ...> end "expected a oops" iex> try do ...> "oops" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.expect\_err!("expected a oops") ...> rescue ...> \_ -> "was a unwrap failure" ...> end "oops" ``` [Link to this function](#expect_ok!/2 "Link to this function") expect\_ok!(arg, message) ========================= [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L415 "View Source") ``` @spec expect_ok!(result :: [t](#t:t/0)(), message :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Returns the contained [`ok/0`](#t:ok/0) value, or raise an exception with the given error message. ``` iex> try do ...> 21 ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.expect\_ok!("expected 42") ...> rescue ...> e -> e.message ...> end "expected 42" iex> try do ...> 42 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.expect\_ok!("expected 42") ...> rescue ...> \_ -> "was a unwrap failure" ...> end 42 ``` [Link to this function](#flatten/1 "Link to this function") flatten(value) ============== [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L642 "View Source") ``` @spec flatten(result :: [t](#t:t/0)()) :: [t](#t:t/0)() ``` Converts from a nested [`t/0`](#t:t/0) to flatten [`t/0`](#t:t/0). ``` iex> 42 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.flatten() {:ok, 42} iex> 42 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.flatten() {:error, {:ok, 42}} iex> "oops" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.flatten() {:error, "oops"} iex> "oops" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.flatten() {:error, {:error, "oops"}} ``` [Link to this function](#is_err?/1 "Link to this function") is\_err?(arg) ============= [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L93 "View Source") ``` @spec is_err?(value :: [t](#t:t/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Returns true if the argument is an [`err/0`](#t:err/0). ``` iex> 42 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.is\_err?() false iex> "oops" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.is\_err?() true ``` [Link to this function](#is_err_and?/2 "Link to this function") is\_err\_and?(arg, func) ======================== [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L112 "View Source") ``` @spec is_err_and?(value :: [t](#t:t/0)(), predicate :: ([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() -> [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)())) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Returns true if the result is [`err/0`](#t:err/0) and the value inside of it matches a predicate. ``` iex> is\_not\_found = fn err -> err == :not\_found end ...> 42 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.is\_err\_and?(is\_not\_found) false iex> is\_not\_found = fn err -> err == :not\_found end ...> :not\_found ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.is\_err\_and?(is\_not\_found) true ``` [Link to this macro](#is_err_result/1 "Link to this macro") is\_err\_result(val) ==================== [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L161 "View Source") (macro) ``` @spec is_err_result(value :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [Macro.t](https://hexdocs.pm/elixir/Macro.html#t:t/0)() ``` Is valid if and only if an [`err/0`](#t:err/0) is supplied. ``` iex> check = fn ...> val when OnePiece.Result.is\_err\_result(val) -> true ...> \_ -> false ...> end ...> 42 ...> |> OnePiece.Result.ok() ...> |> check.() false iex> check = fn ...> val when OnePiece.Result.is\_err\_result(val) -> true ...> \_ -> false ...> end ...> "oops" ...> |> OnePiece.Result.err() ...> |> check.() true ``` [Link to this function](#is_ok?/1 "Link to this function") is\_ok?(arg) ============ [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L57 "View Source") ``` @spec is_ok?(value :: [t](#t:t/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Returns true if the argument is a [`ok/0`](#t:ok/0). ``` iex> 42 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.is\_ok?() true iex> "oops" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.is\_ok?() false ``` [Link to this function](#is_ok_and?/2 "Link to this function") is\_ok\_and?(arg, func) ======================= [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L76 "View Source") ``` @spec is_ok_and?(value :: [t](#t:t/0)(), predicate :: ([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() -> [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)())) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Returns true if the result is [`ok/0`](#t:ok/0) and the value inside of it matches a predicate. ``` iex> is\_meaning\_of\_life = fn x -> x == 42 end ...> 42 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.is\_ok\_and?(is\_meaning\_of\_life) true iex> is\_meaning\_of\_life = fn x -> x == 42 end ...> "oops" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.is\_ok\_and?(is\_meaning\_of\_life) false ``` [Link to this macro](#is_ok_result/1 "Link to this macro") is\_ok\_result(val) =================== [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L137 "View Source") (macro) ``` @spec is_ok_result(value :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [Macro.t](https://hexdocs.pm/elixir/Macro.html#t:t/0)() ``` Is valid if and only if an [`ok/0`](#t:ok/0) is supplied. ``` iex> check = fn ...> val when OnePiece.Result.is\_ok\_result(val) -> true ...> \_ -> false ...> end ...> 42 ...> |> OnePiece.Result.ok() ...> |> check.() true iex> check = fn ...> val when OnePiece.Result.is\_ok\_result(val) -> true ...> \_ -> false ...> end ...> "oops" ...> |> OnePiece.Result.err() ...> |> check.() false ``` [Link to this function](#map_err/2 "Link to this function") map\_err(result, on\_error) =========================== [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L456 "View Source") ``` @spec map_err(result :: [t](#t:t/0)(), on_error :: ([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() -> [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) | [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [t](#t:t/0)() ``` When the value contained in an [`err/0`](#t:err/0) result then applies a function or returns the mapped value, wrapping the returning value in a [`err/0`](#t:err/0), propagating the [`ok/0`](#t:ok/0) result as it is. > #### Avoid Wrapping > > If you want to avoid the wrap then use [`OnePiece.Result.when_err/2`](#when_err/2) instead. > > ``` iex> 21 ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.map\_err("must be 42") {:error, "must be 42"} iex> 42 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.map\_err("must be 42") {:ok, 42} ``` You can also pass a function to achieve lazy evaluation: ``` iex> meaning\_of\_life = fn x -> "must be 42 instead of #{x}" end ...> 21 ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.map\_err(meaning\_of\_life) {:error, "must be 42 instead of 21"} ``` [Link to this function](#map_ok/2 "Link to this function") map\_ok(error, on\_ok) ====================== [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L235 "View Source") ``` @spec map_ok(result :: [t](#t:t/0)(), on_ok :: ([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() -> [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) | [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [t](#t:t/0)() ``` When the value contained in an [`ok/0`](#t:ok/0) result then applies a function or returns the mapped value, wrapping the returning value in a [`ok/0`](#t:ok/0), propagating the [`err/0`](#t:err/0) result as it is. > #### Avoid Wrapping > > If you want to avoid the wrap then use [`OnePiece.Result.when_ok/2`](#when_ok/2) instead. > > ``` iex> 21 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.map\_ok(42) {:ok, 42} iex> "oops" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.map\_ok(42) {:error, "oops"} ``` You can also pass a function to achieve lazy evaluation: ``` iex> meaning\_of\_life = fn x -> x \* 2 end ...> 21 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.map\_ok(meaning\_of\_life) {:ok, 42} ``` [Link to this function](#map_ok_or/3 "Link to this function") map\_ok\_or(arg, on\_ok, on\_error) =================================== [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L273 "View Source") ``` @spec map_ok_or( result :: [t](#t:t/0)(), on_ok :: ([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() -> [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()), on_error :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | ([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() -> [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) ) :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Applies a `on_ok` function to the contained value if [`ok/0`](#t:ok/0) otherwise applies a `on_err` function or return the `on_err` value if [`err/0`](#t:err/0). ``` iex> meaning\_of\_life = fn x -> x \* 2 end ...> 21 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.map\_ok\_or(meaning\_of\_life, 84) 42 iex> meaning\_of\_life = fn x -> x \* 2 end ...> "oops" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.map\_ok\_or(meaning\_of\_life, 84) 84 ``` > #### Lazy Evaluation > > It is recommended to pass a function as the default value, which is lazily evaluated. > > ``` iex> meaning\_of\_life = fn x -> x \* 2 end ...> went\_wrong = fn reason -> "something went wrong because #{reason}" end ...> 21 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.map\_ok\_or(meaning\_of\_life, went\_wrong) 42 iex> meaning\_of\_life = fn x -> x \* 2 end ...> went\_wrong = fn reason -> "something went wrong because #{reason}" end ...> "a sleepy bear" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.map\_ok\_or(meaning\_of\_life, went\_wrong) "something went wrong because a sleepy bear" ``` [Link to this function](#ok/1 "Link to this function") ok(value) ========= [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L32 "View Source") ``` @spec ok(value :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [ok](#t:ok/0)() ``` Wraps a value into an [`ok/0`](#t:ok/0) result. ``` iex> OnePiece.Result.ok(42) {:ok, 42} ``` [Link to this function](#reject_nil/2 "Link to this function") reject\_nil(response, on\_nil) ============================== [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L608 "View Source") ``` @spec reject_nil(value :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), on_nil :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | (() -> [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)())) :: [t](#t:t/0)() ``` When `nil` is passed then calls the `on_nil` function and wrap the result into a [`err/0`](#t:err/0). When [`t/0`](#t:t/0) is passed then returns it as it is. Otherwise, wraps the value into a [`ok/0`](#t:ok/0). ``` iex> OnePiece.Result.reject\_nil(nil, "ooopps") {:error, "ooopps"} iex> OnePiece.Result.reject\_nil(42, "ooopps") {:ok, 42} iex> 42 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.reject\_nil("ooopps") {:ok, 42} iex> "my error" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.reject\_nil("ooopps") {:error, "my error"} ``` > #### Lazy Evaluation > > It is recommended to pass a function as the default value, which is lazily evaluated. > > ``` iex> new\_error = fn -> "ooops" end ...> OnePiece.Result.reject\_nil(nil, new\_error) {:error, "ooops"} ``` [Link to this function](#tap_err/2 "Link to this function") tap\_err(result, func) ====================== [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L578 "View Source") ``` @spec tap_err(result :: [t](#t:t/0)(), func :: ([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() -> [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)())) :: [t](#t:t/0)() ``` Tap into [`err/0`](#t:err/0) results. ``` iex> failure\_log = fn err -> "Failure because #{err}" end ...> "ooopsy" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.tap\_err(failure\_log) {:error, "ooopsy"} ``` [Link to this function](#tap_ok/2 "Link to this function") tap\_ok(result, func) ===================== [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L428 "View Source") ``` @spec tap_ok(result :: [t](#t:t/0)(), func :: ([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() -> [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)())) :: [t](#t:t/0)() ``` Tap into [`ok/0`](#t:ok/0) results. ``` iex> success\_log = fn x -> "Success #{x}" end ...> 42 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.tap\_ok(success\_log) {:ok, 42} ``` [Link to this function](#unwrap/1 "Link to this function") unwrap(arg) =========== [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L685 "View Source") ``` @spec unwrap(result :: [t](#t:t/0)()) :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Returns the contained [`ok/0`](#t:ok/0) value or `t:error/0` value from a [`t/0`](#t:t/0). ``` iex> 42 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.unwrap() 42 iex> "oops" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.unwrap() "oops" ``` [Link to this function](#unwrap_err!/1 "Link to this function") unwrap\_err!(arg) ================= [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L540 "View Source") ``` @spec unwrap_err!(result :: [t](#t:t/0)()) :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Unwrap an [`err/0`](#t:err/0) result, or raise an exception. ``` iex> try do ...> "oops" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.unwrap\_err!() ...> rescue ...> OnePiece.Result.ErrUnwrapError -> "was a unwrap failure" ...> end "oops" iex> try do ...> 42 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.unwrap\_err!() ...> rescue ...> OnePiece.Result.ErrUnwrapError -> "was a unwrap failure" ...> end "was a unwrap failure" ``` [Link to this function](#unwrap_ok/2 "Link to this function") unwrap\_ok(arg, on\_error) ========================== [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L364 "View Source") ``` @spec unwrap_ok(result :: [t](#t:t/0)(), on_error :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | ([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() -> [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)())) :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Returns the contained [`ok/0`](#t:ok/0) value or a provided default. ``` iex> 42 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.unwrap\_ok(21) 42 iex> "oops" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.unwrap\_ok(21) 21 ``` > #### Lazy Evaluation > > It is recommended to pass a function as the default value, which is lazily evaluated. > > ``` iex> say\_hello\_world = fn \_x -> "hello, world!" end ...> 42 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.unwrap\_ok(say\_hello\_world) 42 iex> say\_hello\_world = fn \_x -> "hello, world!" end ...> "oops" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.unwrap\_ok(say\_hello\_world) "hello, world!" ``` [Link to this function](#unwrap_ok!/1 "Link to this function") unwrap\_ok!(arg) ================ [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L390 "View Source") ``` @spec unwrap_ok!(result :: [t](#t:t/0)()) :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Unwrap an [`ok/0`](#t:ok/0) result, or raise an exception. ``` iex> try do ...> 42 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.unwrap\_ok!() ...> rescue ...> OnePiece.Result.OkUnwrapError -> "was a unwrap failure" ...> end 42 iex> try do ...> "oops" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.unwrap\_ok!() ...> rescue ...> OnePiece.Result.OkUnwrapError -> "was a unwrap failure" ...> end "was a unwrap failure" ``` [Link to this function](#when_err/2 "Link to this function") when\_err(resp, on\_err) ======================== [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L482 "View Source") ``` @spec when_err(result :: [t](#t:t/0)(), on_err :: ([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() -> [t](#t:t/0)()) | [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [ok](#t:ok/0)() | [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Applies a function or returns the value if the result is [`err/0`](#t:err/0), otherwise returns the [`ok/0`](#t:ok/0) value. ``` iex> "something wrong happened" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.when\_err("ooops") "ooops" iex> 2 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.when\_err("ooops") {:ok, 2} ``` You can also pass a function to achieve lazy evaluation: ``` iex> failure = fn \_error -> "lazy ooops" end ...> "something wrong happened" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.when\_err(failure) "lazy ooops" ``` [Link to this function](#when_ok/2 "Link to this function") when\_ok(error, on\_ok) ======================= [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/result.ex#L299 "View Source") ``` @spec when_ok(result :: [t](#t:t/0)(), on_ok :: ([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() -> [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) | [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [err](#t:err/0)() | [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Applies a function or returns the value when a [`ok/0`](#t:ok/0) is given, or propagates the error. ``` iex> 21 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.when\_ok(42) 42 iex> "oops" ...> |> OnePiece.Result.err() ...> |> OnePiece.Result.when\_ok(42) {:error, "oops"} ``` You can also pass a function to achieve lazy evaluation: ``` iex> meaning\_of\_life = fn x -> x \* 2 end ...> 21 ...> |> OnePiece.Result.ok() ...> |> OnePiece.Result.when\_ok(meaning\_of\_life) 42 ``` OnePiece.Result.ErrUnwrapError β€” OnePiece.Result v0.4.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/err_unwrap_error.ex#L1 "View Source") OnePiece.Result.ErrUnwrapError exception (OnePiece.Result v0.4.0) =================================================================================================================================================================================================================================================== Error raised when trying to unwrap an [`OnePiece.Result.err/0`](OnePiece.Result.html#t:err/0) result. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [message(e)](#message/1) Convert exception to string. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/err_unwrap_error.ex#L6 "View Source") ``` @type t() :: %OnePiece.Result.ErrUnwrapError{__exception__: true, value: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#message/1 "Link to this function") message(e) ========== [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/err_unwrap_error.ex#L14 "View Source") ``` @spec message(error :: [t](#t:t/0)()) :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Convert exception to string. OnePiece.Result.ExpectedError β€” OnePiece.Result v0.4.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/expected_error.ex#L1 "View Source") OnePiece.Result.ExpectedError exception (OnePiece.Result v0.4.0) ================================================================================================================================================================================================================================================ Error raised when trying to [`OnePiece.Result.expect_ok!/2`](OnePiece.Result.html#expect_ok!/2) or [`OnePiece.Result.expect_err!/2`](OnePiece.Result.html#expect_err!/2). [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [message(exception)](#message/1) Convert exception to string. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/expected_error.ex#L6 "View Source") ``` @type t() :: %OnePiece.Result.ExpectedError{ __exception__: true, message: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), value: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#message/1 "Link to this function") message(exception) ================== [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/expected_error.ex#L14 "View Source") ``` @spec message(error :: [t](#t:t/0)()) :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Convert exception to string. OnePiece.Result.OkUnwrapError β€” OnePiece.Result v0.4.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/ok_unwrap_error.ex#L1 "View Source") OnePiece.Result.OkUnwrapError exception (OnePiece.Result v0.4.0) ================================================================================================================================================================================================================================================= Error raised when trying to unwrap an [`OnePiece.Result.ok/0`](OnePiece.Result.html#t:ok/0) result. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [message(e)](#message/1) Convert exception to string. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/ok_unwrap_error.ex#L6 "View Source") ``` @type t() :: %OnePiece.Result.OkUnwrapError{__exception__: true, reason: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#message/1 "Link to this function") message(e) ========== [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/lib/one_piece/ok_unwrap_error.ex#L14 "View Source") ``` @spec message(error :: [t](#t:t/0)()) :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Convert exception to string. OnePiece.Result β€” OnePiece.Result v0.4.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/straw-hat-team/beam-monorepo/blob/one_piece_result@v0.4.0/apps/one_piece_result/README.md#L1 "View Source") OnePiece.Result ========================================================================================================================================================================= [![Hex.pm](https://img.shields.io/hexpm/v/one_piece_result.svg)](https://hex.pm/packages/one_piece_result) [![Code Coverage](https://codecov.io/gh/straw-hat-team/one_piece_result/branch/master/graph/badge.svg)](https://codecov.io/gh/straw-hat-team/one_piece_result) Handles [`OnePiece.Result.t/0`](OnePiece.Result.html#t:t/0) responses. Inspired by Rust `std::result::Result` package. [documentation](#documentation) Documentation ----------------------------------------------- ### [references](#references) References * [API Reference](api-reference.html) [← Previous Page API Reference](api-reference.html) [Next Page β†’ Changelog](changelog.html)
hammer_backend_redis
hex
Hammer.Backend.Redis β€” hammer\_backend\_redis v6.1.2 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/ExHammer/hammer-backend-redis/blob/v6.1.2/lib/hammer_backend_redis.ex#L1 "View Source") Hammer.Backend.Redis (hammer\_backend\_redis v6.1.2) ========================================================================================================================================================================================== Documentation for Hammer.Backend.Redis This backend uses the [Redix](https://hex.pm/packages/redix) library to connect to Redis. The backend process is started by calling `start_link`: ``` Hammer.Backend.Redis.start\_link( expiry\_ms: 60\_000 \* 10, redix\_config: [host: "example.com", port: 5050] ) ``` Options are: * `expiry_ms`: Expiry time of buckets in milliseconds, used to set TTL on Redis keys. This configuration is mandatory. * `redix_config`: Keyword list of options to the [`Redix`](https://hexdocs.pm/redix/1.2.0/Redix.html) redis client, also aliased to `redis_config` * `redis_url`: String url of redis server to connect to (optional, invokes Redix.start\_link/2) [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [bucket\_info()](#t:bucket_info/0) [bucket\_key()](#t:bucket_key/0) [Functions](#functions) ------------------------ [child\_spec(init\_arg)](#child_spec/1) Returns a specification to start this module under a supervisor. [count\_hit(pid, key, now)](#count_hit/3) Record a hit in the bucket identified by `key` [count\_hit(pid, key, now, increment)](#count_hit/4) Record a hit in the bucket identified by `key`, with a custom increment [delete\_buckets(pid, id)](#delete_buckets/2) Delete all buckets associated with `id`. [get\_bucket(pid, key)](#get_bucket/2) Retrieve information about the bucket identified by `key` [start()](#start/0) [start(args)](#start/1) [start\_link()](#start_link/0) [start\_link(args)](#start_link/1) [stop()](#stop/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:bucket_info/0 "Link to this type") bucket\_info() ============== [View Source](https://github.com/ExHammer/hammer-backend-redis/blob/v6.1.2/lib/hammer_backend_redis.ex#L29 "View Source") ``` @type bucket_info() :: {key :: [bucket\_key](#t:bucket_key/0)(), count :: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), created :: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), updated :: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` [Link to this type](#t:bucket_key/0 "Link to this type") bucket\_key() ============= [View Source](https://github.com/ExHammer/hammer-backend-redis/blob/v6.1.2/lib/hammer_backend_redis.ex#L28 "View Source") ``` @type bucket_key() :: {bucket :: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), id :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#child_spec/1 "Link to this function") child\_spec(init\_arg) ====================== [View Source](https://github.com/ExHammer/hammer-backend-redis/blob/v6.1.2/lib/hammer_backend_redis.ex#L26 "View Source") Returns a specification to start this module under a supervisor. See [`Supervisor`](https://hexdocs.pm/elixir/Supervisor.html). [Link to this function](#count_hit/3 "Link to this function") count\_hit(pid, key, now) ========================= [View Source](https://github.com/ExHammer/hammer-backend-redis/blob/v6.1.2/lib/hammer_backend_redis.ex#L62 "View Source") Record a hit in the bucket identified by `key` [Link to this function](#count_hit/4 "Link to this function") count\_hit(pid, key, now, increment) ==================================== [View Source](https://github.com/ExHammer/hammer-backend-redis/blob/v6.1.2/lib/hammer_backend_redis.ex#L70 "View Source") Record a hit in the bucket identified by `key`, with a custom increment [Link to this function](#delete_buckets/2 "Link to this function") delete\_buckets(pid, id) ======================== [View Source](https://github.com/ExHammer/hammer-backend-redis/blob/v6.1.2/lib/hammer_backend_redis.ex#L86 "View Source") Delete all buckets associated with `id`. [Link to this function](#get_bucket/2 "Link to this function") get\_bucket(pid, key) ===================== [View Source](https://github.com/ExHammer/hammer-backend-redis/blob/v6.1.2/lib/hammer_backend_redis.ex#L78 "View Source") Retrieve information about the bucket identified by `key` [Link to this function](#start/0 "Link to this function") start() ======= [View Source](https://github.com/ExHammer/hammer-backend-redis/blob/v6.1.2/lib/hammer_backend_redis.ex#L34 "View Source") ``` @spec start() :: :ignore | {:error, [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} | {:ok, [pid](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` [Link to this function](#start/1 "Link to this function") start(args) =========== [View Source](https://github.com/ExHammer/hammer-backend-redis/blob/v6.1.2/lib/hammer_backend_redis.ex#L39 "View Source") ``` @spec start([keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: :ignore | {:error, [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} | {:ok, [pid](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` [Link to this function](#start_link/0 "Link to this function") start\_link() ============= [View Source](https://github.com/ExHammer/hammer-backend-redis/blob/v6.1.2/lib/hammer_backend_redis.ex#L44 "View Source") ``` @spec start_link() :: :ignore | {:error, [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} | {:ok, [pid](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` [Link to this function](#start_link/1 "Link to this function") start\_link(args) ================= [View Source](https://github.com/ExHammer/hammer-backend-redis/blob/v6.1.2/lib/hammer_backend_redis.ex#L49 "View Source") ``` @spec start_link([keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: :ignore | {:error, [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} | {:ok, [pid](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` [Link to this function](#stop/0 "Link to this function") stop() ====== [View Source](https://github.com/ExHammer/hammer-backend-redis/blob/v6.1.2/lib/hammer_backend_redis.ex#L54 "View Source") ``` @spec stop() :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Overview β€” hammer\_backend\_redis v6.1.2 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/ExHammer/hammer-backend-redis/blob/v6.1.2/guides/Overview.md#L1 "View Source") Overview ===================================================================================================================================== A Redis backend for the Hammer rate-limiter [Hammer](https://github.com/ExHammer/hammer) is a rate-limiter for the [Elixir](https://elixir-lang.org/) language. It's killer feature is a pluggable backend system, allowing you to use whichever storage suits your needs. This package provides a Redis backend for Hammer, using the [Redix](https://github.com/whatyouhide/redix) library to connect to the Redis server. To get started, read the [Hammer Tutorial](https://hexdocs.pm/hammer/tutorial.html) first, then add the `hammer_backend_redis` dependency: ``` def deps do [{:hammer\_backend\_redis, "~> 6.1"}, {:hammer, "~> 6.0"}] end ``` ... then configure the `:hammer` application to use the Redis backend: ``` config :hammer, backend: {Hammer.Backend.Redis, [expiry\_ms: 60\_000 \* 60 \* 2, redix\_config: [host: "some.host"]]} ``` (the `redix_config` arg is a keyword-list which is passed to Redix, it's also aliased to `redis_config`, with an `s`) And that's it, calls to [`Hammer.check_rate/3`](https://hexdocs.pm/hammer/6.1.0/Hammer.html#check_rate/3) and so on will use Redis to store the rate-limit counters. [← Previous Page API Reference](api-reference.html) [Next Page β†’ Changelog](changelog.html)
buffy
hex
Buffy β€” Buffy v2.0.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/stordco/buffy/blob/main/README.md#L1 "View Source") Buffy ======================================================================================================= Buffy is a small library of Elixir modules to assist in throttling and debouncing function calling. [Roadmap](#roadmap) -------------------- * [ ] Allow limiting concurrency of running tasks * [ ] Create a debounce module * [X] Telemetry instrumentation [Installation](#installation) ------------------------------ Just add [`buffy`](https://hex.pm/packages/buffy) to your `mix.exs` file like so: ``` def deps do [ {:buffy, "~> 2.0.0"} ] end ``` [Published Documentation](#published-documentation) ---------------------------------------------------- Documentation is automatically generated and published to [HexDocs](https://hexdocs.pm/buffy/readme.html) on new releases. [← Previous Page API Reference](api-reference.html) [Next Page β†’ Changelog](changelog.html) document.addEventListener("DOMContentLoaded", function () { mermaid.initialize({ startOnLoad: false }); let id = 0; for (const codeEl of document.querySelectorAll("pre code.mermaid")) { const preEl = codeEl.parentElement; const graphDefinition = codeEl.textContent; const graphEl = document.createElement("div"); const graphId = "mermaid-graph-" + id++; mermaid.render(graphId, graphDefinition, function (svgSource, bindListeners) { graphEl.innerHTML = svgSource; bindListeners && bindListeners(graphEl); preEl.insertAdjacentElement("afterend", graphEl); preEl.remove(); }); } }); Buffy β€” Buffy v2.0.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/stordco/buffy/blob/main/lib/buffy.ex#L1 "View Source") Buffy (Buffy v2.0.0) ========================================================================================================================= Buffy is broken down into different modules depending on how you want to handle your function calling. [Throttle](#module-throttle) ----------------------------- The [`Buffy.Throttle`](Buffy.Throttle.html) module will wait for a specified amount of time before invoking the function. If the function is called again before the time has elapsed, it's a no-op. Once the timer has expired, the function will be called, and any subsequent calls will start a new timer. ``` call call call call call | call | call | call | call | | | | | | | | | | β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Timer 1 β”‚ β”‚ Timer 2 β”‚ β”‚ Timer 3 β”‚ β”‚ Timer 4 β”‚ └─────────| β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ | | | | | | | Forth function invocation | | Third function invocation | Second function invocation First function invocation ``` document.addEventListener("DOMContentLoaded", function () { mermaid.initialize({ startOnLoad: false }); let id = 0; for (const codeEl of document.querySelectorAll("pre code.mermaid")) { const preEl = codeEl.parentElement; const graphDefinition = codeEl.textContent; const graphEl = document.createElement("div"); const graphId = "mermaid-graph-" + id++; mermaid.render(graphId, graphDefinition, function (svgSource, bindListeners) { graphEl.innerHTML = svgSource; bindListeners && bindListeners(graphEl); preEl.insertAdjacentElement("afterend", graphEl); preEl.remove(); }); } }); Buffy.Application β€” Buffy v2.0.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/stordco/buffy/blob/main/lib/buffy/application.ex#L1 "View Source") Buffy.Application (Buffy v2.0.0) ================================================================================================================================================= The Buffy supervisor responsible for starting the default [`Registry`](https://hexdocs.pm/elixir/Registry.html) and [`DynamicSupervisor`](https://hexdocs.pm/elixir/DynamicSupervisor.html). document.addEventListener("DOMContentLoaded", function () { mermaid.initialize({ startOnLoad: false }); let id = 0; for (const codeEl of document.querySelectorAll("pre code.mermaid")) { const preEl = codeEl.parentElement; const graphDefinition = codeEl.textContent; const graphEl = document.createElement("div"); const graphId = "mermaid-graph-" + id++; mermaid.render(graphId, graphDefinition, function (svgSource, bindListeners) { graphEl.innerHTML = svgSource; bindListeners && bindListeners(graphEl); preEl.insertAdjacentElement("afterend", graphEl); preEl.remove(); }); } }); Buffy.Throttle β€” Buffy v2.0.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/stordco/buffy/blob/main/lib/buffy/throttle.ex#L1 "View Source") Buffy.Throttle behaviour (Buffy v2.0.0) ===================================================================================================================================================== The [`Buffy.Throttle`](Buffy.Throttle.html#content) module will wait for a specified amount of time before invoking the function. If the function is called again before the time has elapsed, it's a no-op. Once the timer has expired, the function will be called, and any subsequent calls will start a new timer. ``` call call call call call | call | call | call | call | | | | | | | | | | β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Timer 1 β”‚ β”‚ Timer 2 β”‚ β”‚ Timer 3 β”‚ β”‚ Timer 4 β”‚ └─────────| β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ | | | | | | | Forth function invocation | | Third function invocation | Second function invocation First function invocation ``` [Example Usage](#module-example-usage) --------------------------------------- You'll first need to create a module that will be used to throttle. ``` defmodule MyTask do use Buffy.Throttle, throttle: :timer.minutes(2) def handle\_throttle(args) do # Do something with args end end ``` Next, you can use the `throttle/1` function with the registered module. ``` iex> MyTask.throttle(args) :ok ``` [Options](#module-options) --------------------------- * `:registry_module` (`atom`) - Optional. A module that implements the [`Registry`](https://hexdocs.pm/elixir/Registry.html) behaviour. If you are running in a distributed instance, you can set this value to `Horde.Registry`. Defaults to [`Registry`](https://hexdocs.pm/elixir/Registry.html). * `:registry_name` (`atom`) - Optional. The name of the registry to use. Defaults to the built in Buffy registry, but if you are running in a distributed instance you can set this value to a named `Horde.Registry` process. Defaults to `Buffy.Registry`. * `:restart` (`:permanent` | `:temporary` | `:transient`) - Optional. The restart strategy to use for the GenServer. Defaults to `:temporary`. * `:supervisor_module` (`atom`) - Optional. A module that implements the [`DynamicSupervisor`](https://hexdocs.pm/elixir/DynamicSupervisor.html) behaviour. If you are running in a distributed instance, you can set this value to `Horde.DynamicSupervisor`. Defaults to [`DynamicSupervisor`](https://hexdocs.pm/elixir/DynamicSupervisor.html). * `:supervisor_name` (`atom`) - Optional. The name of the dynamic supervisor to use. Defaults to the built in Buffy dynamic supervisor, but if you are running in a distributed instance you can set this value to a named `Horde.DynamicSupervisor` process. Defaults to `Buffy.DynamicSupervisor`. * :throttle (`non_neg_integer`) - Required. The amount of time to wait before invoking the function. This value is in milliseconds. [Using with Horde](#module-using-with-horde) --------------------------------------------- If you are running Elixir in a cluster, you can utilize `Horde` to only run one of your throttled functions at a time. To do this, you'll need to set the `:registry_module` and `:supervisor_module` options to `Horde.Registry` and `Horde.DynamicSupervisor` respectively. You'll also need to set the `:registry_name` and `:supervisor_name` options to the name of the Horde registry and dynamic supervisor you want to use. ``` defmodule MyThrottler do use Buffy.Throttle, registry\_module: Horde.Registry, registry\_name: MyApp.HordeRegistry, supervisor\_module: Horde.DynamicSupervisor, supervisor\_name: MyApp.HordeDynamicSupervisor, throttle: :timer.minutes(2) def handle\_throttle(args) do # Do something with args end end ``` [Telemetry](#module-telemetry) ------------------------------- These are the events that are called by the [`Buffy.Throttle`](Buffy.Throttle.html#content) module: * `[:buffy, :throttle, :throttle]` - Emitted when the `throttle/1` function is called. * `[:buffy, :throttle, :handle, :start]` - Emitted at the start of the `handle_throttle/1` function. * `[:buffy, :throttle, :handle, :stop]` - Emitted at the end of the `handle_throttle/1` function. * `[:buffy, :throttle, :handle, :exception]` - Emitted when an error is raised in the `handle_throttle/1` function. All of these events will have the following metadata: * `:args` - The arguments passed to the `throttle/1` function. * `:key` - A hash of the passed arguments used to deduplicate the throttled function. * `:module` - The module using [`Buffy.Throttle`](Buffy.Throttle.html#content). With the additional metadata for `[:buffy, :throttle, :handle, :stop]`: * `:result` - The return value of the `handle_throttle/1` function. [Summary](#summary) ==================== [Types](#types) ---------------- [args()](#t:args/0) A list of arbitrary arguments that are used for the [`handle_throttle/1`](#c:handle_throttle/1) function. [key()](#t:key/0) A unique key for debouncing. This is used for GenServer uniqueness and is generated from hashing all of the args. [state()](#t:state/0) Internal state that [`Buffy.Throttle`](Buffy.Throttle.html#content) keeps. [Callbacks](#callbacks) ------------------------ [handle\_throttle(args)](#c:handle_throttle/1) The function called after the throttle has completed. This function will receive the arguments passed to the `throttle/1` function. [throttle(args)](#c:throttle/1) A function to call the throttle. This will always return a tuple of `{:ok, pid()}` and wait the configured `throttle` time before calling the [`handle_throttle/1`](#c:handle_throttle/1) function. [Types](#types) ================ [Link to this type](#t:args/0 "Link to this type") args() ====== [View Source](https://github.com/stordco/buffy/blob/main/lib/buffy/throttle.ex#L96 "View Source") ``` @type args() :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` A list of arbitrary arguments that are used for the [`handle_throttle/1`](#c:handle_throttle/1) function. [Link to this type](#t:key/0 "Link to this type") key() ===== [View Source](https://github.com/stordco/buffy/blob/main/lib/buffy/throttle.ex#L102 "View Source") ``` @type key() :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` A unique key for debouncing. This is used for GenServer uniqueness and is generated from hashing all of the args. [Link to this type](#t:state/0 "Link to this type") state() ======= [View Source](https://github.com/stordco/buffy/blob/main/lib/buffy/throttle.ex#L107 "View Source") ``` @type state() :: {[key](#t:key/0)(), [args](#t:args/0)()} ``` Internal state that [`Buffy.Throttle`](Buffy.Throttle.html#content) keeps. [Callbacks](#callbacks) ======================== [Link to this callback](#c:handle_throttle/1 "Link to this callback") handle\_throttle(args) ====================== [View Source](https://github.com/stordco/buffy/blob/main/lib/buffy/throttle.ex#L120 "View Source") ``` @callback handle_throttle([args](#t:args/0)()) :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` The function called after the throttle has completed. This function will receive the arguments passed to the `throttle/1` function. [Link to this callback](#c:throttle/1 "Link to this callback") throttle(args) ============== [View Source](https://github.com/stordco/buffy/blob/main/lib/buffy/throttle.ex#L114 "View Source") ``` @callback throttle(args :: [args](#t:args/0)()) :: {:ok, [pid](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` A function to call the throttle. This will always return a tuple of `{:ok, pid()}` and wait the configured `throttle` time before calling the [`handle_throttle/1`](#c:handle_throttle/1) function. document.addEventListener("DOMContentLoaded", function () { mermaid.initialize({ startOnLoad: false }); let id = 0; for (const codeEl of document.querySelectorAll("pre code.mermaid")) { const preEl = codeEl.parentElement; const graphDefinition = codeEl.textContent; const graphEl = document.createElement("div"); const graphId = "mermaid-graph-" + id++; mermaid.render(graphId, graphDefinition, function (svgSource, bindListeners) { graphEl.innerHTML = svgSource; bindListeners && bindListeners(graphEl); preEl.insertAdjacentElement("afterend", graphEl); preEl.remove(); }); } });
exnumerator
hex
API Reference β€” exnumerator v1.8.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } exnumerator v1.8.0 API Reference ================================== Modules ---------- [Exnumerator](Exnumerator.html) [Exnumerator.AtomListEnum](Exnumerator.AtomListEnum.html) [Exnumerator.KeywordListEnum](Exnumerator.KeywordListEnum.html) [Exnumerator.StringListEnum](Exnumerator.StringListEnum.html) Exnumerator β€” exnumerator v1.8.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } exnumerator v1.8.0 Exnumerator =============================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [cast(values, term)](#cast/2) [dump(values, term)](#dump/2) [load(values, term)](#load/2) [Link to this section](#functions) Functions ============================================= [Link to this function](#cast/2 "Link to this function") cast(values, term) ================== [Link to this function](#dump/2 "Link to this function") dump(values, term) ================== [Link to this function](#load/2 "Link to this function") load(values, term) ================== Exnumerator.AtomListEnum β€” exnumerator v1.8.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } exnumerator v1.8.0 Exnumerator.AtomListEnum ============================================ [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [cast(values, term)](#cast/2) [dump(values, term)](#dump/2) [load(values, term)](#load/2) [Link to this section](#functions) Functions ============================================= [Link to this function](#cast/2 "Link to this function") cast(values, term) ================== [Link to this function](#dump/2 "Link to this function") dump(values, term) ================== [Link to this function](#load/2 "Link to this function") load(values, term) ================== Exnumerator.KeywordListEnum β€” exnumerator v1.8.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } exnumerator v1.8.0 Exnumerator.KeywordListEnum =============================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [cast(values, term)](#cast/2) [dump(values, term)](#dump/2) [load(values, term)](#load/2) [Link to this section](#functions) Functions ============================================= [Link to this function](#cast/2 "Link to this function") cast(values, term) ================== [Link to this function](#dump/2 "Link to this function") dump(values, term) ================== [Link to this function](#load/2 "Link to this function") load(values, term) ================== Exnumerator.StringListEnum β€” exnumerator v1.8.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } exnumerator v1.8.0 Exnumerator.StringListEnum ============================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [cast(values, term)](#cast/2) [dump(values, term)](#dump/2) [load(values, term)](#load/2) [Link to this section](#functions) Functions ============================================= [Link to this function](#cast/2 "Link to this function") cast(values, term) ================== [Link to this function](#dump/2 "Link to this function") dump(values, term) ================== [Link to this function](#load/2 "Link to this function") load(values, term) ==================
opentelemetry_phoenix
hex
OpentelemetryPhoenix β€” Opentelemetry Phoenix v1.1.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/open-telemetry/opentelemetry-erlang-contrib/blob/main/instrumentation/opentelemetry_phoenix/lib/opentelemetry_phoenix.ex#L1 "View Source") OpentelemetryPhoenix (Opentelemetry Phoenix v1.1.1) ============================================================================================================================================================================================================================================ OpentelemetryPhoenix uses [telemetry](https://hexdocs.pm/telemetry/) handlers to create [`OpenTelemetry`](https://hexdocs.pm/opentelemetry_api/1.1.1/OpenTelemetry.html) spans. Current events which are supported include endpoint start/stop, router start/stop, and router exceptions. ### [supported-options](#module-supported-options) Supported options * `:endpoint_prefix` (list of [`atom/0`](https://hexdocs.pm/elixir/typespecs.html#basic-types)) - The endpoint prefix in your endpoint. The default value is `[:phoenix, :endpoint]`. * `:adapter` - The phoenix server adapter being used. The default value is `nil`. If you are using PlugCowboy as your adapter you can add `:opentelemetry_cowboy` to your project and pass the `:adapter` option when calling setup. Setting this option will prevent a new span from being started and the existing cowboy span to be continued. This is the recommended setup for measuring accurate latencies. `Bandit.PhoenixAdapter` is not currently supported. [usage](#module-usage) Usage ------------------------------ In your application start: ``` def start(\_type, \_args) do :opentelemetry\_cowboy.setup() OpentelemetryPhoenix.setup(adapter: :cowboy2) children = [ {Phoenix.PubSub, name: MyApp.PubSub}, MyAppWeb.Endpoint ] opts = [strategy: :one\_for\_one, name: MyStore.Supervisor] Supervisor.start\_link(children, opts) end ``` [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [adapter()](#t:adapter/0) The phoenix server adapter being used. Optional [endpoint\_prefix()](#t:endpoint_prefix/0) The endpoint prefix in your endpoint. Defaults to `[:phoenix, :endpoint]` [opts()](#t:opts/0) Setup options [Functions](#functions) ------------------------ [setup(opts \\ [])](#setup/1) Initializes and configures the telemetry handlers. [Link to this section](#types) Types ===================================== [Link to this type](#t:adapter/0 "Link to this type") adapter() ========= [View Source](https://github.com/open-telemetry/opentelemetry-erlang-contrib/blob/main/instrumentation/opentelemetry_phoenix/lib/opentelemetry_phoenix.ex#L67 "View Source") ``` @type adapter() :: {:adapter, :cowboy2 | [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` The phoenix server adapter being used. Optional [Link to this type](#t:endpoint_prefix/0 "Link to this type") endpoint\_prefix() ================== [View Source](https://github.com/open-telemetry/opentelemetry-erlang-contrib/blob/main/instrumentation/opentelemetry_phoenix/lib/opentelemetry_phoenix.ex#L64 "View Source") ``` @type endpoint_prefix() :: {:endpoint_prefix, [[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()]} ``` The endpoint prefix in your endpoint. Defaults to `[:phoenix, :endpoint]` [Link to this type](#t:opts/0 "Link to this type") opts() ====== [View Source](https://github.com/open-telemetry/opentelemetry-erlang-contrib/blob/main/instrumentation/opentelemetry_phoenix/lib/opentelemetry_phoenix.ex#L61 "View Source") ``` @type opts() :: [[endpoint\_prefix](#t:endpoint_prefix/0)() | [adapter](#t:adapter/0)()] ``` Setup options [Link to this section](#functions) Functions ============================================= [Link to this function](#setup/1 "Link to this function") setup(opts \\ []) ================= [View Source](https://github.com/open-telemetry/opentelemetry-erlang-contrib/blob/main/instrumentation/opentelemetry_phoenix/lib/opentelemetry_phoenix.ex#L73 "View Source") ``` @spec setup([opts](#t:opts/0)()) :: :ok ``` Initializes and configures the telemetry handlers. OpentelemetryPhoenix.Reason β€” Opentelemetry Phoenix v1.1.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/open-telemetry/opentelemetry-erlang-contrib/blob/main/instrumentation/opentelemetry_phoenix/lib/opentelemetry_phoenix/reason.ex#L1 "View Source") OpentelemetryPhoenix.Reason (Opentelemetry Phoenix v1.1.1) ========================================================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [normalize(other)](#normalize/1) [normalize(other, stacktrace)](#normalize/2) [Link to this section](#functions) Functions ============================================= [Link to this function](#normalize/1 "Link to this function") normalize(other) ================ [View Source](https://github.com/open-telemetry/opentelemetry-erlang-contrib/blob/main/instrumentation/opentelemetry_phoenix/lib/opentelemetry_phoenix/reason.ex#L2 "View Source") [Link to this function](#normalize/2 "Link to this function") normalize(other, stacktrace) ============================ [View Source](https://github.com/open-telemetry/opentelemetry-erlang-contrib/blob/main/instrumentation/opentelemetry_phoenix/lib/opentelemetry_phoenix/reason.ex#L80 "View Source") OpentelemetryPhoenix β€” Opentelemetry Phoenix v1.1.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/open-telemetry/opentelemetry-erlang-contrib/blob/main/instrumentation/opentelemetry_phoenix/README.md#L1 "View Source") OpentelemetryPhoenix ========================================================================================================================================================================================== [![EEF Observability WG project](https://img.shields.io/badge/EEF-Observability-black)](https://github.com/erlef/eef-observability-wg) [![Hex.pm](https://img.shields.io/hexpm/v/opentelemetry_phoenix)](https://hex.pm/packages/opentelemetry_phoenix) ![Build Status](https://github.com/opentelemetry-beam/opentelemetry_phoenix/workflows/Tests/badge.svg) Telemetry handler that creates Opentelemetry spans from Phoenix events. After installing, setup the handler in your application behaviour before your top-level supervisor starts. ``` OpentelemetryPhoenix.setup() ``` See the documentation for [`OpentelemetryPhoenix.setup/1`](OpentelemetryPhoenix.html#setup/1) for additional options that may be supplied. [installation](#installation) Installation -------------------------------------------- ``` def deps do [ {:opentelemetry\_phoenix, "~> 1.1"} ] end ``` [compatibility-matrix](#compatibility-matrix) Compatibility Matrix -------------------------------------------------------------------- | OpentelemetryPhoenix Version | Otel Version | Notes | | --- | --- | --- | | | | | | v0.1.0 | <= v.0.5.0 | | | v1.0.0-rc.3 | v1.0.0-rc.1 | | | | v1.0.0-rc.2 | | | v1.0.0-rc.4 | v1.0.0-rc.2 | Otel rc.3 will be a breaking change | | v1.0.0-rc.5 | v1.0.0-rc.3 | | | v1.0.0-rc.6 | v1.0.0-rc.4 | | | v1.0 | v1.0 | | [note-on-phoenix-integration](#note-on-phoenix-integration) Note on phoenix integration ----------------------------------------------------------------------------------------- [`OpentelemetryPhoenix`](OpentelemetryPhoenix.html) requires phoenix to use [`Plug.Telemetry`](https://hexdocs.pm/plug/1.14.0/Plug.Telemetry.html) in order to correctly trace endpoint calls. The `endpoint.ex` file should look like: ``` defmodule MyApp.Endpoint do use Phoenix.Endpoint, otp_app: :my_app ... plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint] ... end ``` The [Phoenix endpoint.ex template](https://github.com/phoenixframework/phoenix/blob/v1.6.0/installer/templates/phx_web/endpoint.ex#L39) can be used as a reference [← Previous Page API Reference](api-reference.html)
nerves_ssh
hex
NervesSSH β€” nerves\_ssh v0.4.3 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/README.md#L1 "View Source") NervesSSH ========================================================================================================================= [![CircleCI](https://circleci.com/gh/nerves-project/nerves_ssh/tree/main.svg?style=svg)](https://circleci.com/gh/nerves-project/nerves_ssh/tree/main) [![Hex version](https://img.shields.io/hexpm/v/nerves_ssh.svg "Hex version")](https://hex.pm/packages/nerves_ssh) Manage an SSH daemon and its subsystems on Nerves devices. It has the following features: 1. Automatic startup of the SSH daemon on initialization 2. Ability to hook the SSH daemon into a supervision tree of your choosing 3. Easy setup of SSH firmware updates for Nerves 4. Easy shell and exec setup for Erlang, Elixir, and LFE 5. Some protection from easy-to-make mistakes that would cause ssh to not be available [Usage](#usage) ---------------- This library wraps Erlang/OTP's [SSH daemon](http://erlang.org/doc/man/ssh.html#daemon-1) to make it easier to use reliably with Nerves devices. Most importantly, it makes it possible to segment failures in other OTP applications from terminating the daemon and it recovers from rare scenarios where the daemon terminates without automatically restarting. It can be started automatically as an OTP application or hooked into a supervision tree of your creation. Most Nerves users start it automatically as an OTP application. This is easy, but may be limiting and it requires that you use the application environment. See the following sections for options: ### [Starting as an OTP application](#starting-as-an-otp-application) If you're using [`:nerves_pack`](https://hex.pm/packages/nerves_pack) v0.4.0 or later, you don't need to do anything except verify the `:nerves_ssh` configuration in your `config.exs` (see below). If you are not using `:nerves_pack`, add `:nerves_ssh` to your `mix` dependency list: ``` def deps do [ {:nerves\_ssh, "~> 0.1.0", targets: @all\_targets} ] end ``` And then include it in `:shoehorn`'s `:init` list: ``` config :shoehorn, init: [:nerves\_runtime, :vintage\_net, :nerves\_ssh] ``` `:nerves_ssh` will work if you do not add it to the `:init` list. However, if your main OTP application stops, OTP may stop `:nerves_ssh`, and that would make your device inaccessible via SSH. ### [Starting as part of one of your supervision trees](#starting-as-part-of-one-of-your-supervision-trees) If you want to do this, make sure that you do NOT specify `:nerves_ssh` in your `config.exs`. The `:nerves_ssh` key decides whether or not to automatically launch based on this. Then when specifying the children for your supervisor, add [`NervesSSH`](NervesSSH.html) like this: ``` {NervesSSH, nerves\_ssh\_options} ``` The `nerves_ssh_options` should be a [`NervesSSH.Options`](NervesSSH.Options.html) struct. See the `Configuration` section option fields that you may specify. Calling `NervesSSH.Options.with_defaults(my_options_list)` to build the `nerves_ssh_options` value is one way of getting reasonable defaults. [Configuration](#configuration) -------------------------------- NervesSSH supports the following configuration items: * `:authorized_keys` - a list of SSH authorized key file string * `:user_passwords` - a list of username/password tuples (stored in the clear!) * `:port` - the TCP port to use for the SSH daemon. Defaults to `22`. * `:subsystems` - a list of [SSH subsystems specs](https://erlang.org/doc/man/ssh.html#type-subsystem_spec) to start. Defaults to SFTP and `ssh_subsystem_fwup` * `:system_dir` - where to find host keys. Defaults to `"/data/nerves_ssh"` * `:shell` - the language of the shell (`:elixir`, `:erlang`, `:lfe`, or `:disabled`). Defaults to `:elixir`. * `:exec` - the language to use for commands sent over ssh (`:elixir`, `:erlang`, `lfe`, or `:disabled`). Defaults to `:elixir`. * `:iex_opts` - additional options to use when starting up IEx * `:daemon_option_overrides` - additional options to pass to [`:ssh.daemon/2`](https://www.erlang.org/doc/man/ssh.html#daemon-2). These take precedence and are unchecked. Be careful using this since it can break other options. ### [SSH host keys](#ssh-host-keys) SSH identifies itself to clients using a host key. Clients can record the key and use it to detect man-in-the-middle attacks and other shenanigans on future connections. Host keys are stored in the `:system_dir` (see configuration) and named `ssh_host_rsa_key`, `ssh_host_ed25519_key`, etc. NervesSSH will create a host key the first time it starts if one does not exist. The key will be stored in `:system_dir`. Be aware that the host key is not encrypted or protected so anyone with access to the device can get it if they choose. If the `:system_dir` is not writable, NervesSSH will create an in-memory host key so that users can still log in. In fact, even if the file system is writable, NervesSSH will verify the host key before using it and recreate it if corrupt. The goal is that broken host keys to not result in a situation where it's impossible to log into a device. Your SSH client complaining about the host key changing will be the hint that something is wrong. NervesSSH currently supports [Ed25519](https://en.wikipedia.org/wiki/EdDSA#Ed25519) and [RSA](https://en.wikipedia.org/wiki/RSA_(cryptosystem)) host keys. If you rewrite your MicroSD cards often and don't want to get SSH client errors, add the following to your `~/.ssh/config`: ``` Host nerves.local UserKnownHostsFile /dev/null StrictHostKeyChecking no ``` [Authentication](#authentication) ---------------------------------- It's possible to set up a number of authentication strategies with the Erlang SSH daemon. Currently, only simple public key and username/password authentication setups are supported by `:nerves_ssh`. Both of them work fine for getting started. As needs become more sophisticated, you can pass options to `:daemon_option_overrides`. ### [Public key authentication](#public-key-authentication) Public ssh keys can be specified so that matching clients can connect. These come from files like your `~/.ssh/id_rsa.pub` or `~/.ssh/id_ecdsa.pub` that were created when you created your `ssh` keys. If you haven't done this, the following [article](https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/) may be helpful. Here's an example that uses the application config: ``` config :nerves\_ssh, authorized\_keys: [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDBCdMwNo0xOE86il0DB2Tq4RCv07XvnV7W1uQBlOOE0ZZVjxmTIOiu8XcSLy0mHj11qX5pQH3Th6Jmyqdj", "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCaf37TM8GfNKcoDjoewa6021zln4GvmOiXqW6SRpF61uNWZXurPte1u8frrJX1P/hGxCL7YN3cV6eZqRiF" ] ``` Here's another way that may work well for you that avoids needing to commit your keys: ``` config :nerves\_ssh, authorized\_keys: [ File.read!(Path.join(System.user\_home!, ".ssh/id\_rsa.pub")) ] ``` See [`NervesSSH.add_authorized_key/1`](NervesSSH.html#add_authorized_key/1) and [`NervesSSH.remove_authorized_key/1`](NervesSSH.html#remove_authorized_key/1) for managing public keys at runtime. ### [Username/password authentication](#username-password-authentication) The SSH console uses public key authentication by default, but it can be configured for usernames and passwords via the `:user_passwords` key. This has the form `[{"username", "password"}, ...]`. Keep in mind that passwords are stored in the clear. This is not recommended for most situations. ``` config :nerves\_ssh, user\_passwords: [ {"username", "password"} ] ``` You can use [`NervesSSH.add_user/2`](NervesSSH.html#add_user/2) and [`NervesSSH.remove_user/1`](NervesSSH.html#remove_user/1) for managing credentials at runtime, but they are not saved to disk so restarting [`NervesSSH`](NervesSSH.html) will cause them to be lost (such as a reboot or daemon crash) [Upgrade from `NervesFirmwareSSH`](#upgrade-from-nervesfirmwaressh) -------------------------------------------------------------------- If you are migrating from `:nerves_firmware_ssh`, or updating to `:nerves_pack >= 0.4.0`, you will need to make a few changes to your existing project. 1. Generate a `upload.sh` script by running [`mix firmware.gen.script`](https://hexdocs.pm/ssh_subsystem_fwup/0.6.1/Mix.Tasks.Firmware.Gen.Script.html) (if you don't already have one) * This is necessary because you will no longer have access to your old [`mix upload`](https://hexdocs.pm/ssh_subsystem_fwup/0.6.1/Mix.Tasks.Upload.html) command because `nerves_firmware_ssh` is being removed from the project. 2. Change all `:nerves_firmware_ssh` config values to `:nerves_ssh`. A command like this would probably do the trick: ``` grep -RIl nerves\_firmware\_ssh config/ | xargs sed -i 's/nerves\_firmware\_ssh/nerves\_ssh/g' ``` 3. Compile your new firmware that includes `:nerves_ssh` (or updated `:nerves_pack`) * **NOTE** Compiling your new firmware for the first time will generate a warning about the old `upload.sh` script still being around. You can ignore that **this one time** because you will need it for uploading to an existing device still using port 8989. 4. Upload your new firmware with `:nerves_ssh` using the ***old*** `upload.sh` script (or whatever other method you have been using for OTA firmware updates) 5. After the new firmware with `:nerves_ssh` is on the device, then you'll need to generate the new `upload.sh` script with [`mix firmware.gen.script`](https://hexdocs.pm/ssh_subsystem_fwup/0.6.1/Mix.Tasks.Firmware.Gen.Script.html), or see [SSHSubsystemFwup](https://hexdocs.pm/ssh_subsystem_fwup/readme.html) for other supported options [Goals](#goals) ---------------- * [X] Support public key authentication * [X] Support username/password authentication * [X] Device generated server certificate and key * [ ] Device generated username/password [← Previous Page API Reference](api-reference.html) [Next Page β†’ Changelog](changelog.html) NervesSSH β€” nerves\_ssh v0.4.3 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh.ex#L1 "View Source") NervesSSH (nerves\_ssh v0.4.3) ====================================================================================================================================================== This library wraps Erlang/OTP's [SSH daemon](http://erlang.org/doc/man/ssh.html#daemon-1) to make it easier to use reliably with Nerves devices. Most importantly, it makes it possible to segment failures in other OTP applications from terminating the daemon and it recovers from rare scenarios where the daemon terminates without automatically restarting. It can be started automatically as an OTP application or hooked into a supervision tree of your creation. Most Nerves users start it automatically as an OTP application. This is easy, but may be limiting and it requires that you use the application environment. See the following sections for options: ### [Starting as an OTP application](#module-starting-as-an-otp-application) If you're using [`:nerves_pack`](https://hex.pm/packages/nerves_pack) v0.4.0 or later, you don't need to do anything except verify the `:nerves_ssh` configuration in your `config.exs` (see below). If you are not using `:nerves_pack`, add `:nerves_ssh` to your `mix` dependency list: ``` def deps do [ {:nerves\_ssh, "~> 0.1.0", targets: @all\_targets} ] end ``` And then include it in `:shoehorn`'s `:init` list: ``` config :shoehorn, init: [:nerves\_runtime, :vintage\_net, :nerves\_ssh] ``` `:nerves_ssh` will work if you do not add it to the `:init` list. However, if your main OTP application stops, OTP may stop `:nerves_ssh`, and that would make your device inaccessible via SSH. ### [Starting as part of one of your supervision trees](#module-starting-as-part-of-one-of-your-supervision-trees) If you want to do this, make sure that you do NOT specify `:nerves_ssh` in your `config.exs`. The `:nerves_ssh` key decides whether or not to automatically launch based on this. Then when specifying the children for your supervisor, add [`NervesSSH`](NervesSSH.html#content) like this: ``` {NervesSSH, nerves\_ssh\_options} ``` The `nerves_ssh_options` should be a [`NervesSSH.Options`](NervesSSH.Options.html) struct. See the `Configuration` section option fields that you may specify. Calling `NervesSSH.Options.with_defaults(my_options_list)` to build the `nerves_ssh_options` value is one way of getting reasonable defaults. [Configuration](#module-configuration) --------------------------------------- NervesSSH supports the following configuration items: * `:authorized_keys` - a list of SSH authorized key file string * `:user_passwords` - a list of username/password tuples (stored in the clear!) * `:port` - the TCP port to use for the SSH daemon. Defaults to `22`. * `:subsystems` - a list of [SSH subsystems specs](https://erlang.org/doc/man/ssh.html#type-subsystem_spec) to start. Defaults to SFTP and `ssh_subsystem_fwup` * `:system_dir` - where to find host keys. Defaults to `"/data/nerves_ssh"` * `:shell` - the language of the shell (`:elixir`, `:erlang`, `:lfe`, or `:disabled`). Defaults to `:elixir`. * `:exec` - the language to use for commands sent over ssh (`:elixir`, `:erlang`, `lfe`, or `:disabled`). Defaults to `:elixir`. * `:iex_opts` - additional options to use when starting up IEx * `:daemon_option_overrides` - additional options to pass to [`:ssh.daemon/2`](https://www.erlang.org/doc/man/ssh.html#daemon-2). These take precedence and are unchecked. Be careful using this since it can break other options. ### [SSH host keys](#module-ssh-host-keys) SSH identifies itself to clients using a host key. Clients can record the key and use it to detect man-in-the-middle attacks and other shenanigans on future connections. Host keys are stored in the `:system_dir` (see configuration) and named `ssh_host_rsa_key`, `ssh_host_ed25519_key`, etc. NervesSSH will create a host key the first time it starts if one does not exist. The key will be stored in `:system_dir`. Be aware that the host key is not encrypted or protected so anyone with access to the device can get it if they choose. If the `:system_dir` is not writable, NervesSSH will create an in-memory host key so that users can still log in. In fact, even if the file system is writable, NervesSSH will verify the host key before using it and recreate it if corrupt. The goal is that broken host keys to not result in a situation where it's impossible to log into a device. Your SSH client complaining about the host key changing will be the hint that something is wrong. NervesSSH currently supports [Ed25519](https://en.wikipedia.org/wiki/EdDSA#Ed25519) and [RSA](https://en.wikipedia.org/wiki/RSA_(cryptosystem)) host keys. If you rewrite your MicroSD cards often and don't want to get SSH client errors, add the following to your `~/.ssh/config`: ``` Host nerves.local UserKnownHostsFile /dev/null StrictHostKeyChecking no ``` [Authentication](#module-authentication) ----------------------------------------- It's possible to set up a number of authentication strategies with the Erlang SSH daemon. Currently, only simple public key and username/password authentication setups are supported by `:nerves_ssh`. Both of them work fine for getting started. As needs become more sophisticated, you can pass options to `:daemon_option_overrides`. ### [Public key authentication](#module-public-key-authentication) Public ssh keys can be specified so that matching clients can connect. These come from files like your `~/.ssh/id_rsa.pub` or `~/.ssh/id_ecdsa.pub` that were created when you created your `ssh` keys. If you haven't done this, the following [article](https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/) may be helpful. Here's an example that uses the application config: ``` config :nerves\_ssh, authorized\_keys: [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDBCdMwNo0xOE86il0DB2Tq4RCv07XvnV7W1uQBlOOE0ZZVjxmTIOiu8XcSLy0mHj11qX5pQH3Th6Jmyqdj", "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCaf37TM8GfNKcoDjoewa6021zln4GvmOiXqW6SRpF61uNWZXurPte1u8frrJX1P/hGxCL7YN3cV6eZqRiF" ] ``` Here's another way that may work well for you that avoids needing to commit your keys: ``` config :nerves\_ssh, authorized\_keys: [ File.read!(Path.join(System.user\_home!, ".ssh/id\_rsa.pub")) ] ``` See [`NervesSSH.add_authorized_key/1`](#add_authorized_key/1) and [`NervesSSH.remove_authorized_key/1`](#remove_authorized_key/1) for managing public keys at runtime. ### [Username/password authentication](#module-username-password-authentication) The SSH console uses public key authentication by default, but it can be configured for usernames and passwords via the `:user_passwords` key. This has the form `[{"username", "password"}, ...]`. Keep in mind that passwords are stored in the clear. This is not recommended for most situations. ``` config :nerves\_ssh, user\_passwords: [ {"username", "password"} ] ``` You can use [`NervesSSH.add_user/2`](#add_user/2) and [`NervesSSH.remove_user/1`](#remove_user/1) for managing credentials at runtime, but they are not saved to disk so restarting [`NervesSSH`](NervesSSH.html#content) will cause them to be lost (such as a reboot or daemon crash) [Upgrade from `NervesFirmwareSSH`](#module-upgrade-from-nervesfirmwaressh) --------------------------------------------------------------------------- If you are migrating from `:nerves_firmware_ssh`, or updating to `:nerves_pack >= 0.4.0`, you will need to make a few changes to your existing project. 1. Generate a `upload.sh` script by running [`mix firmware.gen.script`](https://hexdocs.pm/ssh_subsystem_fwup/0.6.1/Mix.Tasks.Firmware.Gen.Script.html) (if you don't already have one) * This is necessary because you will no longer have access to your old [`mix upload`](https://hexdocs.pm/ssh_subsystem_fwup/0.6.1/Mix.Tasks.Upload.html) command because `nerves_firmware_ssh` is being removed from the project. 2. Change all `:nerves_firmware_ssh` config values to `:nerves_ssh`. A command like this would probably do the trick: ``` grep -RIl nerves\_firmware\_ssh config/ | xargs sed -i 's/nerves\_firmware\_ssh/nerves\_ssh/g' ``` 3. Compile your new firmware that includes `:nerves_ssh` (or updated `:nerves_pack`) * **NOTE** Compiling your new firmware for the first time will generate a warning about the old `upload.sh` script still being around. You can ignore that **this one time** because you will need it for uploading to an existing device still using port 8989. 4. Upload your new firmware with `:nerves_ssh` using the ***old*** `upload.sh` script (or whatever other method you have been using for OTA firmware updates) 5. After the new firmware with `:nerves_ssh` is on the device, then you'll need to generate the new `upload.sh` script with [`mix firmware.gen.script`](https://hexdocs.pm/ssh_subsystem_fwup/0.6.1/Mix.Tasks.Firmware.Gen.Script.html), or see [SSHSubsystemFwup](https://hexdocs.pm/ssh_subsystem_fwup/readme.html) for other supported options [Goals](#module-goals) ----------------------- * [X] Support public key authentication * [X] Support username/password authentication * [X] Device generated server certificate and key * [ ] Device generated username/password [Summary](#summary) ==================== [Functions](#functions) ------------------------ [add\_authorized\_key(name \\ NervesSSH, key)](#add_authorized_key/2) Add an SSH public key to the authorized keys [add\_user(name \\ NervesSSH, user, password)](#add_user/3) Add a user credential to the SSH daemon [child\_spec(init\_arg)](#child_spec/1) Returns a specification to start this module under a supervisor. [configuration(name \\ NervesSSH)](#configuration/1) Read the configuration options [info(name \\ NervesSSH)](#info/1) Return information on the running ssh daemon. [remove\_authorized\_key(name \\ NervesSSH, key)](#remove_authorized_key/2) Remove an SSH public key from the authorized keys [remove\_user(name \\ NervesSSH, user)](#remove_user/2) Remove a user credential from the SSH daemon [Functions](#functions) ======================== [Link to this function](#add_authorized_key/2 "Link to this function") add\_authorized\_key(name \\ NervesSSH, key) ============================================ [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh.ex#L67 "View Source") ``` @spec add_authorized_key([GenServer.name](https://hexdocs.pm/elixir/GenServer.html#t:name/0)(), [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) :: :ok ``` Add an SSH public key to the authorized keys This also persists the key to `{USER_DIR}/authorized_keys` so that it can be used after restarting. Call [`configuration/0`](#configuration/0) to get the current list of authorized keys. Example: ``` iex> NervesSSH.add\_authorized\_key("ssh-ed25519 AAAAC3NzaC...") ``` [Link to this function](#add_user/3 "Link to this function") add\_user(name \\ NervesSSH, user, password) ============================================ [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh.ex#L90 "View Source") ``` @spec add_user([GenServer.name](https://hexdocs.pm/elixir/GenServer.html#t:name/0)(), [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil) :: :ok ``` Add a user credential to the SSH daemon Setting password to `""` or `nil` will effectively be passwordless authentication for this user [Link to this function](#child_spec/1 "Link to this function") child\_spec(init\_arg) ====================== [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh.ex#L6 "View Source") Returns a specification to start this module under a supervisor. See [`Supervisor`](https://hexdocs.pm/elixir/Supervisor.html). [Link to this function](#configuration/1 "Link to this function") configuration(name \\ NervesSSH) ================================ [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh.ex#L38 "View Source") ``` @spec configuration([GenServer.name](https://hexdocs.pm/elixir/GenServer.html#t:name/0)()) :: [NervesSSH.Options.t](NervesSSH.Options.html#t:t/0)() ``` Read the configuration options [Link to this function](#info/1 "Link to this function") info(name \\ NervesSSH) ======================= [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh.ex#L48 "View Source") ``` @spec info([GenServer.name](https://hexdocs.pm/elixir/GenServer.html#t:name/0)()) :: {:ok, [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | {:error, :bad_daemon_ref} ``` Return information on the running ssh daemon. See [ssh.daemon\_info/1](http://erlang.org/doc/man/ssh.html#daemon_info-1). [Link to this function](#remove_authorized_key/2 "Link to this function") remove\_authorized\_key(name \\ NervesSSH, key) =============================================== [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh.ex#L79 "View Source") ``` @spec remove_authorized_key([GenServer.name](https://hexdocs.pm/elixir/GenServer.html#t:name/0)(), [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) :: :ok ``` Remove an SSH public key from the authorized keys This looks for an exact match. Call [`configuration/0`](#configuration/0) to get the list of authorized keys to find those to remove. The `{USER_DIR}/authorized_keys` will be updated to save the change. [Link to this function](#remove_user/2 "Link to this function") remove\_user(name \\ NervesSSH, user) ===================================== [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh.ex#L98 "View Source") ``` @spec remove_user([GenServer.name](https://hexdocs.pm/elixir/GenServer.html#t:name/0)(), [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) :: :ok ``` Remove a user credential from the SSH daemon NervesSSH.Exec β€” nerves\_ssh v0.4.3 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh/exec.ex#L1 "View Source") NervesSSH.Exec (nerves\_ssh v0.4.3) ================================================================================================================================================================ This module contains helper methods for running commands over SSH [Summary](#summary) ==================== [Functions](#functions) ------------------------ [run\_elixir(cmd)](#run_elixir/1) Run one Elixir command coming over ssh [run\_lfe(cmd)](#run_lfe/1) Run one LFE command coming over ssh [Functions](#functions) ======================== [Link to this function](#run_elixir/1 "Link to this function") run\_elixir(cmd) ================ [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh/exec.ex#L12 "View Source") ``` @spec run_elixir([charlist](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: {:ok, [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | {:error, [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` Run one Elixir command coming over ssh [Link to this function](#run_lfe/1 "Link to this function") run\_lfe(cmd) ============= [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh/exec.ex#L34 "View Source") ``` @spec run_lfe([charlist](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: {:ok, [iolist](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | {:error, [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` Run one LFE command coming over ssh NervesSSH.Options β€” nerves\_ssh v0.4.3 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh/options.ex#L1 "View Source") NervesSSH.Options (nerves\_ssh v0.4.3) ====================================================================================================================================================================== Defines option for running the SSH daemon. The following fields are available: * `:name` - a name used to reference the NervesSSH-managed SSH daemon. Defaults to [`NervesSSH`](NervesSSH.html). * `:authorized_keys` - a list of SSH authorized key file string * `:port` - the TCP port to use for the SSH daemon. Defaults to `22`. * `:subsystems` - a list of [SSH subsystems specs](https://erlang.org/doc/man/ssh.html#type-subsystem_spec) to start. Defaults to SFTP and `ssh_subsystem_fwup` * `:user_dir` - where to find authorized\_keys file * `:system_dir` - where to find host keys * `:shell` - the language of the shell (`:elixir`, `:erlang`, `:lfe` or `:disabled`). Defaults to `:elixir`. * `:exec` - the language to use for commands sent over ssh (`:elixir`, `:erlang`, or `:disabled`). Defaults to `:elixir`. * `:iex_opts` - additional options to use when starting up IEx * `:user_passwords` - a list of username/password tuples (stored in the clear!) * `:daemon_option_overrides` - additional options to pass to [`:ssh.daemon/2`](https://www.erlang.org/doc/man/ssh.html#daemon-2). These take precedence and are unchecked. Be careful using this since it can break other options. [Summary](#summary) ==================== [Types](#types) ---------------- [language()](#t:language/0) [t()](#t:t/0) [Functions](#functions) ------------------------ [add\_authorized\_key(opts, key)](#add_authorized_key/2) Add an authorized key [add\_user(opts, user, password)](#add_user/3) Add user credential to SSH options [daemon\_options(opts)](#daemon_options/1) Return :ssh.daemon\_options() [decode\_authorized\_keys(opts)](#decode_authorized_keys/1) Decode the authorized keys into Erlang public key format [load\_authorized\_keys(opts)](#load_authorized_keys/1) Load authorized keys from the authorized\_keys file [new(opts \\ [])](#new/1) Convert keyword options to the NervesSSH.Options [remove\_authorized\_key(opts, key)](#remove_authorized_key/2) Remove an authorized key [remove\_user(opts, user)](#remove_user/2) Remove user credential from SSH options [sanitize(opts)](#sanitize/1) Go through the options and fix anything that might crash [save\_authorized\_keys(opts)](#save_authorized_keys/1) Save the authorized keys to authorized\_keys file [with\_defaults(opts \\ [])](#with_defaults/1) Create a new NervesSSH.Options and fill in defaults [Types](#types) ================ [Link to this type](#t:language/0 "Link to this type") language() ========== [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh/options.ex#L28 "View Source") ``` @type language() :: :elixir | :erlang | :lfe | :disabled ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh/options.ex#L30 "View Source") ``` @type t() :: %NervesSSH.Options{ authorized_keys: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()], daemon_option_overrides: [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), decoded_authorized_keys: [[:public\_key.public\_key](https://www.erlang.org/doc/man/public_key.html#type-public_key)()], exec: [language](#t:language/0)(), iex_opts: [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), name: [GenServer.name](https://hexdocs.pm/elixir/GenServer.html#t:name/0)(), port: [non\_neg\_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), shell: [language](#t:language/0)(), subsystems: [[:ssh.subsystem\_spec](https://www.erlang.org/doc/man/ssh.html#type-subsystem_spec)()], system_dir: [Path.t](https://hexdocs.pm/elixir/Path.html#t:t/0)(), user_dir: [Path.t](https://hexdocs.pm/elixir/Path.html#t:t/0)(), user_passwords: [{[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()}] } ``` [Functions](#functions) ======================== [Link to this function](#add_authorized_key/2 "Link to this function") add\_authorized\_key(opts, key) =============================== [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh/options.ex#L103 "View Source") ``` @spec add_authorized_key([t](#t:t/0)(), [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) :: [t](#t:t/0)() ``` Add an authorized key [Link to this function](#add_user/3 "Link to this function") add\_user(opts, user, password) =============================== [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh/options.ex#L165 "View Source") ``` @spec add_user([t](#t:t/0)(), [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil) :: [t](#t:t/0)() ``` Add user credential to SSH options [Link to this function](#daemon_options/1 "Link to this function") daemon\_options(opts) ===================== [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh/options.ex#L87 "View Source") ``` @spec daemon_options([t](#t:t/0)()) :: [:ssh.daemon\_options](https://www.erlang.org/doc/man/ssh.html#type-daemon_options)() ``` Return :ssh.daemon\_options() [Link to this function](#decode_authorized_keys/1 "Link to this function") decode\_authorized\_keys(opts) ============================== [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh/options.ex#L143 "View Source") ``` @spec decode_authorized_keys([t](#t:t/0)()) :: [t](#t:t/0)() ``` Decode the authorized keys into Erlang public key format [Link to this function](#load_authorized_keys/1 "Link to this function") load\_authorized\_keys(opts) ============================ [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh/options.ex#L122 "View Source") ``` @spec load_authorized_keys([t](#t:t/0)()) :: [t](#t:t/0)() ``` Load authorized keys from the authorized\_keys file [Link to this function](#new/1 "Link to this function") new(opts \\ []) =============== [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh/options.ex#L62 "View Source") ``` @spec new([keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [t](#t:t/0)() ``` Convert keyword options to the NervesSSH.Options [Link to this function](#remove_authorized_key/2 "Link to this function") remove\_authorized\_key(opts, key) ================================== [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh/options.ex#L112 "View Source") ``` @spec remove_authorized_key([t](#t:t/0)(), [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) :: [t](#t:t/0)() ``` Remove an authorized key [Link to this function](#remove_user/2 "Link to this function") remove\_user(opts, user) ======================== [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh/options.ex#L174 "View Source") ``` @spec remove_user([t](#t:t/0)(), [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) :: [t](#t:t/0)() ``` Remove user credential from SSH options [Link to this function](#sanitize/1 "Link to this function") sanitize(opts) ============== [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh/options.ex#L278 "View Source") ``` @spec sanitize([t](#t:t/0)()) :: [t](#t:t/0)() ``` Go through the options and fix anything that might crash The goal is to make options "always work" since it is painful to debug typo's, etc. that cause the ssh daemon to not start. [Link to this function](#save_authorized_keys/1 "Link to this function") save\_authorized\_keys(opts) ============================ [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh/options.ex#L152 "View Source") ``` @spec save_authorized_keys([t](#t:t/0)()) :: :ok | {:error, [File.posix](https://hexdocs.pm/elixir/File.html#t:posix/0)()} ``` Save the authorized keys to authorized\_keys file [Link to this function](#with_defaults/1 "Link to this function") with\_defaults(opts \\ []) ========================== [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh/options.ex#L76 "View Source") ``` @spec with_defaults([keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [t](#t:t/0)() ``` Create a new NervesSSH.Options and fill in defaults NervesSSH.UserPasswords β€” nerves\_ssh v0.4.3 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh/user_passwords.ex#L1 "View Source") NervesSSH.UserPasswords (nerves\_ssh v0.4.3) =================================================================================================================================================================================== Default module used for checking User/Password combinations This will allow 3 attempts to login with a username and password and then send SSH\_MSG\_DISCONNECT [Summary](#summary) ==================== [Functions](#functions) ------------------------ [check(name, user, password, ip, attempt)](#check/5) [Functions](#functions) ======================== [Link to this function](#check/5 "Link to this function") check(name, user, password, ip, attempt) ======================================== [View Source](https://github.com/nerves-project/nerves_ssh/blob/v0.4.3/lib/nerves_ssh/user_passwords.ex#L19 "View Source") ``` @spec check( name :: [GenServer.name](https://hexdocs.pm/elixir/GenServer.html#t:name/0)(), [:erlang.string](https://www.erlang.org/doc/man/erlang.html#type-string)(), [:erlang.string](https://www.erlang.org/doc/man/erlang.html#type-string)(), [:ssh.ip\_port](https://www.erlang.org/doc/man/ssh.html#type-ip_port)(), :undefined | [non\_neg\_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | :disconnect | {[boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [non\_neg\_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ```
exrun
hex
API Reference β€” Exrun v0.2.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings API Reference Exrun v0.2.1 ======================================= [modules](#modules) Modules ----------------------------- [Exrun](Exrun.html) Generall functions for introspection of running elixir/erlang system [IEx.Helpers.Tracer](IEx.Helpers.Tracer.html) [Runner](Runner.html) Generall functions for introspection of running elixir/erlang system [Tracer](Tracer.html) Main interface for tracing functionallity. [Tracer.Collector](Tracer.Collector.html) [Tracer.Formatter](Tracer.Formatter.html) Tracer format and io functions. [Tracer.Formatter.Base](Tracer.Formatter.Base.html) [Tracer.Pattern](Tracer.Pattern.html) Module for transformation of an Elixir AST to a pattern, that possible to use for tracing [Tracer.Utils](Tracer.Utils.html) Some utils functions and reimplemmenting some usefull functions, because if they traced, the calls, made from tracer shouldn't traced too. Exrun β€” Exrun v0.2.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/exrun.ex#L1 "View Source") Exrun (Exrun v0.2.1) ============================================================================================================================== Generall functions for introspection of running elixir/erlang system IEx.Helpers.Tracer β€” Exrun v0.2.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/iex.ex#L1 "View Source") IEx.Helpers.Tracer (Exrun v0.2.1) ================================================================================================================================================ Runner β€” Exrun v0.2.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L1 "View Source") Runner (Exrun v0.2.1) ================================================================================================================================ Generall functions for introspection of running elixir/erlang system [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [allocators()](#allocators/0) Allocators [binary\_leak(n)](#binary_leak/1) Check for binary memory leaks, using garbage collection. [binary\_leak\_pid(pid)](#binary_leak_pid/1) Check process for binary leak. [format(bytes)](#format/1) Helper function to transform bytes in appropriate format. [memory(atom)](#memory/1) Get allocator usage. [process\_info(pid, attr)](#process_info/2) Process info, which gives the identifier information back, like registered name, initial call and current function, which helps to identify process. [processes(n \\ 10)](#processes/1) Find n processes, which use the most memory. [scheduler\_usage(interval \\ 1000)](#scheduler_usage/1) Scheduler usage based on scheduler wall time. [sys\_mem()](#sys_mem/0) System memory [sys\_mem(memory)](#sys_mem/1) [tabs(n \\ 10)](#tabs/1) Find tabs [util\_allocators()](#util_allocators/0) Util allocators [Link to this section](#functions) Functions ============================================= [Link to this function](#allocators/0 "Link to this function") allocators() ============ [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L126 "View Source") Allocators [Link to this function](#binary_leak/1 "Link to this function") binary\_leak(n) =============== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L155 "View Source") Check for binary memory leaks, using garbage collection. [Link to this function](#binary_leak_pid/1 "Link to this function") binary\_leak\_pid(pid) ====================== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L141 "View Source") Check process for binary leak. [Link to this function](#format/1 "Link to this function") format(bytes) ============= [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L16 "View Source") Helper function to transform bytes in appropriate format. [Link to this function](#memory/1 "Link to this function") memory(atom) ============ [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L66 "View Source") Get allocator usage. [Link to this function](#process_info/2 "Link to this function") process\_info(pid, attr) ======================== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L165 "View Source") Process info, which gives the identifier information back, like registered name, initial call and current function, which helps to identify process. [Link to this function](#processes/1 "Link to this function") processes(n \\ 10) ================== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L24 "View Source") Find n processes, which use the most memory. [Link to this function](#scheduler_usage/1 "Link to this function") scheduler\_usage(interval \\ 1000) ================================== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L188 "View Source") Scheduler usage based on scheduler wall time. [Link to this function](#sys_mem/0 "Link to this function") sys\_mem() ========== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L55 "View Source") System memory [Link to this function](#sys_mem/1 "Link to this function") sys\_mem(memory) ================ [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L59 "View Source") [Link to this function](#tabs/1 "Link to this function") tabs(n \\ 10) ============= [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L44 "View Source") Find tabs [Link to this function](#util_allocators/0 "Link to this function") util\_allocators() ================== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/runner.ex#L119 "View Source") Util allocators Tracer β€” Exrun v0.2.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer.ex#L1 "View Source") Tracer (Exrun v0.2.1) ================================================================================================================================ Main interface for tracing functionallity. Usage: ``` use Tracer trace Map.new() ``` Options: * `:node` - specified the node, on which trace should be started. * `:limit` - specifies the limit, that should be used on collectable process. Limit options are merged with actually setted. It is possible to specify it per configuration as env `:limit` for application `:exrun`. The following limit options are available: + `:time` - specifies the time in milliseconds, where should the rate be applied. Default specified by environments. (Default: 1000) + `:rate` - specifies the limit of trace messages per time, if trace messages will be over this limit, the collectable process will stop and clear all traces. Default specified by environments. (Default: 250) + `:overall` - set the absolute limit for messages. After reaching this limit, the collactable process will clear all traces and stops. Default specified by environments. (Default: nil)Additionally limit can be specified as `limit: 5`, than it equivalent to `limit: %{overall: 5}` * `:formatter_local` - flag for setting, where formatter process should be started. If set to `false`, then the formatter process will be started on remote node, if set to `true`, on a local machine. Defaults set to `false`. Tracer can trace on nodes, where elixir is not installed. If formatter\_local set to true, there will be only 2 modules loaded on remote erlang node (Tracer.Utils and Tracer.Collector), which forward messages to the connected node. If formatter\_local set to false, than formatter started on remote node and it load all modules from elixir application, because for formatting traces there should be loaded at least all Inspect modules. * `:formatter` - own formatter function, example because you try to trace different inspect function. Formatter is either a fun or tuple `{module, function, opts}`. * `:format_opts` - any format options, which will be passed to [`inspect/2`](https://hexdocs.pm/elixir/Kernel.html#inspect/2). Per default structs are disabled. * `:io` - specify io process, which should handle io from a tracer or a tuple `{init_fun, handle_fun}`, which handles initialization and io process. `init_fun` has zero arguments and should return `io`, which will be passed to `handle_fun` together with a message. * `:unlink` - tracer won't be stoped once a process started it terminates. (should be used for tracing into files or using network) * `:file` - specifies a file, where traces should be saved. Option `[file: "/tmp/trace.log"]` is a shortcut for `[unlink: true, io: {{File, :open!, ["/tmp/trace.log", [:append]]}, {IO, :puts, []}}]` [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [clear\_traces(options \\ [])](#clear_traces/1) Stop tracing [ensure\_tracer(options)](#ensure_tracer/1) Ensure tracer started [get\_config(key)](#get_config/1) [status(options \\ [])](#status/1) Get status of tracer. [trace(to\_trace, options \\ [])](#trace/2) Options ------- The following options are available [trace\_off(options \\ [])](#trace_off/1) Stop tracing [trace\_run(compiled\_pattern, options \\ [])](#trace_run/2) [Link to this section](#functions) Functions ============================================= [Link to this function](#clear_traces/1 "Link to this function") clear\_traces(options \\ []) ============================ [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer.ex#L240 "View Source") Stop tracing [Link to this function](#ensure_tracer/1 "Link to this function") ensure\_tracer(options) ======================= [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer.ex#L71 "View Source") Ensure tracer started [Link to this function](#get_config/1 "Link to this function") get\_config(key) ================ [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer.ex#L223 "View Source") [Link to this function](#status/1 "Link to this function") status(options \\ []) ===================== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer.ex#L228 "View Source") Get status of tracer. [Link to this macro](#trace/2 "Link to this macro") trace(to\_trace, options \\ []) =============================== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer.ex#L160 "View Source") (macro) [options](#trace/2-options) Options ------------------------------------- The following options are available: * `:stack` - stacktrace for the process call should be printed * `:exported` - only exported functions should be printed * `:no_return` - no returns should be printed for a calls * `:pid` - specify pid, you want to trace, otherwise all processes are traced [examples](#trace/2-examples) Examples ---------------------------------------- ``` iex> import Tracer # should be to simplify using of trace nil iex> trace :lists.seq {:ok, 2} iex> trace :lists.seq/2 {:ok, 1} iex> trace :lists.seq(1, 10) {:ok, 2} iex> trace :lists.seq(a, b) when a < 10 and b > 25 {:ok, 2} iex> trace :maps.get(:undefined, \_), [:stack] {:ok, 2} iex> trace :maps.get/2, [limit: %{overall: 100, rate: 50, time: 50}] {:ok, 2} ``` [Link to this function](#trace_off/1 "Link to this function") trace\_off(options \\ []) ========================= [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer.ex#L247 "View Source") Stop tracing [Link to this function](#trace_run/2 "Link to this function") trace\_run(compiled\_pattern, options \\ []) ============================================ [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer.ex#L169 "View Source") Tracer.Collector β€” Exrun v0.2.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L1 "View Source") Tracer.Collector (Exrun v0.2.1) ==================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [clear\_traces(node)](#clear_traces/1) [configure(node, io, limit, formatter)](#configure/4) [ensure\_started(node, unlink?)](#ensure_started/2) [handle\_call(arg1, state)](#handle_call/2) [handle\_trace(trace, state)](#handle_trace/2) [init(arg)](#init/1) [loop(state)](#loop/1) [start(node \\ node(), unlink?)](#start/2) [status(node)](#status/1) [stop(node)](#stop/1) [stop(reason, map)](#stop/2) [trace(node, processes, trace\_options)](#trace/3) [trace\_and\_set(node, processes, trace\_options, pattern)](#trace_and_set/4) [trace\_pattern(node, pattern)](#trace_pattern/2) [Link to this section](#functions) Functions ============================================= [Link to this function](#clear_traces/1 "Link to this function") clear\_traces(node) =================== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L35 "View Source") [Link to this function](#configure/4 "Link to this function") configure(node, io, limit, formatter) ===================================== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L18 "View Source") [Link to this function](#ensure_started/2 "Link to this function") ensure\_started(node, unlink?) ============================== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L5 "View Source") [Link to this function](#handle_call/2 "Link to this function") handle\_call(arg1, state) ========================= [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L73 "View Source") [Link to this function](#handle_trace/2 "Link to this function") handle\_trace(trace, state) =========================== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L132 "View Source") [Link to this function](#init/1 "Link to this function") init(arg) ========= [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L38 "View Source") [Link to this function](#loop/1 "Link to this function") loop(state) =========== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L54 "View Source") [Link to this function](#start/2 "Link to this function") start(node \\ node(), unlink?) ============================== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L12 "View Source") [Link to this function](#status/1 "Link to this function") status(node) ============ [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L34 "View Source") [Link to this function](#stop/1 "Link to this function") stop(node) ========== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L36 "View Source") [Link to this function](#stop/2 "Link to this function") stop(reason, map) ================= [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L110 "View Source") [Link to this function](#trace/3 "Link to this function") trace(node, processes, trace\_options) ====================================== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L22 "View Source") [Link to this function](#trace_and_set/4 "Link to this function") trace\_and\_set(node, processes, trace\_options, pattern) ========================================================= [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L30 "View Source") [Link to this function](#trace_pattern/2 "Link to this function") trace\_pattern(node, pattern) ============================= [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/collector.ex#L26 "View Source") Tracer.Formatter β€” Exrun v0.2.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/formatter.ex#L1 "View Source") Tracer.Formatter (Exrun v0.2.1) ==================================================================================================================================================== Tracer format and io functions. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [init(arg, formatter)](#init/2) [start\_link(io, formatter)](#start_link/2) [Link to this section](#functions) Functions ============================================= [Link to this function](#init/2 "Link to this function") init(arg, formatter) ==================== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/formatter.ex#L12 "View Source") [Link to this function](#start_link/2 "Link to this function") start\_link(io, formatter) ========================== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/formatter.ex#L8 "View Source") Tracer.Formatter.Base β€” Exrun v0.2.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/formatter/base.ex#L1 "View Source") Tracer.Formatter.Base (Exrun v0.2.1) ============================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [format\_time(now)](#format_time/1) [format\_trace(msg, opts)](#format_trace/2) Format trace message to a string. [Link to this section](#functions) Functions ============================================= [Link to this function](#format_time/1 "Link to this function") format\_time(now) ================= [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/formatter/base.ex#L88 "View Source") [Link to this function](#format_trace/2 "Link to this function") format\_trace(msg, opts) ======================== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/formatter/base.ex#L5 "View Source") Format trace message to a string. Tracer.Pattern β€” Exrun v0.2.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/pattern.ex#L1 "View Source") Tracer.Pattern (Exrun v0.2.1) ================================================================================================================================================ Module for transformation of an Elixir AST to a pattern, that possible to use for tracing [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [compile(pattern, options \\ [])](#compile/2) Compile pattern from elixir AST and options [Link to this section](#functions) Functions ============================================= [Link to this function](#compile/2 "Link to this function") compile(pattern, options \\ []) =============================== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/pattern.ex#L9 "View Source") Compile pattern from elixir AST and options Tracer.Utils β€” Exrun v0.2.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/utils.ex#L1 "View Source") Tracer.Utils (Exrun v0.2.1) ============================================================================================================================================ Some utils functions and reimplemmenting some usefull functions, because if they traced, the calls, made from tracer shouldn't traced too. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [apply\_func(func, arguments \\ [])](#apply_func/2) [call!(identifier, request, timeout \\ 10000)](#call!/3) [call(identifier, request, timeout \\ 10000)](#call/3) [load\_modules(node, module\_list \\ [Tracer.Utils])](#load_modules/2) [rpc(node, module, function, args, timeout \\ 5000)](#rpc/5) [rpc\_local(parent, tag, module, function, args)](#rpc_local/5) [Link to this section](#functions) Functions ============================================= [Link to this function](#apply_func/2 "Link to this function") apply\_func(func, arguments \\ []) ================================== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/utils.ex#L85 "View Source") [Link to this function](#call!/3 "Link to this function") call!(identifier, request, timeout \\ 10000) ============================================ [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/utils.ex#L27 "View Source") [Link to this function](#call/3 "Link to this function") call(identifier, request, timeout \\ 10000) =========================================== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/utils.ex#L34 "View Source") [Link to this function](#load_modules/2 "Link to this function") load\_modules(node, module\_list \\ [Tracer.Utils]) =================================================== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/utils.ex#L51 "View Source") [Link to this function](#rpc/5 "Link to this function") rpc(node, module, function, args, timeout \\ 5000) ================================================== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/utils.ex#L62 "View Source") [Link to this function](#rpc_local/5 "Link to this function") rpc\_local(parent, tag, module, function, args) =============================================== [View Source](https://github.com/liveforeverx/exrun/blob/main/lib/tracer/utils.ex#L80 "View Source")
request_cache_plug
hex
RequestCache β€” request\_cache\_plug v1.0.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/mikaak/request_cache_plug/blob/main/lib/request_cache.ex#L1 "View Source") RequestCache (request\_cache\_plug v1.0.1) =================================================================================================================================================================== [requestcache](#module-requestcache) RequestCache --------------------------------------------------- [![Test](https://github.com/MikaAK/request_cache_plug/actions/workflows/test-actions.yml/badge.svg)](https://github.com/MikaAK/request_cache_plug/actions/workflows/test-actions.yml) [![codecov](https://codecov.io/gh/MikaAK/request_cache_plug/branch/main/graph/badge.svg?token=RF4ASVG5PV)](https://codecov.io/gh/MikaAK/request_cache_plug) [![Hex version badge](https://img.shields.io/hexpm/v/request_cache_plug.svg)](https://hex.pm/packages/request_cache_plug) This plug allows us to cache our graphql queries and phoenix controller requests declaritevly We call the cache inside either a resolver or a controller action and this will store it preventing further executions of our query on repeat requests. The goal of this plug is to short-circuit any processing phoenix would normally do upon request including json decoding/parsing, the only step that should run is telemetry ### [installation](#module-installation) Installation This package can be installed by adding `request_cache_plug` to your list of dependencies in `mix.exs`: ``` def deps do [ {:request\_cache\_plug, "~> 0.2"} ] end ``` Documentation can be found at <https://hexdocs.pm/request_cache_plug>. ### [config](#module-config) Config This is the default config, it can all be changed ``` config :request\_cache\_plug, enabled?: true, verbose?: false, graphql\_paths: ["/graphiql", "/graphql"], conn\_priv\_key: :\_\_shared\_request\_cache\_\_, request\_cache\_module: RequestCache.ConCacheStore, default\_ttl: :timer.hours(1), default\_concache\_opts: [ ttl\_check\_interval: :timer.seconds(1), acquire\_lock\_timeout: :timer.seconds(1), ets\_options: [write\_concurrency: true, read\_concurrency: true] ] ``` ### [usage](#module-usage) Usage This plug is intended to be inserted into the `endpoint.ex` fairly early in the pipeline, it should go after telemetry but before our parsers ``` plug Plug.Telemetry, event\_prefix: [:phoenix, :endpoint] plug RequestCache.Plug plug Plug.Parsers, parsers: [:urlencoded, :multipart, :json], pass: ["\*/\*"] ``` We also need to setup a before\_send hook to our absinthe\_plug (if not using absinthe you can skip this step) ``` plug Absinthe.Plug, before\_send: {RequestCache, :connect\_absinthe\_context\_to\_conn} ``` What this does is allow us to see the results of items we put onto our request context from within plugs coming after absinthe After that we can utilize our cache in a few ways #### Utilization with Phoenix Controllers ``` def index(conn, params) do conn |> RequestCache.store(:timer.seconds(60)) |> put\_status(200) |> json(%{...}) end ``` #### Utilization with Absinthe Resolvers ``` def all(params, \_resolution) do # Instead of returning {:ok, value} we return this RequestCache.store(value, :timer.seconds(60)) end ``` #### Utilization with Absinthe Middleware ``` field :user, :user do arg :id, non\_null(:id) middleware RequestCache.Middleware, ttl: :timer.seconds(60) resolve &Resolvers.User.find/2 end ``` ### [specifying-specific-caching-locations](#module-specifying-specific-caching-locations) Specifying Specific Caching Locations We have a few ways to control the caching location of our RequestCache, by default if you have `con_cache` installed, we have access to `RequestCache.ConCacheStore` which is the default setting However we can override this by setting `config :request_cache_plug, :request_cache_module, MyCustomCache` Caching module will be expected to have the following API: ``` def get(key) do ... end def put(key, ttl, value) do ... end ``` You are responsible for starting the cache, including ConCacheStore, so if you're planning to use it make sure you add `RequestCache.ConCacheStore` to the application.ex list of children ***Specifying the module per function is currently not fully implemented, check back soon for updates*** We can also override the module for a particular request by passing the option to our graphql middleware or our `&RequestCache.store/2` function as `[ttl: 123, cache: MyCacheModule]` ##### With Middleware ``` field :user, :user do arg :id, non\_null(:id) middleware RequestCache.Middleware, ttl: :timer.seconds(60), cache: MyCacheModule resolve &Resolvers.User.find/2 end ``` ##### In a Resolver ``` def all(params, resolution) do RequestCache.store(value, ttl: :timer.seconds(60), cache: MyCacheModule) end ``` ##### In a Controller ``` def index(conn, params) do RequestCache.store(conn, ttl: :timer.seconds(60), cache: MyCacheModule) end ``` ### [telemetry](#module-telemetry) telemetry Cache events are emitted via :telemetry. Events are: * `[:request_cache_plug, :graphql, :cache_hit]` * `[:request_cache_plug, :graphql, :cache_miss]` * `[:request_cache_plug, :rest, :cache_hit]` * `[:request_cache_plug, :rest, :cache_miss]` * `[:request_cache_plug, :cache_put]` For GraphQL endpoints it is possible to provide a list of atoms that will be passed through to the event metadata; e.g.: ##### With Middleware ``` field :user, :user do arg :id, non\_null(:id) middleware RequestCache.Middleware, ttl: :timer.seconds(60), cache: MyCacheModule, labels: [:service, :endpoint], whitelisted\_query\_names: ["MyQueryName"] # By default all queries are cached, can also whitelist based off query name from GQL Document resolve &Resolvers.User.find/2 end ``` ##### In a Resolver ``` def all(params, resolution) do RequestCache.store(value, ttl: :timer.seconds(60), cache: MyCacheModule, labels: [:service, :endpoint]) end ``` The events will look like this: ``` { [:request\_cache\_plug, :graphql, :cache\_hit], %{count: 1}, %{ttl: 3600000, cache\_key: "/graphql:NNNN", labels: [:service, :endpoint]} } ``` ##### Enable Error Caching In order to enable error caching we can either setup `cached_errors` in our config or as an option to `RequestCache.store` or [`RequestCache.Middleware`](RequestCache.Middleware.html). The value of `cached_errors` can be one of `[]`, `:all` or a list of reason\_atoms as defined by [`Plug.Conn.Status`](https://hexdocs.pm/plug/1.13.4/Plug.Conn.Status.html) such as `:not_found`, or `:internal_server_error`. In REST this works off the response codes returned. However, in order to use reason\_atoms in GraphQL you will need to make sure your errors contain some sort of `%{code: "not_found"}` response in them Take a look at [error\_message](https://github.com/MikaAK/elixir_error_message) for a compatible error system ### [notes-gotchas](#module-notes-gotchas) Notes/Gotchas * In order for this caching to work, we cannot be using POST requests as specced out by GraphQL, not for queries at least, fortunately this doesn't actually matter since we can use any http method we want (there will be a limit to query size), in a production app you may be doing this already due to the caching you gain from CloudFlare * Caches are stored via a MD5 hashed key that correlates to your query in GraphQL, or in REST your url path + query parameters * Absinthe and ConCache are optional dependencies, if you don't have them you won't have access to [`RequestCache.Middleware`](RequestCache.Middleware.html) or `RequestCache.ConCacheStore` * If no ConCache is found, you must set `config :request_cache_module` to something else ### [caching-header](#module-caching-header) Caching Header When an item is served from the cache, we return a header `rc-cache-status` which has a value of `HIT`. Using this you can tell if the item was served out of cache, without it the item was fetched ### [example-reduction](#module-example-reduction) Example Reduction In the case of a large (16mb) payload running through absinthe, this plug cuts down response times from 400+ms -> <400ΞΌs ![image](https://user-images.githubusercontent.com/4650931/161464277-713e994b-1246-43ac-82a1-fb2442cd7bce.png) [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [opts()](#t:opts/0) [Functions](#functions) ------------------------ [connect\_absinthe\_context\_to\_conn(conn, blueprint)](#connect_absinthe_context_to_conn/2) [store(conn, opts\_or\_ttl \\ [])](#store/2) [Link to this section](#types) Types ===================================== [Link to this type](#t:opts/0 "Link to this type") opts() ====== [View Source](https://github.com/mikaak/request_cache_plug/blob/main/lib/request_cache.ex#L6 "View Source") ``` @type opts() :: [ttl: [pos\_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), cache: [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), cached_errors: :all | [[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()]] ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#connect_absinthe_context_to_conn/2 "Link to this function") connect\_absinthe\_context\_to\_conn(conn, blueprint) ===================================================== [View Source](https://github.com/mikaak/request_cache_plug/blob/main/lib/request_cache.ex#L33 "View Source") [Link to this function](#store/2 "Link to this function") store(conn, opts\_or\_ttl \\ []) ================================ [View Source](https://github.com/mikaak/request_cache_plug/blob/main/lib/request_cache.ex#L13 "View Source") ``` @spec store(conn :: [Plug.Conn.t](https://hexdocs.pm/plug/1.13.4/Plug.Conn.html#t:t/0)(), opts_or_ttl :: [opts](#t:opts/0)() | [pos\_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [Plug.Conn.t](https://hexdocs.pm/plug/1.13.4/Plug.Conn.html#t:t/0)() ``` RequestCache.Middleware β€” request\_cache\_plug v1.0.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/mikaak/request_cache_plug/blob/main/lib/request_cache/middleware.ex#L4 "View Source") RequestCache.Middleware (request\_cache\_plug v1.0.1) ========================================================================================================================================================================================= [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [store\_result(result, ttl)](#store_result/2) [Link to this section](#functions) Functions ============================================= [Link to this function](#store_result/2 "Link to this function") store\_result(result, ttl) ========================== [View Source](https://github.com/mikaak/request_cache_plug/blob/main/lib/request_cache/middleware.ex#L83 "View Source") ``` @spec store_result( result :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), opts_or_ttl :: [RequestCache.opts](RequestCache.html#t:opts/0)() | [pos\_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ) :: {:middleware, [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [RequestCache.opts](RequestCache.html#t:opts/0)()} ``` RequestCache.Plug β€” request\_cache\_plug v1.0.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/mikaak/request_cache_plug/blob/main/lib/request_cache/plug.ex#L1 "View Source") RequestCache.Plug (request\_cache\_plug v1.0.1) ============================================================================================================================================================================= This plug allows you to cache GraphQL requests based off their query name and variables. This should be placed right after telemetry and before parsers so that it can stop any processing of the requests and immediately return a response. Please see [`RequestCache`](RequestCache.html) for more details [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [empty\_errors\_pattern()](#empty_errors_pattern/0) [error\_codes\_pattern(cached\_errors)](#error_codes_pattern/1) [error\_pattern()](#error_pattern/0) [request\_cache\_header()](#request_cache_header/0) [store\_request(conn, opts)](#store_request/2) [Link to this section](#functions) Functions ============================================= [Link to this function](#empty_errors_pattern/0 "Link to this function") empty\_errors\_pattern() ======================== [View Source](https://github.com/mikaak/request_cache_plug/blob/main/lib/request_cache/plug.ex#L216 "View Source") [Link to this function](#error_codes_pattern/1 "Link to this function") error\_codes\_pattern(cached\_errors) ===================================== [View Source](https://github.com/mikaak/request_cache_plug/blob/main/lib/request_cache/plug.ex#L219 "View Source") [Link to this function](#error_pattern/0 "Link to this function") error\_pattern() ================ [View Source](https://github.com/mikaak/request_cache_plug/blob/main/lib/request_cache/plug.ex#L217 "View Source") [Link to this function](#request_cache_header/0 "Link to this function") request\_cache\_header() ======================== [View Source](https://github.com/mikaak/request_cache_plug/blob/main/lib/request_cache/plug.ex#L20 "View Source") [Link to this function](#store_request/2 "Link to this function") store\_request(conn, opts) ========================== [View Source](https://github.com/mikaak/request_cache_plug/blob/main/lib/request_cache/plug.ex#L251 "View Source")
browser
hex
Browser β€” browser v0.5.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } Browser (browser v0.5.0) [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L1 "View Source") ============================================================================================================================ [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [adobe\_air?(input)](#adobe_air?/1) [android?(input, version \\ nil)](#android?/2) [android\_version(input)](#android_version/1) [blackberry?(input, version \\ nil)](#blackberry?/2) [blackberry\_running\_safari?(input)](#blackberry_running_safari?/1) [blackberry\_version(input)](#blackberry_version/1) [bot?(input, options \\ [])](#bot?/2) [bot\_name(input, options \\ [])](#bot_name/2) [chrome?(input)](#chrome?/1) [chrome\_os?(input)](#chrome_os?/1) [compatibility\_view?(input)](#compatibility_view?/1) [console?(input)](#console?/1) [core\_media?(input)](#core_media?/1) [detect\_version?(actual\_version, expected\_version)](#detect_version?/2) [device\_type(input)](#device_type/1) [edge?(input)](#edge?/1) [firefox?(input)](#firefox?/1) [full\_browser\_name(input)](#full_browser_name/1) [full\_display(input)](#full_display/1) [full\_platform\_name(input)](#full_platform_name/1) [full\_version(input)](#full_version/1) [id(input)](#id/1) [ie?(input, version \\ nil)](#ie?/2) [ios?(input, version \\ nil)](#ios?/2) [ios\_version(input)](#ios_version/1) [ipad?(input)](#ipad?/1) [iphone?(input)](#iphone?/1) [ipod?(input)](#ipod?/1) [kindle?(input)](#kindle?/1) [known?(input)](#known?/1) [linux?(input)](#linux?/1) [mac?(input)](#mac?/1) [mac\_version(input)](#mac_version/1) [mac\_version\_name(input)](#mac_version_name/1) [mobile?(input)](#mobile?/1) [modern?(input)](#modern?/1) [modern\_edge?(ua)](#modern_edge?/1) [modern\_firefox?(ua)](#modern_firefox?/1) [modern\_firefox\_tablet?(ua)](#modern_firefox_tablet?/1) [modern\_ie\_version?(ua)](#modern_ie_version?/1) [modern\_opera?(ua)](#modern_opera?/1) [msie\_full\_version(input)](#msie_full_version/1) [msie\_version(ua)](#msie_version/1) [name(input)](#name/1) [nintendo?(input)](#nintendo?/1) [opera?(input)](#opera?/1) [opera\_mini?(input)](#opera_mini?/1) [phantom\_js?(input)](#phantom_js?/1) [platform(input)](#platform/1) [playbook?(input)](#playbook?/1) [playstation4?(input)](#playstation4?/1) [playstation?(input)](#playstation?/1) [psp?(input)](#psp?/1) [psp\_vita?(input)](#psp_vita?/1) [quicktime?(input)](#quicktime?/1) [safari?(input)](#safari?/1) [safari\_webapp\_mode?(input)](#safari_webapp_mode?/1) [search\_engine?(input)](#search_engine?/1) [silk?(input)](#silk?/1) [surface?(input)](#surface?/1) [tablet?(input)](#tablet?/1) [tv?(input)](#tv?/1) [uc\_browser?(input)](#uc_browser?/1) [version(input)](#version/1) [webkit?(input)](#webkit?/1) [windows10?(input)](#windows10?/1) [windows7?(input)](#windows7?/1) [windows8?(input)](#windows8?/1) [windows8\_1?(input)](#windows8_1?/1) [windows?(input)](#windows?/1) [windows\_mobile?(input)](#windows_mobile?/1) [windows\_phone?(input)](#windows_phone?/1) [windows\_rt?(input)](#windows_rt?/1) [windows\_touchscreen\_desktop?(input)](#windows_touchscreen_desktop?/1) [windows\_version\_name(input)](#windows_version_name/1) [windows\_vista?(input)](#windows_vista?/1) [windows\_wow64?(input)](#windows_wow64?/1) [windows\_x64?(input)](#windows_x64?/1) [windows\_x64\_inclusive?(input)](#windows_x64_inclusive?/1) [windows\_xp?(input)](#windows_xp?/1) [xbox?(input)](#xbox?/1) [xbox\_one?(input)](#xbox_one?/1) [yandex?(input)](#yandex?/1) [Link to this section](#functions) Functions ============================================= [Link to this function](#adobe_air?/1 "Link to this function") adobe\_air?(input) ================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L442 "View Source") [Link to this function](#android?/2 "Link to this function") android?(input, version \\ nil) =============================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L455 "View Source") [Link to this function](#android_version/1 "Link to this function") android\_version(input) ======================= [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L460 "View Source") [Link to this function](#blackberry?/2 "Link to this function") blackberry?(input, version \\ nil) ================================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L243 "View Source") [Link to this function](#blackberry_running_safari?/1 "Link to this function") blackberry\_running\_safari?(input) =================================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L248 "View Source") [Link to this function](#blackberry_version/1 "Link to this function") blackberry\_version(input) ========================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L236 "View Source") [Link to this function](#bot?/2 "Link to this function") bot?(input, options \\ []) ========================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L259 "View Source") [Link to this function](#bot_name/2 "Link to this function") bot\_name(input, options \\ []) =============================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L271 "View Source") [Link to this function](#chrome?/1 "Link to this function") chrome?(input) ============== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L210 "View Source") [Link to this function](#chrome_os?/1 "Link to this function") chrome\_os?(input) ================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L576 "View Source") [Link to this function](#compatibility_view?/1 "Link to this function") compatibility\_view?(input) =========================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L419 "View Source") [Link to this function](#console?/1 "Link to this function") console?(input) =============== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L313 "View Source") [Link to this function](#core_media?/1 "Link to this function") core\_media?(input) =================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L188 "View Source") [Link to this function](#detect_version?/2 "Link to this function") detect\_version?(actual\_version, expected\_version) ==================================================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L70 "View Source") [Link to this function](#device_type/1 "Link to this function") device\_type(input) =================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L360 "View Source") [Link to this function](#edge?/1 "Link to this function") edge?(input) ============ [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L388 "View Source") [Link to this function](#firefox?/1 "Link to this function") firefox?(input) =============== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L206 "View Source") [Link to this function](#full_browser_name/1 "Link to this function") full\_browser\_name(input) ========================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L82 "View Source") [Link to this function](#full_display/1 "Link to this function") full\_display(input) ==================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L109 "View Source") [Link to this function](#full_platform_name/1 "Link to this function") full\_platform\_name(input) =========================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L92 "View Source") [Link to this function](#full_version/1 "Link to this function") full\_version(input) ==================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L140 "View Source") [Link to this function](#id/1 "Link to this function") id(input) ========= [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L119 "View Source") [Link to this function](#ie?/2 "Link to this function") ie?(input, version \\ nil) ========================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L383 "View Source") [Link to this function](#ios?/2 "Link to this function") ios?(input, version \\ nil) =========================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L464 "View Source") [Link to this function](#ios_version/1 "Link to this function") ios\_version(input) =================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L469 "View Source") [Link to this function](#ipad?/1 "Link to this function") ipad?(input) ============ [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L331 "View Source") [Link to this function](#iphone?/1 "Link to this function") iphone?(input) ============== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L327 "View Source") [Link to this function](#ipod?/1 "Link to this function") ipod?(input) ============ [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L335 "View Source") [Link to this function](#kindle?/1 "Link to this function") kindle?(input) ============== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L347 "View Source") [Link to this function](#known?/1 "Link to this function") known?(input) ============= [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L230 "View Source") [Link to this function](#linux?/1 "Link to this function") linux?(input) ============= [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L572 "View Source") [Link to this function](#mac?/1 "Link to this function") mac?(input) =========== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L473 "View Source") [Link to this function](#mac_version/1 "Link to this function") mac\_version(input) =================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L477 "View Source") [Link to this function](#mac_version_name/1 "Link to this function") mac\_version\_name(input) ========================= [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L484 "View Source") [Link to this function](#mobile?/1 "Link to this function") mobile?(input) ============== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L434 "View Source") [Link to this function](#modern?/1 "Link to this function") modern?(input) ============== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L154 "View Source") [Link to this function](#modern_edge?/1 "Link to this function") modern\_edge?(ua) ================= [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L167 "View Source") [Link to this function](#modern_firefox?/1 "Link to this function") modern\_firefox?(ua) ==================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L159 "View Source") [Link to this function](#modern_firefox_tablet?/1 "Link to this function") modern\_firefox\_tablet?(ua) ============================ [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L175 "View Source") [Link to this function](#modern_ie_version?/1 "Link to this function") modern\_ie\_version?(ua) ======================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L163 "View Source") [Link to this function](#modern_opera?/1 "Link to this function") modern\_opera?(ua) ================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L171 "View Source") [Link to this function](#msie_full_version/1 "Link to this function") msie\_full\_version(input) ========================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L409 "View Source") [Link to this function](#msie_version/1 "Link to this function") msie\_version(ua) ================= [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L404 "View Source") [Link to this function](#name/1 "Link to this function") name(input) =========== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L78 "View Source") [Link to this function](#nintendo?/1 "Link to this function") nintendo?(input) ================ [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L309 "View Source") [Link to this function](#opera?/1 "Link to this function") opera?(input) ============= [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L214 "View Source") [Link to this function](#opera_mini?/1 "Link to this function") opera\_mini?(input) =================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L438 "View Source") [Link to this function](#phantom_js?/1 "Link to this function") phantom\_js?(input) =================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L192 "View Source") [Link to this function](#platform/1 "Link to this function") platform(input) =============== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L580 "View Source") [Link to this function](#playbook?/1 "Link to this function") playbook?(input) ================ [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L351 "View Source") [Link to this function](#playstation4?/1 "Link to this function") playstation4?(input) ==================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L305 "View Source") [Link to this function](#playstation?/1 "Link to this function") playstation?(input) =================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L301 "View Source") [Link to this function](#psp?/1 "Link to this function") psp?(input) =========== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L317 "View Source") [Link to this function](#psp_vita?/1 "Link to this function") psp\_vita?(input) ================= [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L321 "View Source") [Link to this function](#quicktime?/1 "Link to this function") quicktime?(input) ================= [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L184 "View Source") [Link to this function](#safari?/1 "Link to this function") safari?(input) ============== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L196 "View Source") [Link to this function](#safari_webapp_mode?/1 "Link to this function") safari\_webapp\_mode?(input) ============================ [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L202 "View Source") [Link to this function](#search_engine?/1 "Link to this function") search\_engine?(input) ====================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L282 "View Source") [Link to this function](#silk?/1 "Link to this function") silk?(input) ============ [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L222 "View Source") [Link to this function](#surface?/1 "Link to this function") surface?(input) =============== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L339 "View Source") [Link to this function](#tablet?/1 "Link to this function") tablet?(input) ============== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L343 "View Source") [Link to this function](#tv?/1 "Link to this function") tv?(input) ========== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L595 "View Source") [Link to this function](#uc_browser?/1 "Link to this function") uc\_browser?(input) =================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L218 "View Source") [Link to this function](#version/1 "Link to this function") version(input) ============== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L131 "View Source") [Link to this function](#webkit?/1 "Link to this function") webkit?(input) ============== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L179 "View Source") [Link to this function](#windows10?/1 "Link to this function") windows10?(input) ================= [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L544 "View Source") [Link to this function](#windows7?/1 "Link to this function") windows7?(input) ================ [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L532 "View Source") [Link to this function](#windows8?/1 "Link to this function") windows8?(input) ================ [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L536 "View Source") [Link to this function](#windows8_1?/1 "Link to this function") windows8\_1?(input) =================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L540 "View Source") [Link to this function](#windows?/1 "Link to this function") windows?(input) =============== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L505 "View Source") [Link to this function](#windows_mobile?/1 "Link to this function") windows\_mobile?(input) ======================= [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L552 "View Source") [Link to this function](#windows_phone?/1 "Link to this function") windows\_phone?(input) ====================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L556 "View Source") [Link to this function](#windows_rt?/1 "Link to this function") windows\_rt?(input) =================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L548 "View Source") [Link to this function](#windows_touchscreen_desktop?/1 "Link to this function") windows\_touchscreen\_desktop?(input) ===================================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L356 "View Source") [Link to this function](#windows_version_name/1 "Link to this function") windows\_version\_name(input) ============================= [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L509 "View Source") [Link to this function](#windows_vista?/1 "Link to this function") windows\_vista?(input) ====================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L528 "View Source") [Link to this function](#windows_wow64?/1 "Link to this function") windows\_wow64?(input) ====================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L564 "View Source") [Link to this function](#windows_x64?/1 "Link to this function") windows\_x64?(input) ==================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L560 "View Source") [Link to this function](#windows_x64_inclusive?/1 "Link to this function") windows\_x64\_inclusive?(input) =============================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L568 "View Source") [Link to this function](#windows_xp?/1 "Link to this function") windows\_xp?(input) =================== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L524 "View Source") [Link to this function](#xbox?/1 "Link to this function") xbox?(input) ============ [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L293 "View Source") [Link to this function](#xbox_one?/1 "Link to this function") xbox\_one?(input) ================= [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L297 "View Source") [Link to this function](#yandex?/1 "Link to this function") yandex?(input) ============== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L226 "View Source") Browser.Ua β€” browser v0.5.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } Browser.Ua protocol (browser v0.5.0) [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L4 "View Source") ======================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [ua()](#t:ua/0) [Functions](#functions) ------------------------ [to\_ua(input)](#to_ua/1) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L4 "View Source") Specs ----- ``` t() :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this type](#t:ua/0 "Link to this type") ua() ==== [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L5 "View Source") Specs ----- ``` ua() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#to_ua/1 "Link to this function") to\_ua(input) ============= [View Source](https://github.com/danhper/elixir-browser/blob/main/lib/browser.ex#L7 "View Source") Specs ----- ``` to_ua([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [ua](#t:ua/0)() ``` elixir-browser β€” browser v0.5.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } elixir-browser [View Source](https://github.com/danhper/elixir-browser/blob/main/README.md#L1 "View Source") =============================================================================================================== [![Build Status](https://travis-ci.org/danhper/elixir-browser.svg?branch=master)](https://travis-ci.org/danhper/elixir-browser) Browser detection for Elixir. This is a port from the [Ruby browser library](https://github.com/fnando/browser). All the detection features have been ported, but not the meta and the language ones. Installation --------------- Add `browser` to your list of dependencies in `mix.exs`: ``` def deps do [{:browser, "~> 0.4.4"}] end ``` Usage -------- ``` ua = "some string" Browser.name(ua) # readable browser name Browser.version(ua) # major version number Browser.full\_version(ua) Browser.full\_browser\_name(ua) # Chrome 5.0.375.99 Browser.full\_display(ua) # example: Chrome 5.0.375.99 on MacOS 10.6.4 Snow Leopard Browser.safari?(ua) Browser.opera?(ua) Browser.chrome?(ua) Browser.chrome\_os?(ua) Browser.mobile?(ua) Browser.tablet?(ua) Browser.console?(ua) Browser.firefox?(ua) Browser.ie?(ua) Browser.ie?(ua, 6) # detect specific IE version Browser.edge?(ua) # Newest MS browser Browser.modern?(ua) # Webkit, Firefox 17+, IE 9+ and Opera 12+ Browser.platform(ua) # return :ios, :android, :mac, :windows, :linux or :other Browser.full\_platform\_name(ua) # example: MacOS 10.6.4 Snow Leopard Browser.device\_type(ua) # return :mobile, :tablet, :desktop, :console, :unknown Browser.ios?(ua) # detect iOS Browser.ios?(ua, 9) # detect specific iOS version Browser.mac?(ua) Browser.mac\_version(ua) # display version of Mac OSX. i.e. High Sierra Browser.windows?(ua) Browser.windows\_x64?(ua) Browser.windows\_version\_name # display version of Windows. i.e. Windows 10 Browser.linux?(ua) Browser.blackberry?(ua) Browser.blackberry?(ua, 10) # detect specific BlackBerry version Browser.bot?(ua) Browser.search\_engine?(ua) Browser.phantom\_js?(ua) Browser.quicktime?(ua) Browser.core\_media?(ua) Browser.silk?(ua) Browser.android?(ua) Browser.android?(ua, 4.2) # detect Android Jelly Bean 4.2 Browser.known?(ua) # has the browser been successfully detected? ``` See the [original Ruby library](https://github.com/fnando/browser) for more information. ### Elixir addition You can also pass [`Plug.Conn`](https://hexdocs.pm/plug/1.13.3/Plug.Conn.html) instead of a string, the `user-agent` header will be extracted and used. ``` Browser.bot?(conn) ``` ### Configuration You can specify custom bots.txt file in your project's config. ``` config :browser, bots\_file: Path.join(File.cwd!, "bots.txt") # bots.txt in project's root ``` Please note that option set as mobule attribute during compile time, so make sure you recompiled elixir-browser after changing this option or bots file itself. [← Previous Page API Reference](api-reference.html) API Reference β€” browser v0.5.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } API Reference browser v0.5.0 ============================= Modules ---------- [Browser](Browser.html) [Browser.Ua](Browser.Ua.html) [Next Page β†’ elixir-browser](readme.html)
faker_elixir_octopus
hex
API Reference – Faker Elixir (octopus) v1.0.2 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; Faker Elixir (octopus) v1.0.2 API Reference ============================================= * [Modules](#modules) * [Exceptions](#exceptions) Modules ======= [FakerElixir](FakerElixir.html) FakerElixir is an Elixir package that **generates fake data** for you. Whether you need to **seed** your database, create **factories** for your project, FakerElixir is here for you [FakerElixir.Address](FakerElixir.Address.html) Generate fake data for the domain address [FakerElixir.App](FakerElixir.App.html) Generate fake data for the domain app [FakerElixir.Avatar](FakerElixir.Avatar.html) Generate fake data for the domain avatar [FakerElixir.Bank](FakerElixir.Bank.html) Generate fake date related to the Bank domain [FakerElixir.Boolean](FakerElixir.Boolean.html) Generate fake data for the domain boolean [FakerElixir.Color](FakerElixir.Color.html) Generate fake date for the domain Color [FakerElixir.Commerce](FakerElixir.Commerce.html) Generate fake data for the domain Commerce [FakerElixir.Crypto](FakerElixir.Crypto.html) Generate fake data for the domain crypto [FakerElixir.Currency](FakerElixir.Currency.html) Generate fake data for the domain currency [FakerElixir.Date](FakerElixir.Date.html) Generate fake data for the domain Date [FakerElixir.File](FakerElixir.File.html) Generate fake data for the domain File [FakerElixir.Helper](FakerElixir.Helper.html) Provide useful helpers [FakerElixir.Internet](FakerElixir.Internet.html) Generate fake data for the domain Internet [FakerElixir.Lorem](FakerElixir.Lorem.html) Generate fake data for the domain lorem [FakerElixir.Name](FakerElixir.Name.html) Generate fake data for the domain lorem [FakerElixir.Number](FakerElixir.Number.html) Generate fake data for the domain Number [FakerElixir.Phone](FakerElixir.Phone.html) Generate fake date for the domain Phone Exceptions ========== [OverflowError](OverflowError.html) FakerElixir – Faker Elixir (octopus) v1.0.2 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; Faker Elixir (octopus) v1.0.2 FakerElixir =========================================== FakerElixir is an Elixir package that **generates fake data** for you. Whether you need to **seed** your database, create **factories** for your project, FakerElixir is here for you. Installation --------------- Can’t wait to generate some fake data ? Follow the steps: 1. Add `faker_elixir_octopus` to your list of dependencies in `mix.exs`: ``` def deps do [{:faker_elixir_octopus, "> 0.0.0"}] end ``` 1. Ensure `faker_elixir` is started before your application: ``` def application do [applications: [:faker_elixir_octopus]] end ``` 1. Run in the root of your project: ``` $ mix deps.get ``` 1. Faker Elixir is now a part of your application and ready to use! Usage -------- Since I’m quite sure you are using Phoenix, I will show you a basic example: ``` defmodule Zombie.AwesomeController do use Zombie.Web, :controller def index(conn, _params) do text conn, FakerElixir.Helper.pick(["zombie", "human"]) end end ``` Now if you keep refreshing your browser, the value should change. Awesome, you just understood how to use Faker. Summary ========== [Functions](#functions) ------------------------ [get\_locale()](#get_locale/0) Return the current locale set [set\_locale(locale)](#set_locale/1) The default locale used by FakerElixir is `:en` Functions ============ get\_locale() Return the current locale set ``` iex> FakerElixir.get_locale :en ``` set\_locale(locale) The default locale used by FakerElixir is `:en`. Right now only 4 locales are available: `:fr`, `:en`, `:es`, `:it`. If you set a different locale, FakerElixir will just fallback to `:en` (If you didn’t provide a custom locale) Note: Keep in mind you can set the locale at the runtime, the locale set will keep his state until you set another locale Examples -------- ``` iex> FakerElixir.set_locale(:en) :ok iex> FakerElixir.Address.city "Baltimore" iex> FakerElixir.set_locale(:fr) :ok iex> FakerElixir.Address.city "Issy-les-Moulineaux" ``` FakerElixir.Address – Faker Elixir (octopus) v1.0.2 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; Faker Elixir (octopus) v1.0.2 FakerElixir.Address =================================================== Generate fake data for the domain address Summary ========== [Functions](#functions) ------------------------ [building\_number()](#building_number/0) Return building number [city()](#city/0) Return city name [country()](#country/0) Return country name [country\_code()](#country_code/0) Return country code [latitude()](#latitude/0) Return a latitude [longitude()](#longitude/0) Return a longitude [make\_country()](#make_country/0) Return country struct with code & name [secondary\_address()](#secondary_address/0) Return secondary address [state()](#state/0) Return a state name [state\_code()](#state_code/0) Return a state code [street\_address()](#street_address/0) Return street address [street\_name()](#street_name/0) Return street name [street\_suffix()](#street_suffix/0) Return street suffix [time\_zone()](#time_zone/0) Return a time zone [zip\_code()](#zip_code/0) Return a zip code Functions ============ building\_number() Return building number Examples -------- ``` iex> FakerElixir.Address.building_number "542" ``` city() Return city name Examples -------- ``` iex> FakerElixir.Address.city "Portland" ``` country() Return country name Examples -------- ``` iex> FakerElixir.Address.country "Iceland" ``` country\_code() Return country code Examples -------- ``` iex> FakerElixir.Address.country_code "NY" ``` latitude() Return a latitude Examples -------- ``` iex> FakerElixir.Address.latitude -71.67369045432866 ``` longitude() Return a longitude Examples -------- ``` iex> FakerElixir.Address.longitude -114.67722189422487 ``` make\_country() Return country struct with code & name. Examples -------- ``` iex> FakerElixir.Address.make_country %{code: "MY", name: "Malaysia"} ``` secondary\_address() Return secondary address Examples -------- ``` iex> FakerElixir.Address.secondary_address "Apt. 752" ``` state() Return a state name Examples -------- ``` iex> FakerElixir.Address.state "New Jersey" ``` state\_code() Return a state code Examples -------- ``` iex> FakerElixir.Address.state_code "TX" ``` street\_address() Return street address Examples -------- ``` iex> FakerElixir.Address.street_address "786 Willow Parkways" ``` street\_name() Return street name Examples -------- ``` iex> FakerElixir.Address.street_name "McLaughlin Mills" ``` street\_suffix() Return street suffix Examples -------- ``` iex> FakerElixir.Address.street_suffix "Lodge" ``` time\_zone() Return a time zone Examples -------- ``` iex> FakerElixir.Address.time_zone "Europe/Sarajevo" ``` zip\_code() Return a zip code Examples -------- ``` iex> FakerElixir.Address.zip_code "59146-7626" ``` FakerElixir.App – Faker Elixir (octopus) v1.0.2 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; Faker Elixir (octopus) v1.0.2 FakerElixir.App =============================================== Generate fake data for the domain app Summary ========== [Functions](#functions) ------------------------ [author()](#author/0) Return an author name [name()](#name/0) Return an application name [version()](#version/0) Return a version number Functions ============ author() Return an author name Examples -------- ``` iex> FakerElixir.App.author "Antonio Konopelski" ``` name() Return an application name Examples -------- ``` iex> FakerElixir.App.name "Chocolada" ``` version() Return a version number Examples -------- ``` iex> FakerElixir.App.version "8.1.7" ``` FakerElixir.Avatar – Faker Elixir (octopus) v1.0.2 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; Faker Elixir (octopus) v1.0.2 FakerElixir.Avatar ================================================== Generate fake data for the domain avatar Summary ========== [Functions](#functions) ------------------------ [robohash()](#robohash/0) Return avatar url of a robot with a `size` of `300x300` [robohash(slug)](#robohash/1) Return avatar url of a robot with the `slug` given and a `size` of `300x300` [robohash(slug, size)](#robohash/2) Return avatar url of a robot with the `slug` and `size` given [robohash(slug, size, type)](#robohash/3) Return avatar url of a robot with the `slug`, `size` and `type` given [robohash(slug, size, type, set)](#robohash/4) Return avatar url of a robot with the `slug`, `size`, `type` and `set` given [robohash(slug, size, type, set, bgset)](#robohash/5) Return avatar url of a robot with the `slug`, `size`, `type`, `set` and `bgset` given Functions ============ robohash() Return avatar url of a robot with a `size` of `300x300` Examples -------- ``` iex> FakerElixir.Avatar.robohash "https://robohash.org/fceuxke.png?size=300x300" ``` robohash(slug) Return avatar url of a robot with the `slug` given and a `size` of `300x300` Examples -------- ``` iex> FakerElixir.Avatar.robohash("zombies-must-die") "https://robohash.org/zombies-must-die.png?size=300x300" ``` robohash(slug, size) Return avatar url of a robot with the `slug` and `size` given Examples -------- ``` iex> FakerElixir.Avatar.robohash("zombies-forever", "400x400") "https://robohash.org/zombies-forever.png?size=400x400" ``` robohash(slug, size, type) Return avatar url of a robot with the `slug`, `size` and `type` given Examples -------- ``` iex> FakerElixir.Avatar.robohash("i-love-a-zombie", "300x300", "jpg") "https://robohash.org/i-love-a-zombie.jpg?size=300x300" ``` robohash(slug, size, type, set) Return avatar url of a robot with the `slug`, `size`, `type` and `set` given Examples -------- ``` iex > FakerElixir.Avatar.robohash("boring-slug", "230x230", "bmp", "set1") "https://robohash.org/boring-slug.bmp?size=230x230&set=set1" ``` robohash(slug, size, type, set, bgset) Return avatar url of a robot with the `slug`, `size`, `type`, `set` and `bgset` given Examples -------- ``` iex> FakerElixir.Avatar.robohash("ahahahaha", "198x198", "jpg", "set2", "bg2") "https://robohash.org/ahahahaha.jpg?size=198x198&set=set2&bgset=bg2" ``` FakerElixir.Bank – Faker Elixir (octopus) v1.0.2 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; Faker Elixir (octopus) v1.0.2 FakerElixir.Bank ================================================ Generate fake date related to the Bank domain Summary ========== [Functions](#functions) ------------------------ [credit\_card\_cvv()](#credit_card_cvv/0) Generate a credit card CVV [credit\_card\_expiration\_date()](#credit_card_expiration_date/0) Return a credit card expiration date (more chances to be a valid one) [credit\_card\_expiration\_date(atom)](#credit_card_expiration_date/1) Return a valid or invalid credit card expiration date [credit\_card\_number()](#credit_card_number/0) Return a credit card number [credit\_card\_type()](#credit_card_type/0) Return a credit card type [make\_credit\_card()](#make_credit_card/0) Generate a credit card with details [name()](#name/0) Return the name of a bank Functions ============ credit\_card\_cvv() Generate a credit card CVV Examples -------- ``` iex> FakerElixir.Bank.credit_card_cvv "914" ``` credit\_card\_expiration\_date() Return a credit card expiration date (more chances to be a valid one) Examples -------- ``` iex> FakerElixir.Bank.credit_card_expiration_date "08/2017" ``` credit\_card\_expiration\_date(atom) Return a valid or invalid credit card expiration date Examples -------- ``` iex> FakerElixir.Bank.credit_card_expiration_date(:valid) "06/2023" ``` ``` iex> FakerElixir.Bank.credit_card_expiration_date(:invalid) "03/2009" ``` credit\_card\_number() Return a credit card number Examples -------- ``` iex> FakerElixir.Bank.credit_card_number "34521702751096" ``` credit\_card\_type() Return a credit card type Examples -------- ``` iex> FakerElixir.Bank.credit_card_type "MasterCard" ``` make\_credit\_card() Generate a credit card with details Examples -------- ``` iex> FakerElixir.Bank.make_credit_card %{cvv: "188", expiration_date: "12/2006", name: "LLEWELLYN WEBER", number: "601141761193874", type: "Discover Card"} ``` name() Return the name of a bank Examples -------- ``` iex> FakerElixir.Bank.name "Goldman Sachs Group" ``` FakerElixir.Boolean – Faker Elixir (octopus) v1.0.2 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; Faker Elixir (octopus) v1.0.2 FakerElixir.Boolean =================================================== Generate fake data for the domain boolean Summary ========== [Functions](#functions) ------------------------ [boolean()](#boolean/0) Return a boolean with **equal** chance to be `true` or `false` [boolean(ratio)](#boolean/1) Return a boolean with a **ratio** chance to be `true` Functions ============ boolean() Return a boolean with **equal** chance to be `true` or `false` Examples -------- ``` iex> FakerElixir.Boolean.boolean true ``` boolean(ratio) Return a boolean with a **ratio** chance to be `true` Examples -------- It will be always `true`: ``` iex> FakerElixir.Boolean.boolean(1) true ``` It will be always `false`: ``` iex> FakerElixir.Boolean.boolean(0) false ``` 10% chance to be `true`: ``` iex> FakerElixir.Boolean.boolean(0.1) false ``` 90% chance to be `true`: ``` iex> FakerElixir.Boolean.boolean(0.9) true ``` FakerElixir.Color – Faker Elixir (octopus) v1.0.2 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; Faker Elixir (octopus) v1.0.2 FakerElixir.Color ================================================= Generate fake date for the domain Color Summary ========== [Functions](#functions) ------------------------ [hex()](#hex/0) Return hex [hsl()](#hsl/0) Return hsl [make\_hsl()](#make_hsl/0) Return a list with hsl values [make\_rgb()](#make_rgb/0) Return a list with rgb values [name()](#name/0) Return name [rgb()](#rgb/0) Return rgb Functions ============ hex() Return hex Examples -------- ``` iex> FakerElixir.Color.hex "#1671B0" ``` hsl() Return hsl Examples -------- ``` iex> FakerElixir.Color.hsl "hsl(130, 40%, 41%)" ``` make\_hsl() Return a list with hsl values Examples -------- ``` iex> FakerElixir.Color.make_hsl [236, "13%", "77%"] ``` make\_rgb() Return a list with rgb values Examples -------- ``` iex> FakerElixir.Color.make_rgb [65, 137, 5] ``` name() Return name Examples -------- ``` iex> FakerElixir.Color.name "white" ``` rgb() Return rgb Examples -------- ``` iex> FakerElixir.Color.rgb "rgb(152, 228, 47)" ``` FakerElixir.Commerce – Faker Elixir (octopus) v1.0.2 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; Faker Elixir (octopus) v1.0.2 FakerElixir.Commerce ==================================================== Generate fake data for the domain Commerce Summary ========== [Functions](#functions) ------------------------ [coupon()](#coupon/0) Return discount code [coupon(nb\_digits)](#coupon/1) Return discount code with the number of digits wanted [product()](#product/0) Return product name [sku()](#sku/0) Return a common Stock-keeping unit Functions ============ coupon() Return discount code Example ------- ``` iex> FakerElixir.Commerce.coupon "StellarDeal683" ``` coupon(nb\_digits) Return discount code with the number of digits wanted Example ------- ``` FakerElixir.Commerce.coupon(4) "PremiumSale5496" ``` product() Return product name Example ------- ``` FakerElixir.Commerce.product "Tasty Fresh Skirt" ``` sku() Return a common Stock-keeping unit Example ------- ``` FakerElixir.Commerce.sku "3YW9Q3S6" ``` FakerElixir.Crypto – Faker Elixir (octopus) v1.0.2 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; Faker Elixir (octopus) v1.0.2 FakerElixir.Crypto ================================================== Generate fake data for the domain crypto Summary ========== [Functions](#functions) ------------------------ [md5()](#md5/0) Return `md5` hash [sha1()](#sha1/0) Return `sha1` hash [sha224()](#sha224/0) Return `sha224` hash [sha256()](#sha256/0) Return `sha256` hash [sha384()](#sha384/0) Return `sha384` hash [sha512()](#sha512/0) Return `sha512` hash Functions ============ md5() Return `md5` hash Example ------- ``` iex> FakerElixir.Crypto.md5 "9FE3CFD7113162785ED3D59C73166766" ``` sha1() Return `sha1` hash Example ------- ``` iex> FakerElixir.Crypto.sha1 "7D6757DDD455FC6AA25C0D78C1CDE73B21028CD7" ``` sha224() Return `sha224` hash Example ------- ``` iex> FakerElixir.Crypto.sha224 "824B34965B6A3E48BE71E09A54F63BC216845D794EB378E756EE759D" ``` sha256() Return `sha256` hash Example ------- ``` iex> FakerElixir.Crypto.sha256 "4762E04FB860A8A7C4D58B495DE133355D069CF618A55BBACA98583DF105818C" ``` sha384() Return `sha384` hash Example ------- ``` iex> FakerElixir.Crypto.sha384 "9C01EBA98F4A52F76948D48A0FB3C63C26DE451667F8957C6420B6D26183F93C28A3A344406C77FF74C877EE5AA3AD10" ``` sha512() Return `sha512` hash Example ------- ``` iex> FakerElixir.Crypto.sha512 "06C1CC54DC49E53B1274D9A0DD951B76DD45731E0AB319D98575DEA1955F6A0B20D5B70548190119AED52A5254127A60511257673C332F759F9510B8F32AAC26" ``` FakerElixir.Currency – Faker Elixir (octopus) v1.0.2 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; Faker Elixir (octopus) v1.0.2 FakerElixir.Currency ==================================================== Generate fake data for the domain currency Summary ========== [Functions](#functions) ------------------------ [code()](#code/0) Return currency code [make()](#make/0) Return currency struct with different keys [name()](#name/0) Return currency name [symbol()](#symbol/0) Return currency symbol Functions ============ code() Return currency code Example ------- ``` iex> FakerElixir.Currency.code "ZMK" ``` make() Return currency struct with different keys Example ------- ``` iex> FakerElixir.Currency.make %{code: "UAH", country: "Ukraine", name: "Ukrainian Hryvnia", symbol: "β‚΄"} ``` name() Return currency name Example ------- ``` iex> FakerElixir.Currency.name "East Caribbean Dollar" ``` symbol() Return currency symbol Example ------- ``` iex> FakerElixir.Currency.symbol "€" ``` FakerElixir.Date – Faker Elixir (octopus) v1.0.2 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; Faker Elixir (octopus) v1.0.2 FakerElixir.Date ================================================ Generate fake data for the domain Date Summary ========== [Functions](#functions) ------------------------ [backward(range)](#backward/1) Return a date in the future [birthday()](#birthday/0) Return birthday date [forward(range)](#forward/1) Return a date in the future Functions ============ backward(range) Return a date in the future Examples -------- Context: 19 august 2016 ``` # Generate a random date time for yesterday iex > FakerElixir.Date.backward(1) "2016-08-18 05:58:04Z" # Generate a random date time for the day before yesterday iex > FakerElixir.Date.backward(2) "2016-08-17 00:15:28Z" # Generate a random date time between yesterday and the day before yesterday iex > FakerElixir.Date.backward(1..2) "2016-08-17 03:48:32Z" ``` birthday() Return birthday date Examples -------- ``` iex > FakerElixir.Date.birthday "1988-03-07 16:28:37Z" ``` forward(range) Return a date in the future Examples -------- Context: 19 august 2016 ``` # Generate a random date time for tomorrow iex > FakerElixir.Date.forward(1) "2016-08-20 19:29:28Z" # Generate a random date time for after tomorrow iex > FakerElixir.Date.forward(2) "2016-08-21 19:06:12Z" # Generate a random date time between tomorrow and after tomorrow iex > FakerElixir.Date.forward(1..2) "2016-08-20 11:18:18Z" ``` FakerElixir.File – Faker Elixir (octopus) v1.0.2 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; Faker Elixir (octopus) v1.0.2 FakerElixir.File ================================================ Generate fake data for the domain File Summary ========== [Functions](#functions) ------------------------ [extension()](#extension/0) Return an extension [extension(category)](#extension/1) Return an extension for the category given [mime()](#mime/0) Return a mime [mime(category)](#mime/1) Return a mime for the category given [name()](#name/0) Return a file name [name(category)](#name/1) Return a file name for the category given Functions ============ extension() Return an extension Examples -------- ``` iex> FakerElixir.File.extension "png" ``` extension(category) Return an extension for the category given Allowed categories: `:image`, `:audio`, `:text`, `:video`, `:office` Examples -------- ``` iex> FakerElixir.File.extension(:audio) "mp3" ``` mime() Return a mime Examples -------- ``` iex> FakerElixir.File.mime "application/javascript" ``` mime(category) Return a mime for the category given Allowed categories: `:application`, `:audio`, `:image`, `:message`, `:model`, `:multipart`, `:text`, `:video` Examples -------- ``` iex> FakerElixir.File.mime(:message) "message/rfc822" ``` name() Return a file name Examples -------- ``` iex> FakerElixir.File.name "aut.css" ``` name(category) Return a file name for the category given Allowed categories: `:image`, `:audio`, `:text`, `:video`, `:office` Examples -------- ``` iex> FakerElixir.File.name(:video) mollitia.avi" ``` FakerElixir.Helper – Faker Elixir (octopus) v1.0.2 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; Faker Elixir (octopus) v1.0.2 FakerElixir.Helper ================================================== Provide useful helpers Summary ========== [Functions](#functions) ------------------------ [cycle(id, enumerable)](#cycle/2) Will iterate through the enumerable as a constant cycle. Really useful when you want to seed your database with a pre-defined cycle [letterify(pattern)](#letterify/1) Fill a pattern with random letters [numerify(pattern)](#numerify/1) Fill a pattern with random number [pick(enumerable)](#pick/1) Pick randomly a value in an enumerable [unique!(id, func)](#unique!/2) Will generate only unique values for the function given. If **unique!/2** can’t generate an unique value after X tries it raises an **OverflowError** Functions ============ cycle(id, enumerable) Will iterate through the enumerable as a constant cycle. Really useful when you want to seed your database with a pre-defined cycle **Warning:** The id (first param given) should be unique for each different cycle Examples -------- #### Basic ``` iex(1)> FakerElixir.Helper.cycle(:zombies, ["Peter", "Audrey", "Laurent", "Frank"]) "Peter" iex(2)> FakerElixir.Helper.cycle(:zombies, ["Peter", "Audrey", "Laurent", "Frank"]) "Audrey" iex(3)> FakerElixir.Helper.cycle(:zombies, ["Peter", "Audrey", "Laurent", "Frank"]) "Laurent" iex(4)> FakerElixir.Helper.cycle(:zombies, ["Peter", "Audrey", "Laurent", "Frank"]) "Frank" iex(5)> FakerElixir.Helper.cycle(:zombies, ["Peter", "Audrey", "Laurent", "Frank"]) "Peter" iex(6)> FakerElixir.Helper.cycle(:zombies, ["Peter", "Audrey", "Laurent", "Frank"]) "Audrey" iex(7)> FakerElixir.Helper.cycle(:zombies, ["Peter", "Audrey", "Laurent", "Frank"]) "Laurent" iex(8)> FakerElixir.Helper.cycle(:zombies, ["Peter", "Audrey", "Laurent", "Frank"]) "Frank" # ... and so on. ``` #### Seed example ``` defmodule Seed do alias FakerElixir.Helper def make do warriors = Stream.repeatedly(fn() -> fixture(:warrior) end) |> Enum.take(5) end defp fixture(:warrior) do %{ name: Helper.cycle(:name, ["anubis", "zeus", "behamut"]), lvl: Helper.cycle(:lvl, [10, 25, 90]) } end end iex> Seed.make [ %{lvl: 10, name: "anubis"}, %{lvl: 25, name: "zeus"}, %{lvl: 90, name: "behamut"}, %{lvl: 10, name: "anubis"}, %{lvl: 25, name: "zeus"} ] ``` letterify(pattern) Fill a pattern with random letters Examples -------- ``` iex > FakerElixir.Helper.letterify("###") "ahh" iex > FakerElixir.Helper.letterify("#.#.#.#") "k.e.n.u" ``` numerify(pattern) Fill a pattern with random number Examples -------- ``` iex > FakerElixir.Helper.numerify("Apt. ###") "Apt. 902" iex > FakerElixir.Helper.numerify("06.##.##.##.##") "06.67.18.21.27" ``` pick(enumerable) Pick randomly a value in an enumerable Examples -------- ``` iex> FakerElixir.Helper.pick(["paris", "athens", "london"]) "london" ``` ``` iex> FakerElixir.Helper.pick(0..100) 51 ``` unique!(id, func) Will generate only unique values for the function given. If **unique!/2** can’t generate an unique value after X tries it raises an **OverflowError**. **Warning:** The id (first param given) should be unique for each different unique functions Examples -------- ### Generate unique emails ``` # Create stream to generate unique emails stream = Stream.repeatedly(fn -> FakerElixir.Helper.unique!(:unique_emails, fn -> FakerElixir.Internet.email(:popular) end) end) # Grab 400 unique emails emails = stream |> Enum.take(400) ``` ### Basic Seed In this example you are sure the names and emails generated in the fixture are unique ! ``` defmodule Seed do alias FakerElixir.Helper def make do warriors = Stream.repeatedly(fn() -> fixture(:zombie) end) |> Enum.take(50) end defp fixture(:zombie) do %{ name: Helper.unique!(:names, fn -> FakerElixir.Name.name end), email: Helper.unique!(:emails, fn -> FakerElixir.Internet.email(:popular) end) } end end iex> Seed.make [ %{email: "leclerc@gmail.com", name: "Mathilde Rousselle"}, %{email: "sarah@gmail.com", name: "Ambre Marie"}, %{email: "lola@hotmail.fr", name: "Paul Carton"}, %{email: "raffin.louise@gmail.com", name: "Lola Beguin"}, %{email: "de.elisa@yahoo.fr", name: "Enzo Perret"}, %{email: "clemence.dubos@free.fr", name: "ChloΓ© Devaux"}, %{email: "justine@hotmail.fr", name: "Mathilde Pouliquen"}, %{email: "rousselle.jeanne@hotmail.fr", name: "LΓ©o Monin"}, %{email: "monin.julien@gmail.com", ...}, %{email: "metais.celia@yahoo.fr", ...} ] ``` FakerElixir.Internet – Faker Elixir (octopus) v1.0.2 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; Faker Elixir (octopus) v1.0.2 FakerElixir.Internet ==================================================== Generate fake data for the domain Internet Summary ========== [Functions](#functions) ------------------------ [email()](#email/0) Return an email [email(name)](#email/1) Return an email with the name given [email(atom, name)](#email/2) Examples -------- [password(atom)](#password/1) Return a password given by an user [url()](#url/0) Return an url [url(atom)](#url/1) Return an url with https:// [user\_agent()](#user_agent/0) Return a user agent string [user\_agent(type)](#user_agent/1) Return a user agent string for the type given [user\_name()](#user_name/0) Return an user name [user\_name(name)](#user_name/1) Return an user name for the name given Functions ============ email() Return an email Examples -------- ``` iex> FakerElixir.Internet.email "demarcus@ezra.io" ``` You can set `:popular` to generate an email with a popular domain ``` FakerElixir.Internet.email(:popular) "candelario@gmail.com" ``` You can set `:school` to generate an email with an university domain ``` FakerElixir.Internet.email(:school) "trycia@uab.edu" ``` email(name) Return an email with the name given Examples -------- ``` iex> FakerElixir.Internet.email("Peter Moleski") "peter.moleski@ethel.net" ``` email(atom, name) Examples -------- ``` iex> FakerElixir.Internet.email(:popular, "Peter Sobieska") "peter.sobieska@hotmail.com" ``` ``` iex> FakerElixir.Internet.email(:school, "Harry potter") "harry.potter@pittstate.edu" ``` password(atom) Return a password given by an user Examples -------- ``` iex> FakerElixir.Internet.password(:weak) "robbie" ``` ``` iex> FakerElixir.Internet.password(:normal) "francesco6" ``` ``` iex> FakerElixir.Internet.password(:strong) "tOu%Mt*B16ueLs!0uA3rDA" ``` url() Return an url Examples -------- ``` iex> FakerElixir.Internet.url "http://www.alejandra-connelly.com/" ``` url(atom) Return an url with https:// Examples -------- ``` iex> FakerElixir.Internet.url(:safe) "https://www.stefan-little.org/" ``` user\_agent() Return a user agent string Examples -------- ``` iex> FakerElixir.Internet.user_agent "Mozilla/5.0 (iPad; CPU OS 8_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B411 Safari/600.1.4" ``` user\_agent(type) Return a user agent string for the type given Allowed types: `:bot`, `:browser`, `:chrome`, `:desktop`, `:firefox`, `:console`, `:ie`, `:opera`, `:phone`, `:playstation`, `:safari`, `:tablet`, `:wii`, `:xbox` Note: * `:browser` randomly picks a user agent from `:ie`, `:opera`, `:firefox`, `:safari` * `:console` randomly picks a user agent from `:playstation`, `:xbox`, `:wii` Examples -------- ``` iex> FakerElixir.Internet.user_agent(:chrome) "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36" ``` user\_name() Return an user name Examples -------- ``` iex> FakerElixir.Internet.user_name "chadrick" ``` user\_name(name) Return an user name for the name given Examples -------- ``` iex> FakerElixir.Internet.user_name("Jeremie GES") "jeremie.ges" ``` FakerElixir.Lorem – Faker Elixir (octopus) v1.0.2 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; Faker Elixir (octopus) v1.0.2 FakerElixir.Lorem ================================================= Generate fake data for the domain lorem Summary ========== [Functions](#functions) ------------------------ [character()](#character/0) Return an alpha numeric character [characters()](#characters/0) Return some alpha numeric characters [characters(range)](#characters/1) Return `x` number of alpha numeric characters within the `range` given or `number` given [sentence()](#sentence/0) Return a sentence [sentences()](#sentences/0) Return some sentences [sentences(range)](#sentences/1) Return `x` sentences within the `range` given or `number` given [word()](#word/0) Return a word [words()](#words/0) Return some words [words(range)](#words/1) Return `x` number of words within the `range` given or `number` given Functions ============ character() Return an alpha numeric character Examples -------- ``` iex> FakerElixir.Lorem.character "c" ``` characters() Return some alpha numeric characters Examples -------- ``` iex> FakerElixir.Lorem.characters "0ycp0x" ``` characters(range) Return `x` number of alpha numeric characters within the `range` given or `number` given Examples -------- ``` iex> FakerElixir.Lorem.characters(10..30) "rhch0bceu38240vds" ``` ``` iex> FakerElixir.Lorem.characters(10) "tw3aw6n3ez" ``` sentence() Return a sentence Examples -------- ``` iex> FakerElixir.Lorem.sentence "Qui maiores quaerat iusto quod in totam consequatur perspiciatis necessitatibus vitae ut aut earum voluptas." ``` sentences() Return some sentences Examples -------- ``` iex> FakerElixir.Lorem.sentences "Aspernatur illo dicta quia ut qui nihil distinctio debitis est laudantium ut ipsa facilis dolorum. Sed omnis natus ut officia magnam aut ut vel aperiam." ``` sentences(range) Return `x` sentences within the `range` given or `number` given Examples -------- ``` iex> FakerElixir.Lorem.sentences(3..5) "Culpa velit labore tenetur quia ipsum ullam dolore ut et commodi. Fuga quia dolore nihil non laudantium molestias nemo voluptas ea voluptatum aut aspernatur voluptatem. Repellendus illo dolorem incidunt quasi possimus quam quae alias recusandae unde aliquam optio rem velit sint eum. Quo aliquid itaque ratione eum blanditiis commodi explicabo perspiciatis nesciunt pariatur dolor eius voluptas." ``` ``` iex> FakerElixir.Lorem.sentences(2) "Qui omnis distinctio optio quisquam non optio id sequi assumenda corrupti distinctio et et inventore libero mollitia et. Cum doloremque sapiente mollitia nulla harum pariatur natus voluptates maxime consequuntur sunt commodi blanditiis ut nam." ``` word() Return a word Examples -------- ``` iex> FakerElixir.Lorem.word "et" ``` words() Return some words Examples -------- ``` iex> FakerElixir.Lorem.words "pariatur ea eos quibusdam velit debitis et" ``` words(range) Return `x` number of words within the `range` given or `number` given Examples -------- ``` iex> FakerElixir.Lorem.words(2..4) "laudantium rem saepe qui" ``` ``` iex> FakerElixir.Lorem.words(3) "sapiente optio dolor" ``` FakerElixir.Name – Faker Elixir (octopus) v1.0.2 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; Faker Elixir (octopus) v1.0.2 FakerElixir.Name ================================================ Generate fake data for the domain lorem Summary ========== [Functions](#functions) ------------------------ [first\_name()](#first_name/0) Return a first name [last\_name()](#last_name/0) Return a last name [name()](#name/0) Return a first name and a last name [name\_with\_middle()](#name_with_middle/0) Return a first name, middle name and last name [prefix()](#prefix/0) Return a prefix [suffix()](#suffix/0) Return a suffix [title()](#title/0) Return a title Functions ============ first\_name() Return a first name Examples -------- ``` iex> FakerElixir.Name.first_name "Ari" ``` last\_name() Return a last name Examples -------- ``` iex> FakerElixir.Name.last_name "Miller" ``` name() Return a first name and a last name Examples -------- ``` iex> FakerElixir.Name.name "Louie Corkery" ``` name\_with\_middle() Return a first name, middle name and last name Examples -------- ``` iex> FakerElixir.Name.name_with_middle "Annalise Francesco Schowalter" ``` prefix() Return a prefix Examples -------- ``` iex> FakerElixir.Name.prefix "Mr." ``` suffix() Return a suffix Examples -------- ``` iex> FakerElixir.Name.suffix "PhD" ``` title() Return a title Examples -------- ``` iex> FakerElixir.Name.title "Principal Branding Orchestrator" ``` FakerElixir.Number – Faker Elixir (octopus) v1.0.2 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; Faker Elixir (octopus) v1.0.2 FakerElixir.Number ================================================== Generate fake data for the domain Number Summary ========== [Functions](#functions) ------------------------ [between(range)](#between/1) Return a number between the range given [between(min, max)](#between/2) Return a number between the min and max given [decimal()](#decimal/0) Return a random decimal number [decimal(left\_digits)](#decimal/1) Return a random decimal number with `x` left digits [decimal(left\_digits, right\_digits)](#decimal/2) Return a random decimal number with `x` left digits and `x` right digits [digit()](#digit/0) Return a digit [digits()](#digits/0) Return random digits [digits(length)](#digits/1) Return `x` digits Functions ============ between(range) Return a number between the range given Examples -------- ``` iex> FakerElixir.Number.between(15..150) 130 ``` between(min, max) Return a number between the min and max given Examples -------- ``` iex> FakerElixir.Number.between(15, 150) 18 iex> FakerElixir.Number.between(11.22, 13.88) 11.24 iex> FakerElixir.Number.between(12, 12.35) 12.11 ``` decimal() Return a random decimal number Examples -------- ``` iex> FakerElixir.Number.decimal "70.8" ``` decimal(left\_digits) Return a random decimal number with `x` left digits Examples -------- ``` iex> FakerElixir.Number.decimal(3) "918.43" ``` decimal(left\_digits, right\_digits) Return a random decimal number with `x` left digits and `x` right digits Examples -------- ``` iex> FakerElixir.Number.decimal(1, 3) "2.298" ``` digit() Return a digit Examples -------- ``` iex> FakerElixir.Number.digit 3 ``` digits() Return random digits Examples -------- ``` iex> FakerElixir.Number.digits 452 ``` digits(length) Return `x` digits Examples -------- ``` iex> FakerElixir.Number.digits(4) 7025 ``` FakerElixir.Phone – Faker Elixir (octopus) v1.0.2 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; Faker Elixir (octopus) v1.0.2 FakerElixir.Phone ================================================= Generate fake date for the domain Phone Summary ========== [Functions](#functions) ------------------------ [cell()](#cell/0) Return a cell phone number [home()](#home/0) Return a domestic phone number Functions ============ cell() Return a cell phone number Examples -------- ``` iex> FakerElixir.Phone.cell "1-714-443-8836" ``` home() Return a domestic phone number Examples -------- ``` iex> FakerElixir.Phone.home "355.369.3998 x19434" ``` OverflowError – Faker Elixir (octopus) v1.0.2 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; Faker Elixir (octopus) v1.0.2 OverflowError exception ========================================================== Summary ========== [Functions](#functions) ------------------------ [exception(msg)](#exception/1) Callback implementation for `c:Exception.exception/1` [message(exception)](#message/1) Callback implementation for `c:Exception.message/1` Functions ============ exception(msg) #### Specs ``` exception([String.t](http://elixir-lang.org/docs/stable/elixir/String.html#t:t/0)) :: [Exception.t](http://elixir-lang.org/docs/stable/elixir/Exception.html#t:t/0) ``` ``` exception([Keyword.t](http://elixir-lang.org/docs/stable/elixir/Keyword.html#t:t/0)) :: [Exception.t](http://elixir-lang.org/docs/stable/elixir/Exception.html#t:t/0) ``` Callback implementation for `c:Exception.exception/1`. message(exception) #### Specs ``` message([Exception.t](http://elixir-lang.org/docs/stable/elixir/Exception.html#t:t/0)) :: [String.t](http://elixir-lang.org/docs/stable/elixir/String.html#t:t/0) ``` Callback implementation for `c:Exception.message/1`.
alix
hex
Alix β€” Alix v0.1.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/jsolana/alix/blob/main/lib/alix.ex#L1 "View Source") Alix (Alix v0.1.0) ===================================================================================================================== Documentation for [`Alix`](Alix.html#content). [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [hello()](#hello/0) Hello world. [Link to this section](#functions) Functions ============================================= [Link to this function](#hello/0 "Link to this function") hello() ======= [View Source](https://github.com/jsolana/alix/blob/main/lib/alix.ex#L15 "View Source") Hello world. [examples](#hello/0-examples) Examples ---------------------------------------- ``` iex> Alix.hello() :world ``` Alix β€” Alix v0.1.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/jsolana/alix/blob/main/README.md#L1 "View Source") Alix ===================================================================================================== **TODO: Add description** [installation](#installation) Installation -------------------------------------------- If [available in Hex](https://hex.pm/docs/publish), the package can be installed by adding `alix` to your list of dependencies in `mix.exs`: ``` def deps do [ {:alix, "~> 0.1.0"} ] end ``` Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc) and published on [HexDocs](https://hexdocs.pm). Once published, the docs can be found at <https://hexdocs.pm/alix>. [← Previous Page API Reference](api-reference.html) [Next Page β†’ LICENSE](license.html)
geocalc
hex
Geocalc β€” Geocalc v0.8.5 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/README.md#L1 "View Source") Geocalc =========================================================================================================== [![Build Status](https://github.com/yltsrc/geocalc/actions/workflows/elixir.yml/badge.svg?branch=master)](https://github.com/yltsrc/geocalc/actions/workflows/elixir.yml?query=branch%3Amaster) [![Module Version](https://img.shields.io/hexpm/v/geocalc.svg)](https://hex.pm/packages/geocalc) [![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/geocalc/) [![Total Download](https://img.shields.io/hexpm/dt/geocalc.svg)](https://hex.pm/packages/geocalc) [![License](https://img.shields.io/hexpm/l/geocalc.svg)](https://github.com/yltsrc/geocalc/blob/master/LICENSE.md) [![Last Updated](https://img.shields.io/github/last-commit/yltsrc/geocalc.svg)](https://github.com/yltsrc/geocalc/commits/master) Calculate distance, bearing and more between latitude/longitude points. All the formulas are adapted from <http://www.movable-type.co.uk/scripts/latlong.html>. Area calculations are implemented from [ETSI EN 302 931 v1.1.1](https://www.etsi.org/deliver/etsi_en/302900_302999/302931/01.01.01_60/en_302931v010101p.pdf) standard. [installation](#installation) Installation -------------------------------------------- First, add `:geocalc` to your `mix.exs` dependencies: ``` def deps do [ {:geocalc, "~> 0.8"} ] end ``` And then fetch your dependencies: ``` $ mix deps.get ``` [usage](#usage) Usage ----------------------- ### [calculate-distance-in-meters-between-2-points](#calculate-distance-in-meters-between-2-points) Calculate distance (in meters) between 2 points ``` Geocalc.distance\_between([50.0663889, -5.7147222], [58.6438889, -3.07]) # => 968853.5464535094 ``` ### [calculate-if-point-is-inside-a-circle-given-by-a-center-point-and-a-radius-in-meters](#calculate-if-point-is-inside-a-circle-given-by-a-center-point-and-a-radius-in-meters) Calculate if point is inside a circle given by a center point and a radius (in meters) ``` san\_juan = [18.4655, 66.1057] puerto\_rico = [18.2208, 66.5901] Geocalc.within?(170\_000, san\_juan, puerto\_rico) # => true ``` ### [get-destination-point-given-distance-meters-from-start-and-end-point](#get-destination-point-given-distance-meters-from-start-and-end-point) Get destination point given distance (meters) from start and end point ``` Geocalc.destination\_point([50.0663889, -5.7147222], [58.6438889, -3.07], 100\_000) # => {:ok, [50.95412546615634, -5.488452905258299]} ``` ### [get-destination-point-given-distance-meters-and-bearing-from-start-point](#get-destination-point-given-distance-meters-and-bearing-from-start-point) Get destination point given distance (meters) and bearing from start point ``` Geocalc.destination\_point([50.0663889, -5.7147222], 2.123, 100\_000) # => {:ok, [49.58859917965055, -4.533613856982982]} ``` ### [calculate-bearing-from-start-and-end-points](#calculate-bearing-from-start-and-end-points) Calculate bearing from start and end points ``` Geocalc.bearing([50.0663889, -5.7147222], [58.6438889, -3.07]) # => 0.1591708517503001 ``` ### [get-intersection-point-given-start-points-and-bearings](#get-intersection-point-given-start-points-and-bearings) Get intersection point given start points and bearings ``` Geocalc.intersection\_point([50.0663889, -5.7147222], 2.123, [55.0663889, -15.7147222], 2.123) # => {:ok, [48.04228582473962, -1.0347033632388496]} Geocalc.intersection\_point([50.0663889, -5.7147222], 2.123, [50.0663889, -5.7147222], 2.123) # => {:error, "No intersection point found"} ``` ### [get-bounding-box-from-a-point-and-radius](#get-bounding-box-from-a-point-and-radius) Get bounding box from a point and radius ``` berlin = [52.5075419, 13.4251364] radius = 10\_000 Geocalc.bounding\_box(berlin, radius) # => [[52.417520954378574, 13.277235453275123], [52.59756284562143, 13.573037346724874]] ``` ### [get-bounding-box-from-a-list-of-points](#get-bounding-box-from-a-list-of-points) Get bounding box from a list of points ``` berlin = [52.5075419, 13.4251364] rome = [41.9102415, 12.3959161] minsk = [53.8838884, 27.5949741] Geocalc.bounding\_box\_for\_points([berlin, rome, minsk]) # => [[41.9102415, 12.3959161], [53.8838884, 27.5949741]] ``` ### [get-geographical-center-point](#get-geographical-center-point) Get geographical center point ``` berlin = [52.5075419, 13.4251364] london = [51.5286416, -0.1015987] rome = [41.9102415, 12.3959161] Geocalc.geographic\_center([berlin, london, rome]) # => [48.810406537400254, 8.785092188535195] ``` ### [get-maximum-latitude-reached-when-travelling-on-a-great-circle-on-given-bearing-from-the-point](#get-maximum-latitude-reached-when-travelling-on-a-great-circle-on-given-bearing-from-the-point) Get maximum latitude reached when travelling on a great circle on given bearing from the point ``` berlin = [52.5075419, 13.4251364] paris = [48.8588589, 2.3475569] bearing = Geocalc.bearing(berlin, paris) Geocalc.max\_latitude(berlin, bearing) # => 55.953467429882835 ``` ### [get-distance-from-the-point-to-great-circle-defined-by-start-point-and-end-point](#get-distance-from-the-point-to-great-circle-defined-by-start-point-and-end-point) Get distance from the point to great circle defined by start-point and end-point ``` berlin = [52.5075419, 13.4251364] london = [51.5286416, -0.1015987] paris = [48.8588589, 2.3475569] Geocalc.cross\_track\_distance\_to(berlin, london, paris) # => -877680.2992295175 ``` ### [calculate-how-far-the-point-is-along-a-path-from-from-start-point-heading-towards-end-point](#calculate-how-far-the-point-is-along-a-path-from-from-start-point-heading-towards-end-point) Calculate how far the point is along a path from from start-point, heading towards end-point ``` berlin = [52.5075419, 13.4251364] london = [51.5286416, -0.1015987] paris = [48.8588589, 2.3475569] Geocalc.along\_track\_distance\_to(berlin, london, paris) # => 310412.6031976226 ``` ### [get-the-pair-of-meridians-at-which-a-great-circle-defined-by-two-points-crosses-the-given-latitude](#get-the-pair-of-meridians-at-which-a-great-circle-defined-by-two-points-crosses-the-given-latitude) Get the pair of meridians at which a great circle defined by two points crosses the given latitude ``` berlin = [52.5075419, 13.4251364] paris = [48.8588589, 2.3475569] Geocalc.crossing\_parallels(berlin, paris, 12.3456) # => {:ok, 123.179463369946, -39.81144878508576} ``` ### [convert-degrees-to-radians](#convert-degrees-to-radians) Convert degrees to radians ``` Geocalc.degrees\_to\_radians(245) # => -2.007128639793479 ``` ### [convert-radians-to-degrees](#convert-radians-to-degrees) Convert radians to degrees ``` Geocalc.radians\_to\_degrees(1.234) # => 70.70299191914359 ``` [geocalc-shape](#geocalc-shape) Geocalc.Shape ----------------------------------------------- Contains geometrical shapes designed for geofencing calculations, ie: determine if one point is inside or outside a geographical area. Three area shapes are defined: * Circle * Rectangle * Ellipse ### [check-if-a-point-is-inside-an-area](#check-if-a-point-is-inside-an-area) Check if a point is inside an area ``` area = %Geocalc.Shape.Circle{latitude: 48.856614, longitude: 2.3522219, radius: 1000} point = %{lat: 48.856612, lng: 2.3522217} Geocalc.in\_area?(area, point) # => true ``` ### [check-if-a-point-is-outside-an-area](#check-if-a-point-is-outside-an-area) Check if a point is outside an area ``` area = %Geocalc.Shape.Circle{latitude: 48.856614, longitude: 2.3522219, radius: 10} point = %{lat: 48.856418, lng: 2.365871} Geocalc.outside\_area?(area, point) # => true ``` ### [check-if-a-point-is-at-the-border-of-an-area](#check-if-a-point-is-at-the-border-of-an-area) Check if a point is at the border of an area ``` area = %Geocalc.Shape.Circle{latitude: 48.856614, longitude: 2.3522219, radius: 1000} point = %{lat: 48.856418, lng: 2.365871} Geocalc.at\_area\_border?(area, point) # => true ``` ### [check-if-a-point-at-the-center-point-of-an-area](#check-if-a-point-at-the-center-point-of-an-area) Check if a point at the center point of an area ``` area = %Geocalc.Shape.Circle{latitude: 48.856614, longitude: 2.3522219, radius: 100} point = %{lat: 48.856614, lng: 2.3522219} Geocalc.at\_center\_point?(area, point) # => true ``` [geocalc-point-protocol](#geocalc-point-protocol) Geocalc.Point protocol -------------------------------------------------------------------------- Everything which implements [`Geocalc.Point`](Geocalc.Point.html) protocol can be passed as a point argument for any function in this library. We already have implementations for [`List`](https://hexdocs.pm/elixir/List.html), [`Tuple`](https://hexdocs.pm/elixir/Tuple.html) and [`Map`](https://hexdocs.pm/elixir/Map.html). You can define your own implementations if you need, everything we need to know to do calculations are `latitude` and `longitude`. [geocalc-dms](#geocalc-dms) Geocalc.DMS ----------------------------------------- [`Geocalc.DMS`](Geocalc.DMS.html) is a struct which contains degrees, minutes and seconds, which also can be used in [`Geocalc.Point`](Geocalc.Point.html). ### [additionally-now-there-is-an-options-to-convert-geocalc-dms-to-decimal-degrees](#additionally-now-there-is-an-options-to-convert-geocalc-dms-to-decimal-degrees) Additionally now there is an options to convert [`Geocalc.DMS`](Geocalc.DMS.html) to decimal degrees. ``` dms = %Geocalc.DMS{hours: 13, minutes: 31, seconds: 59.998, direction: "N"} Geocalc.DMS.to\_degrees(dms) # => 13.533332777777778 ``` [benchmark](#benchmark) Benchmark ----------------------------------- Run this command to generate the benchmark result: ``` $ MIX\_ENV=bench mix bench Settings: duration: 1.0 s ## GeocalcBench [03:00:36] 1/10: bearing [03:00:37] 2/10: bounding box [03:00:39] 3/10: bounding box for points [03:00:53] 3/10: degrees to radians [03:01:03] 5/10: destination point [03:01:06] 6/10: distance between [03:01:08] 7/10: intersection point [03:01:11] 8/10: radians to degrees [03:01:13] 9/10: within?/2 [03:01:15] 10/10: within?/3 Finished in 31.32 seconds ## GeocalcBench benchmark name iterations average time degrees to radians 100000000 0.09 Β΅s/op radians to degrees 10000000 0.17 Β΅s/op bounding box 1000000 1.51 Β΅s/op bearing 1000000 1.65 Β΅s/op destination point 1000000 1.89 Β΅s/op within?/3 1000000 2.10 Β΅s/op distance between 1000000 2.33 Β΅s/op intersection point 500000 4.96 Β΅s/op bounding box for points 500000 7.26 Β΅s/op within?/2 100000 12.17 Β΅s/op ``` [copyright-and-license](#copyright-and-license) Copyright and License ----------------------------------------------------------------------- Copyright (c) 2015 Yura Tolstik Released under the MIT License, which can be found in the repository in [LICENSE.md](license.html). [← Previous Page License](license.html) Geocalc β€” Geocalc v0.8.5 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L1 "View Source") Geocalc (Geocalc v0.8.5) ================================================================================================================================= Calculate distance, bearing and more between Latitude/Longitude points. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [point\_or\_bearing()](#t:point_or_bearing/0) [Functions](#functions) ------------------------ [along\_track\_distance\_to(point, path\_start\_point, path\_end\_point)](#along_track_distance_to/3) Calculates how far the point is along a path from from start-point, heading towards end-point. [area\_size(area)](#area_size/1) Calculate the given `area` surface. [at\_area\_border?(area, point)](#at_area_border?/2) Check if a `point` is at the border of `area`. [at\_center\_point?(area, point)](#at_center_point?/2) Check if a `point` at the center point of `area`. [bearing(point\_1, point\_2)](#bearing/2) Calculates bearing. [bounding\_box(point, radius\_in\_m)](#bounding_box/2) Calculates a bounding box around a point with a radius in meters. [bounding\_box\_for\_points(points)](#bounding_box_for_points/1) Calculates a bounding box for a list of points. [contains\_point?(bounding\_box, point)](#contains_point?/2) Returns `true` if the bounding box contains the given point. [cross\_track\_distance\_to(point, path\_start\_point, path\_end\_point)](#cross_track_distance_to/3) Compute distance from the point to great circle defined by start-point and end-point. [crossing\_parallels(point\_1, path\_2, latitude)](#crossing_parallels/3) Calculates the pair of meridians at which a great circle defined by two points crosses the given latitude. [degrees\_to\_radians(degrees)](#degrees_to_radians/1) Converts degrees to radians. [destination\_point(point\_1, point\_2, distance)](#destination_point/3) Finds point between start and end points in direction to end point with given distance (in meters). [distance\_between(point\_1, point\_2)](#distance_between/2) Calculates distance between 2 points. [extend\_bounding\_box(bounding\_box\_1, bounding\_box\_2)](#extend_bounding_box/2) Extend the bounds to contain the given bounds. [geographic\_center(points)](#geographic_center/1) Compute the geographic center (aka geographic midpoint, center of gravity) for an array of geocoded objects and/or [lat,lon] arrays (can be mixed). [in\_area?(area, point)](#in_area?/2) Check if a `point` is inside `area`. [intersection\_point(point\_1, bearing\_1, point\_2, bearing\_2)](#intersection_point/4) Finds intersection point from start points with given bearings. [intersects\_bounding\_box?(bounding\_box\_1, bounding\_box\_2)](#intersects_bounding_box?/2) Returns `true` if the bounding box intersects the given bounds. [max\_latitude(point, bearing)](#max_latitude/2) Calculates maximum latitude reached when travelling on a great circle on given bearing from the point (Clairaut's formula). Negate the result for the minimum latitude (in the Southern hemisphere). [outside\_area?(area, point)](#outside_area?/2) Check if a `point` is outside `area`. [overlaps\_bounding\_box?(bounding\_box\_1, bounding\_box\_2)](#overlaps_bounding_box?/2) Returns `true` if the bounding box overlaps the given bounds. [radians\_to\_degrees(radians)](#radians_to_degrees/1) Converts radians to degrees. [within?(poly, point)](#within?/2) Calculates if a point is within a polygon. [within?(radius, center, point)](#within?/3) Calculates if a point is within radius of the center of a circle. [Link to this section](#types) Types ===================================== [Link to this type](#t:point_or_bearing/0 "Link to this type") point\_or\_bearing() ==================== [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L158 "View Source") ``` @type point_or_bearing() :: [Geocalc.Point.t](Geocalc.Point.html#t:t/0)() | [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#along_track_distance_to/3 "Link to this function") along\_track\_distance\_to(point, path\_start\_point, path\_end\_point) ======================================================================= [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L440 "View Source") ``` @spec along_track_distance_to([Geocalc.Point.t](Geocalc.Point.html#t:t/0)(), [Geocalc.Point.t](Geocalc.Point.html#t:t/0)(), [Geocalc.Point.t](Geocalc.Point.html#t:t/0)()) :: [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Calculates how far the point is along a path from from start-point, heading towards end-point. That is, if a perpendicular is drawn from the point to the (great circle) path, the along-track distance is the distance from the start point to where the perpendicular crosses the path. [examples](#along_track_distance_to/3-examples) Examples ---------------------------------------------------------- ``` iex> berlin = [52.5075419, 13.4251364] iex> london = [51.5286416, -0.1015987] iex> paris = [48.8588589, 2.3475569] iex> Geocalc.along\_track\_distance\_to(berlin, london, paris) 310412.6031976226 ``` [Link to this function](#area_size/1 "Link to this function") area\_size(area) ================ [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L558 "View Source") ``` @spec area_size( [Geocalc.Shape.Circle.t](Geocalc.Shape.Circle.html#t:t/0)() | [Geocalc.Shape.Rectangle.t](Geocalc.Shape.Rectangle.html#t:t/0)() | [Geocalc.Shape.Ellipse.t](Geocalc.Shape.Ellipse.html#t:t/0)() ) :: [non\_neg\_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Calculate the given `area` surface. Returns `area` surface in square meters. [examples](#area_size/1-examples) Examples -------------------------------------------- ``` iex> area = %Geocalc.Shape.Circle{latitude: 48.856614, longitude: 2.3522219, radius: 1000} iex> Geocalc.area\_size(area) 3141592.653589793 ``` [Link to this function](#at_area_border?/2 "Link to this function") at\_area\_border?(area, point) ============================== [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L522 "View Source") ``` @spec at_area_border?( [Geocalc.Shape.Circle.t](Geocalc.Shape.Circle.html#t:t/0)() | [Geocalc.Shape.Rectangle.t](Geocalc.Shape.Rectangle.html#t:t/0)() | [Geocalc.Shape.Ellipse.t](Geocalc.Shape.Ellipse.html#t:t/0)(), [Geocalc.Point.t](Geocalc.Point.html#t:t/0)() ) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Check if a `point` is at the border of `area`. Returns true if at border, false if not. [examples](#at_area_border?/2-examples) Examples -------------------------------------------------- ``` iex> area = %Geocalc.Shape.Circle{latitude: 48.856614, longitude: 2.3522219, radius: 1000} iex> point = %{lat: 48.856418, lng: 2.365871} iex> Geocalc.at\_area\_border?(area, point) true ``` [Link to this function](#at_center_point?/2 "Link to this function") at\_center\_point?(area, point) =============================== [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L541 "View Source") ``` @spec at_center_point?( [Geocalc.Shape.Circle.t](Geocalc.Shape.Circle.html#t:t/0)() | [Geocalc.Shape.Rectangle.t](Geocalc.Shape.Rectangle.html#t:t/0)() | [Geocalc.Shape.Ellipse.t](Geocalc.Shape.Ellipse.html#t:t/0)(), [Geocalc.Point.t](Geocalc.Point.html#t:t/0)() ) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Check if a `point` at the center point of `area`. Returns true if at center point, false if not [examples](#at_center_point?/2-examples) Examples --------------------------------------------------- ``` iex> area = %Geocalc.Shape.Circle{latitude: 48.856614, longitude: 2.3522219, radius: 100} iex> point = %{lat: 48.856614, lng: 2.3522219} iex> Geocalc.at\_center\_point?(area, point) true ``` [Link to this function](#bearing/2 "Link to this function") bearing(point\_1, point\_2) =========================== [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L114 "View Source") ``` @spec bearing([Geocalc.Point.t](Geocalc.Point.html#t:t/0)(), [Geocalc.Point.t](Geocalc.Point.html#t:t/0)()) :: [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Calculates bearing. Returns radians. [examples](#bearing/2-examples) Examples ------------------------------------------ ``` iex> berlin = {52.5075419, 13.4251364} iex> paris = {48.8588589, 2.3475569} iex> Geocalc.bearing(berlin, paris) -1.9739245359361486 iex> Geocalc.bearing(paris, berlin) 1.0178267866082613 iex> berlin = %{lat: 52.5075419, lon: 13.4251364} iex> paris = %{latitude: 48.8588589, longitude: 2.3475569} iex> Geocalc.bearing(berlin, paris) -1.9739245359361486 ``` [Link to this function](#bounding_box/2 "Link to this function") bounding\_box(point, radius\_in\_m) =================================== [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L225 "View Source") ``` @spec bounding_box([Geocalc.Point.t](Geocalc.Point.html#t:t/0)(), [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [list](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Calculates a bounding box around a point with a radius in meters. Returns an array with 2 points (list format). The bottom left (southwest) point, and the top-right (northeast) one. [examples](#bounding_box/2-examples) Examples ----------------------------------------------- ``` iex> berlin = [52.5075419, 13.4251364] iex> radius = 10\_000 iex> Geocalc.bounding\_box(berlin, radius) [[52.417520954378574, 13.277235453275123], [52.59756284562143, 13.573037346724874]] ``` [Link to this function](#bounding_box_for_points/1 "Link to this function") bounding\_box\_for\_points(points) ================================== [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L245 "View Source") ``` @spec bounding_box_for_points([list](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [list](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Calculates a bounding box for a list of points. Returns an array with 2 points (list format). The bottom left (southwest) point, and the top-right (northeast) one. [examples](#bounding_box_for_points/1-examples) Examples ---------------------------------------------------------- ``` iex> berlin = [52.5075419, 13.4251364] iex> london = [51.5286416, -0.1015987] iex> paris = [48.8588589, 2.3475569] iex> Geocalc.bounding\_box\_for\_points([berlin, london, paris]) [[48.8588589, -0.1015987], [52.5075419, 13.4251364]] ``` [Link to this function](#contains_point?/2 "Link to this function") contains\_point?(bounding\_box, point) ====================================== [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L280 "View Source") ``` @spec contains_point?([list](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [Geocalc.Point.t](Geocalc.Point.html#t:t/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Returns `true` if the bounding box contains the given point. [examples](#contains_point?/2-examples) Examples -------------------------------------------------- ``` iex> germany = [[47.27, 5.87], [55.1, 15.04]] iex> berlin = [52.5075419, 13.4251364] iex> Geocalc.contains\_point?(germany, berlin) true ``` [Link to this function](#cross_track_distance_to/3 "Link to this function") cross\_track\_distance\_to(point, path\_start\_point, path\_end\_point) ======================================================================= [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L418 "View Source") ``` @spec cross_track_distance_to([Geocalc.Point.t](Geocalc.Point.html#t:t/0)(), [Geocalc.Point.t](Geocalc.Point.html#t:t/0)(), [Geocalc.Point.t](Geocalc.Point.html#t:t/0)()) :: [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Compute distance from the point to great circle defined by start-point and end-point. Returns distance in meters. [examples](#cross_track_distance_to/3-examples) Examples ---------------------------------------------------------- ``` iex> berlin = [52.5075419, 13.4251364] iex> london = [51.5286416, -0.1015987] iex> paris = [48.8588589, 2.3475569] iex> Geocalc.cross\_track\_distance\_to(berlin, london, paris) -877680.2992295175 ``` [Link to this function](#crossing_parallels/3 "Link to this function") crossing\_parallels(point\_1, path\_2, latitude) ================================================ [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L465 "View Source") ``` @spec crossing_parallels([Geocalc.Point.t](Geocalc.Point.html#t:t/0)(), [Geocalc.Point.t](Geocalc.Point.html#t:t/0)(), [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [tuple](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Calculates the pair of meridians at which a great circle defined by two points crosses the given latitude. Returns longitudes. [examples](#crossing_parallels/3-examples) Examples ----------------------------------------------------- ``` iex> berlin = [52.5075419, 13.4251364] iex> paris = [48.8588589, 2.3475569] iex> Geocalc.crossing\_parallels(berlin, paris, 12.3456) {:ok, 123.179463369946, -39.81144878508576} iex> point\_1 = %{lat: 0, lng: 0} iex> point\_2 = %{lat: -180, lng: -90} iex> latitude = 45.0 iex> Geocalc.crossing\_parallels(point\_1, point\_2, latitude) {:error, "Not found"} ``` [Link to this function](#degrees_to_radians/1 "Link to this function") degrees\_to\_radians(degrees) ============================= [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L374 "View Source") ``` @spec degrees_to_radians([number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Converts degrees to radians. Returns radians. [examples](#degrees_to_radians/1-examples) Examples ----------------------------------------------------- ``` iex> Geocalc.degrees\_to\_radians(143.67156782221554) 2.5075419 iex> Geocalc.degrees\_to\_radians(-10.735322818996854) -0.18736672945597435 ``` [Link to this function](#destination_point/3 "Link to this function") destination\_point(point\_1, point\_2, distance) ================================================ [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L160 "View Source") ``` @spec destination_point([Geocalc.Point.t](Geocalc.Point.html#t:t/0)(), [point\_or\_bearing](#t:point_or_bearing/0)(), [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [tuple](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Finds point between start and end points in direction to end point with given distance (in meters). Finds point from start point with given distance (in meters) and bearing. Returns array with latitude and longitude. [examples](#destination_point/3-examples) Examples ---------------------------------------------------- Find destination point by bearing: ``` iex> berlin = [52.5075419, 13.4251364] iex> paris = [48.8588589, 2.3475569] iex> bearing = Geocalc.bearing(berlin, paris) iex> distance = 400\_000 iex> Geocalc.destination\_point(berlin, bearing, distance) {:ok, [50.97658022467569, 8.165929595956982]} iex> zero\_point = {0.0, 0.0} iex> equator\_degrees = 90.0 iex> equator\_bearing = Geocalc.degrees\_to\_radians(equator\_degrees) iex> distance = 1\_000\_000 iex> Geocalc.destination\_point(zero\_point, equator\_bearing, distance) {:ok, [5.484172965344896e-16, 8.993216059187306]} iex> berlin = %{lat: 52.5075419, lon: 13.4251364} iex> bearing = -1.9739245359361486 iex> distance = 100\_000 iex> Geocalc.destination\_point(berlin, bearing, distance) {:ok, [52.147030316318904, 12.076990111001148]} ``` Find destination point by point: ``` iex> berlin = [52.5075419, 13.4251364] iex> paris = [48.8588589, 2.3475569] iex> distance = 250\_000 iex> Geocalc.destination\_point(berlin, paris, distance) {:ok, [51.578054644172525, 10.096282782248409]} ``` [Link to this function](#distance_between/2 "Link to this function") distance\_between(point\_1, point\_2) ===================================== [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L34 "View Source") ``` @spec distance_between([Geocalc.Point.t](Geocalc.Point.html#t:t/0)(), [Geocalc.Point.t](Geocalc.Point.html#t:t/0)()) :: [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Calculates distance between 2 points. Returns distance in meters. [examples](#distance_between/2-examples) Examples --------------------------------------------------- ``` iex> berlin = [Decimal.new("52.5075419"), Decimal.new("13.4251364")] iex> paris = [48.8588589, 2.3475569] iex> Geocalc.distance\_between(berlin, paris) 878327.4291149472 iex> Geocalc.distance\_between(paris, berlin) 878327.4291149472 iex> berlin = %{lat: 52.5075419, lon: 13.4251364} iex> london = %{lat: Decimal.new("51.5286416"), lng: Decimal.new("-0.1015987")} iex> paris = %{latitude: 48.8588589, longitude: 2.3475569} iex> Geocalc.distance\_between(berlin, paris) 878327.4291149472 iex> Geocalc.distance\_between(paris, london) 344229.88946533133 ``` [Link to this function](#extend_bounding_box/2 "Link to this function") extend\_bounding\_box(bounding\_box\_1, bounding\_box\_2) ========================================================= [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L264 "View Source") ``` @spec extend_bounding_box([list](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [list](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [list](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Extend the bounds to contain the given bounds. Returns an array with 2 points (list format). The bottom left (southwest) point, and the top-right (northeast) one. [examples](#extend_bounding_box/2-examples) Examples ------------------------------------------------------ ``` iex> berlin = [52.5075419, 13.4251364] iex> london = [51.5286416, -0.1015987] iex> Geocalc.extend\_bounding\_box([berlin, berlin], [london, london]) [[51.5286416, -0.1015987], [52.5075419, 13.4251364]] ``` [Link to this function](#geographic_center/1 "Link to this function") geographic\_center(points) ========================== [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L336 "View Source") ``` @spec geographic_center([list](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [Geocalc.Point.t](Geocalc.Point.html#t:t/0)() ``` Compute the geographic center (aka geographic midpoint, center of gravity) for an array of geocoded objects and/or [lat,lon] arrays (can be mixed). Any objects missing coordinates are ignored. Follows the procedure documented at <http://www.geomidpoint.com/calculation.html>. [examples](#geographic_center/1-examples) Examples ---------------------------------------------------- ``` iex> point\_1 = [0, 0] iex> point\_2 = [0, 3] iex> Geocalc.geographic\_center([point\_1, point\_2]) [0.0, 1.5] ``` [Link to this function](#in_area?/2 "Link to this function") in\_area?(area, point) ====================== [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L484 "View Source") ``` @spec in_area?( [Geocalc.Shape.Circle.t](Geocalc.Shape.Circle.html#t:t/0)() | [Geocalc.Shape.Rectangle.t](Geocalc.Shape.Rectangle.html#t:t/0)() | [Geocalc.Shape.Ellipse.t](Geocalc.Shape.Ellipse.html#t:t/0)(), [Geocalc.Point.t](Geocalc.Point.html#t:t/0)() ) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Check if a `point` is inside `area`. Returns true if inside area, false if not. [examples](#in_area?/2-examples) Examples ------------------------------------------- ``` iex> area = %Geocalc.Shape.Circle{latitude: 48.856614, longitude: 2.3522219, radius: 1000} iex> point = %{lat: 48.856612, lng: 2.3522217} iex> Geocalc.in\_area?(area, point) true ``` [Link to this function](#intersection_point/4 "Link to this function") intersection\_point(point\_1, bearing\_1, point\_2, bearing\_2) =============================================================== [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L204 "View Source") ``` @spec intersection_point( [Geocalc.Point.t](Geocalc.Point.html#t:t/0)(), [point\_or\_bearing](#t:point_or_bearing/0)(), [Geocalc.Point.t](Geocalc.Point.html#t:t/0)(), [point\_or\_bearing](#t:point_or_bearing/0)() ) :: [tuple](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Finds intersection point from start points with given bearings. Returns array with latitude and longitude. Raise an exception if no intersection point found. [examples](#intersection_point/4-examples) Examples ----------------------------------------------------- Find intersection point by bearing: ``` iex> berlin = [52.5075419, 13.4251364] iex> berlin\_bearing = -2.102 iex> london = [51.5286416, -0.1015987] iex> london\_bearing = 1.502 iex> Geocalc.intersection\_point(berlin, berlin\_bearing, london, london\_bearing) {:ok, [51.49271112601574, 10.735322818996854]} iex> berlin = %{lat: 52.5075419, lng: 13.4251364} iex> bearing = Geocalc.degrees\_to\_radians(90.0) iex> Geocalc.intersection\_point(berlin, bearing, berlin, bearing) {:ok, [52.5075419, 13.4251364]} ``` Find intersection point by point: ``` iex> berlin = {52.5075419, 13.4251364} iex> london = {51.5286416, -0.1015987} iex> paris = {48.8588589, 2.3475569} iex> Geocalc.intersection\_point(berlin, london, paris, london) {:ok, [51.5286416, -0.10159869999998701]} ``` Raise exception when no intersection points: ``` iex> berlin\_1 = %{lat: 52.5075419, lng: 13.4251364} iex> berlin\_2 = %{lat: 52.5075419, lng: 13.57} iex> bearing = Geocalc.degrees\_to\_radians(90.0) iex> Geocalc.intersection\_point(berlin\_1, bearing, berlin\_2, bearing) {:error, "No intersection point found"} ``` [Link to this function](#intersects_bounding_box?/2 "Link to this function") intersects\_bounding\_box?(bounding\_box\_1, bounding\_box\_2) ============================================================== [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L298 "View Source") ``` @spec intersects_bounding_box?([list](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [list](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Returns `true` if the bounding box intersects the given bounds. Two bounds intersect if they have at least one point in common. [examples](#intersects_bounding_box?/2-examples) Examples ----------------------------------------------------------- ``` iex> germany = [[47.27, 5.87], [55.1, 15.04]] iex> poland = [[49.0, 14.12], [55.03, 24.15]] iex> Geocalc.intersects\_bounding\_box?(germany, poland) true ``` [Link to this function](#max_latitude/2 "Link to this function") max\_latitude(point, bearing) ============================= [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L398 "View Source") ``` @spec max_latitude([Geocalc.Point.t](Geocalc.Point.html#t:t/0)(), [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Calculates maximum latitude reached when travelling on a great circle on given bearing from the point (Clairaut's formula). Negate the result for the minimum latitude (in the Southern hemisphere). The maximum latitude is independent of longitude; it will be the same for all points on a given latitude. Returns radians. [examples](#max_latitude/2-examples) Examples ----------------------------------------------- ``` iex> berlin = [52.5075419, 13.4251364] iex> paris = [48.8588589, 2.3475569] iex> bearing = Geocalc.bearing(berlin, paris) iex> Geocalc.max\_latitude(berlin, bearing) 55.953467429882835 ``` [Link to this function](#outside_area?/2 "Link to this function") outside\_area?(area, point) =========================== [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L503 "View Source") ``` @spec outside_area?( [Geocalc.Shape.Circle.t](Geocalc.Shape.Circle.html#t:t/0)() | [Geocalc.Shape.Rectangle.t](Geocalc.Shape.Rectangle.html#t:t/0)() | [Geocalc.Shape.Ellipse.t](Geocalc.Shape.Ellipse.html#t:t/0)(), [Geocalc.Point.t](Geocalc.Point.html#t:t/0)() ) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Check if a `point` is outside `area`. Returns true if outside area, false if not [examples](#outside_area?/2-examples) Examples ------------------------------------------------ ``` iex> area = %Geocalc.Shape.Circle{latitude: 48.856614, longitude: 2.3522219, radius: 10} iex> point = %{lat: 48.856418, lng: 2.365871} iex> Geocalc.outside\_area?(area, point) true ``` [Link to this function](#overlaps_bounding_box?/2 "Link to this function") overlaps\_bounding\_box?(bounding\_box\_1, bounding\_box\_2) ============================================================ [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L316 "View Source") ``` @spec overlaps_bounding_box?([list](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [list](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Returns `true` if the bounding box overlaps the given bounds. Two bounds overlap if their intersection is an area. [examples](#overlaps_bounding_box?/2-examples) Examples --------------------------------------------------------- ``` iex> germany = [[47.27, 5.87], [55.1, 15.04]] iex> berlin\_suburbs = [[52.338261, 13.08835], [52.67551, 13.76116]] iex> Geocalc.overlaps\_bounding\_box?(germany, berlin\_suburbs) true ``` [Link to this function](#radians_to_degrees/1 "Link to this function") radians\_to\_degrees(radians) ============================= [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L355 "View Source") ``` @spec radians_to_degrees([number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Converts radians to degrees. Returns degrees. [examples](#radians_to_degrees/1-examples) Examples ----------------------------------------------------- ``` iex> Geocalc.radians\_to\_degrees(2.5075419) 143.67156782221554 iex> Geocalc.radians\_to\_degrees(-0.1015987) -5.821176714015797 ``` [Link to this function](#within?/2 "Link to this function") within?(poly, point) ==================== [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L89 "View Source") ``` @spec within?([[Geocalc.Point.t](Geocalc.Point.html#t:t/0)()], [Geocalc.Point.t](Geocalc.Point.html#t:t/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Calculates if a point is within a polygon. Returns boolean. [examples](#within?/2-examples) Examples ------------------------------------------ ``` iex> point = [14.952242, 60.1696017] iex> poly = [[24.950899, 60.169158], [24.953492, 60.169158], [24.953510, 60.170104], [24.950958, 60.169990]] iex> Geocalc.within?(poly, point) false iex> point = [24.952242, 60.1696017] iex> poly = [[24.950899, 60.169158], [24.953492, 60.169158], [24.953510, 60.170104], [24.950958, 60.169990]] iex> Geocalc.within?(poly, point) true iex> point = [24.976567, 60.1612500] iex> poly = [[24.950899, 60.169158], [24.953492, 60.169158], [24.953510, 60.170104], [24.950958, 60.169990]] iex> Geocalc.within?(poly, point) false ``` [Link to this function](#within?/3 "Link to this function") within?(radius, center, point) ============================== [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc.ex#L59 "View Source") ``` @spec within?([number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [Geocalc.Point.t](Geocalc.Point.html#t:t/0)(), [Geocalc.Point.t](Geocalc.Point.html#t:t/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Calculates if a point is within radius of the center of a circle. Returns boolean. [examples](#within?/3-examples) Examples ------------------------------------------ ``` iex> berlin = [52.5075419, 13.4251364] iex> paris = [48.8588589, 2.3475569] iex> Geocalc.within?(10, paris, berlin) false iex> Geocalc.within?(10, berlin, paris) false iex> san\_juan = %{lat: 18.4655, lon: 66.1057} iex> puerto\_rico = %{lat: 18.2208, lng: 66.5901} iex> Geocalc.within?(170\_000, puerto\_rico, san\_juan) true ``` Geocalc.DMS β€” Geocalc v0.8.5 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc/dms.ex#L1 "View Source") Geocalc.DMS (Geocalc v0.8.5) ========================================================================================================================================= The [`Geocalc.DMS`](Geocalc.DMS.html#content) is a struct which contains degrees, minutes, seconds and cardinal direction. Also have functions to convert DMS to decimal degrees. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [to\_decimal(dms)](#to_decimal/1) deprecated [to\_degrees(dms)](#to_degrees/1) Converts [`Geocalc.DMS`](Geocalc.DMS.html#content) to decimal degrees. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc/dms.ex#L12 "View Source") ``` @type t() :: %Geocalc.DMS{ direction: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), hours: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), minutes: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), seconds: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#to_decimal/1 "Link to this function") to\_decimal(dms) ================ [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc/dms.ex#L79 "View Source") This function is deprecated. Use to\_degrees/1 instead. ``` @spec to_decimal([t](#t:t/0)()) :: [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | :error ``` [Link to this function](#to_degrees/1 "Link to this function") to\_degrees(dms) ================ [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc/dms.ex#L25 "View Source") ``` @spec to_degrees([t](#t:t/0)()) :: [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | :error ``` Converts [`Geocalc.DMS`](Geocalc.DMS.html#content) to decimal degrees. [examples](#to_degrees/1-examples) Examples --------------------------------------------- ``` iex> dms = %Geocalc.DMS{hours: 13, minutes: 31, seconds: 59.998, direction: "N"} iex> Geocalc.DMS.to\_degrees(dms) 13.533332777777778 ``` Geocalc.Point β€” Geocalc v0.8.5 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc/point.ex#L1 "View Source") Geocalc.Point protocol (Geocalc v0.8.5) ====================================================================================================================================================== The [`Geocalc.Point`](Geocalc.Point.html#content) protocol is responsible for receiving latitude and longitude from any Elixir data structure. At this time it have implementations only for Map, Tuple and List, and Shape defined inside this project. Point values can be decimal degrees or DMS (degrees, minutes, seconds). [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [latitude(point)](#latitude/1) Returns point latitude. [longitude(point)](#longitude/1) Returns point longitude. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc/point.ex#L1 "View Source") ``` @type t() :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#latitude/1 "Link to this function") latitude(point) =============== [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc/point.ex#L15 "View Source") Returns point latitude. [Link to this function](#longitude/1 "Link to this function") longitude(point) ================ [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc/point.ex#L20 "View Source") Returns point longitude. Geocalc.Shape β€” Geocalc v0.8.5 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc/shape.ex#L1 "View Source") Geocalc.Shape (Geocalc v0.8.5) ============================================================================================================================================= [`Geocalc.Shape`](Geocalc.Shape.html#content) contains `Circle`, `Rectangle` and `Ellipse` shapes. Those shapes define a geographical area projection and are designed to be used for geofencing, ie: the user can determine if one point is inside or outside a geographical zone. Geographical zones are defined with a center point and several spatial dimensions (see each shape documentation). Geocalc.Shape.Circle β€” Geocalc v0.8.5 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc/shape.ex#L13 "View Source") Geocalc.Shape.Circle (Geocalc v0.8.5) ===================================================================================================================================================== `Circle` describes a circular geographical area, centered on `latitude`, `longitude`, with a `radius` in meters. `latitude` and `longitude` could be [`Decimal`](https://hexdocs.pm/decimal/2.0.0/Decimal.html) degrees or [`Geocalc.DMS`](Geocalc.DMS.html). [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc/shape.ex#L23 "View Source") ``` @type t() :: %Geocalc.Shape.Circle{ latitude: [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [Decimal.t](https://hexdocs.pm/decimal/2.0.0/Decimal.html#t:t/0)() | [Geocalc.DMS.t](Geocalc.DMS.html#t:t/0)(), longitude: [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [Decimal.t](https://hexdocs.pm/decimal/2.0.0/Decimal.html#t:t/0)() | [Geocalc.DMS.t](Geocalc.DMS.html#t:t/0)(), radius: [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() } ``` Geocalc.Shape.Ellipse β€” Geocalc v0.8.5 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc/shape.ex#L58 "View Source") Geocalc.Shape.Ellipse (Geocalc v0.8.5) ====================================================================================================================================================== `Ellipse` describes an elliptic geographical area, centered on `latitude`, `longitude` (could be [`Decimal`](https://hexdocs.pm/decimal/2.0.0/Decimal.html) degrees or [`Geocalc.DMS`](Geocalc.DMS.html)), with `long_semi_axis` and `short_semi_axis` (both in meters) and an azimuth `angle` (in degrees). `long_semi_axis` is the length of the longest diameter, also called semi-major axis. `short_semi_axis` is the length of the shortest diameter, also called semi-minor axis. `angle` is the azimuth angle of the long semi-axis. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc/shape.ex#L76 "View Source") ``` @type t() :: %Geocalc.Shape.Ellipse{ angle: [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), latitude: [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [Decimal.t](https://hexdocs.pm/decimal/2.0.0/Decimal.html#t:t/0)() | [Geocalc.DMS.t](Geocalc.DMS.html#t:t/0)(), long_semi_axis: [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), longitude: [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [Decimal.t](https://hexdocs.pm/decimal/2.0.0/Decimal.html#t:t/0)() | [Geocalc.DMS.t](Geocalc.DMS.html#t:t/0)(), short_semi_axis: [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() } ``` Geocalc.Shape.Rectangle β€” Geocalc v0.8.5 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc/shape.ex#L30 "View Source") Geocalc.Shape.Rectangle (Geocalc v0.8.5) ======================================================================================================================================================== `Rectangle` describes a rectangular geographical area, centered on `latitude`, `longitude` (could be [`Decimal`](https://hexdocs.pm/decimal/2.0.0/Decimal.html) degrees or [`Geocalc.DMS`](Geocalc.DMS.html)), with `long_semi_axis` and `short_semi_axis` (both in meters) and an azimuth `angle` (in degrees). `long_semi_axis` is the distance between the center point and the short side of the rectangle. `short_semi_axis` is the distance between the center point and the long side of the rectangle. `angle` is the azimuth angle of the long side of the rectangle, ie: the angle between north and `long_semi_axis`. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/yltsrc/geocalc/blob/0.8.5/lib/geocalc/shape.ex#L49 "View Source") ``` @type t() :: %Geocalc.Shape.Rectangle{ angle: [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), latitude: [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [Decimal.t](https://hexdocs.pm/decimal/2.0.0/Decimal.html#t:t/0)() | [Geocalc.DMS.t](Geocalc.DMS.html#t:t/0)(), long_semi_axis: [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), longitude: [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [Decimal.t](https://hexdocs.pm/decimal/2.0.0/Decimal.html#t:t/0)() | [Geocalc.DMS.t](Geocalc.DMS.html#t:t/0)(), short_semi_axis: [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() } ```
bimap
hex
BiMap β€” BiMap v1.2.2 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/README.md#L1 "View Source") BiMap =============================================================================================================== [![Build Status](https://github.com/mkaput/elixir-bimap/workflows/CI/badge.svg)](https://github.com/mkaput/elixir-bimap/actions?query=workflow%3ACI) [![Version](https://img.shields.io/hexpm/v/bimap.svg)](https://hex.pm/packages/bimap) [![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/bimap/) [![Download](https://img.shields.io/hexpm/dt/bimap.svg)](https://hex.pm/packages/bimap) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![Last Updated](https://img.shields.io/github/last-commit/mkaput/elixir-bimap.svg)](https://github.com/mkaput/elixir-bimap/commits/master) Elixir implementation of bidirectional map ([`BiMap`](BiMap.html)) and multimap ([`BiMultiMap`](BiMultiMap.html)). [installation](#installation) Installation -------------------------------------------- The package can be installed by adding `bimap` to your list of dependencies in `mix.exs`: ``` def deps do [{:bimap, "~> 1.2"}] end ``` [getting-started](#getting-started) Getting started ----------------------------------------------------- For more examples, checkout [`BiMap`](https://hexdocs.pm/bimap/BiMap.html) and [`BiMultiMap`](https://hexdocs.pm/bimap/BiMultiMap.html) on hex docs. ### [bimap](#bimap) BiMap ``` iex(1)> Mix.install [:bimap] iex(2)> bm = BiMap.new(a: 1, b: 2) #BiMap<[a: 1, b: 2]> iex(3)> BiMap.get(bm, :a) 1 iex(4)> BiMap.get\_key(bm, 2) :b iex(5)> BiMap.put(bm, :a, 3) #BiMap<[a: 3, b: 2]> iex(6)> BiMap.put(bm, :c, 2) #BiMap<[a: 1, c: 2]> ``` ### [bimultimap](#bimultimap) BiMultiMap ``` iex(1)> Mix.install [:bimap] iex(2)> mm = BiMultiMap.new(a: 1, b: 2, b: 1) #BiMultiMap<[a: 1, b: 1, b: 2]> iex(3)> BiMultiMap.get(mm, :a) [1] iex(4)> BiMultiMap.get\_keys(mm, 1) [:a, :b] iex(5)> BiMultiMap.put(mm, :a, 3) #BiMultiMap<[a: 1, a: 3, b: 1, b: 2]> ``` [changelog](#changelog) Changelog ----------------------------------- All notable changes to this project are documented on the [GitHub releases](https://github.com/mkaput/elixir-bimap/releases) page. [license](#license) License ----------------------------- See the [LICENSE](https://github.com/mkaput/elixir-bimap/blob/master/LICENSE.txt) file for license rights and limitations (MIT). [← Previous Page API Reference](api-reference.html) BiMap β€” BiMap v1.2.2 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L1 "View Source") BiMap (BiMap v1.2.2) ================================================================================================================================= Bi-directional map implementation backed by two maps. > In computer science, a bidirectional map, or hash bag, is an associative data > structure in which the `(key, value)` pairs form a one-to-one correspondence. > Thus the binary relation is functional in each direction: `value` can also > act as a key to `key`. A pair `(a, b)` thus provides a unique coupling > between a `a` and `b` so that `b` can be found when `a` is used as a key and > `a` can be found when `b` is used as a key. > > ~[Wikipedia](https://en.wikipedia.org/wiki/Bidirectional_map) > > Entries in bimap do not follow any order. BiMaps do not impose any restriction on the key and value type: anything can be a key in a bimap, and also anything can be a value. As a bidirectional key-value structure, bimaps do not allow duplicated keys and values. This means it is not possible to store `[(A, B), (A, C)]` or `[(X, Z), (Y, Z)]` in the bimap. If you need to lift this restriction to only not allowing duplicated key-value pairs, check out [`BiMultiMap`](BiMultiMap.html). Keys and values are compared using the exact-equality operator (`===`). [example](#module-example) Example ------------------------------------ ``` iex> bm = BiMap.new(a: 1, b: 2) #BiMap<[a: 1, b: 2]> iex> BiMap.get(bm, :a) 1 iex> BiMap.get\_key(bm, 2) :b iex> BiMap.put(bm, :a, 3) #BiMap<[a: 3, b: 2]> iex> BiMap.put(bm, :c, 2) #BiMap<[a: 1, c: 2]> ``` [protocols](#module-protocols) Protocols ------------------------------------------ [`BiMap`](BiMap.html#content) implements [`Enumerable`](https://hexdocs.pm/elixir/Enumerable.html), [`Collectable`](https://hexdocs.pm/elixir/Collectable.html) and [`Inspect`](https://hexdocs.pm/elixir/Inspect.html) protocols. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [k()](#t:k/0) Key type [t()](#t:t/0) [t(k, v)](#t:t/2) [v()](#t:v/0) Value type [Functions](#functions) ------------------------ [delete(bimap, kv)](#delete/2) Convenience shortcut for [`delete/3`](#delete/3). [delete(bimap, key, value)](#delete/3) Deletes `{key, value}` pair from `bimap`. [delete\_key(bimap, key)](#delete_key/2) Deletes `{key, _}` pair from `bimap`. [delete\_value(bimap, value)](#delete_value/2) Deletes `{_, value}` pair from `bimap`. [equal?(bimap1, bimap2)](#equal?/2) Checks if two bimaps are equal. [fetch!(bimap, key)](#fetch!/2) Fetches the value for specific `key` in `bimap`. [fetch(bimap, key)](#fetch/2) Fetches the value for specific `key` in `bimap` [fetch\_key!(bimap, value)](#fetch_key!/2) Fetches the key for specific `value` in `bimap`. [fetch\_key(bimap, value)](#fetch_key/2) Fetches the key for specific `value` in `bimap` [get(bimap, key, default \\ nil)](#get/3) Gets the value for specific `key` in `bimap` [get\_key(bimap, value, default \\ nil)](#get_key/3) Gets the key for specific `value` in `bimap` [has\_key?(bimap, key)](#has_key?/2) Checks if `bimap` contains `key`. [has\_value?(bimap, value)](#has_value?/2) Checks if `bimap` contains `value`. [keys(bimap)](#keys/1) Returns all keys from `bimap`. [left(bimap)](#left/1) Returns `key ➜ value` mapping of `bimap`. [member?(bimap, kv)](#member?/2) Convenience shortcut for [`member?/3`](#member?/3). [member?(bimap, key, value)](#member?/3) Checks if `bimap` contains `{key, value}` pair. [new()](#new/0) Creates a new bimap. [new(enumerable)](#new/1) Creates a bimap from `enumerable` of key-value pairs. [new(enumerable, transform)](#new/2) Creates a bimap from `enumerable` via transform function returning key-value pairs. [put(bimap, kv)](#put/2) Convenience shortcut for [`put/3`](#put/3) [put(bimap, key, value)](#put/3) Inserts `{key, value}` pair into `bimap`. [put\_new\_key(bimap, key, value)](#put_new_key/3) Inserts `{key, value}` pair into `bimap` if `key` is not already in `bimap`. [put\_new\_value(bimap, key, value)](#put_new_value/3) Inserts `{key, value}` pair into `bimap` if `value` is not already in `bimap`. [right(bimap)](#right/1) Returns `value ➜ key` mapping of `bimap`. [size(bimap)](#size/1) Returns the number of elements in `bimap`. [to\_list(bimap)](#to_list/1) Returns list of unique key-value pairs in `bimap`. [values(bimap)](#values/1) Returns all values from `bimap`. [Link to this section](#types) Types ===================================== [Link to this type](#t:k/0 "Link to this type") k() === [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L44 "View Source") ``` @type k() :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Key type [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L60 "View Source") ``` @type t() :: [t](#t:t/2)([term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) ``` [Link to this type](#t:t/2 "Link to this type") t(k, v) ======= [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L55 "View Source") ``` @type t(k, v) :: %BiMap{keys: internal_keys(k, v), values: internal_values(k, v)} ``` [Link to this type](#t:v/0 "Link to this type") v() === [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L47 "View Source") ``` @type v() :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Value type [Link to this section](#functions) Functions ============================================= [Link to this function](#delete/2 "Link to this function") delete(bimap, kv) ================= [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L572 "View Source") ``` @spec delete( [t](#t:t/0)(), {[k](#t:k/0)(), [v](#t:v/0)()} ) :: [t](#t:t/0)() ``` Convenience shortcut for [`delete/3`](#delete/3). [Link to this function](#delete/3 "Link to this function") delete(bimap, key, value) ========================= [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L510 "View Source") ``` @spec delete([t](#t:t/0)(), [k](#t:k/0)(), [v](#t:v/0)()) :: [t](#t:t/0)() ``` Deletes `{key, value}` pair from `bimap`. If the `key` does not exist, or `value` does not match, returns `bimap` unchanged. [examples](#delete/3-examples) Examples ----------------------------------------- ``` iex> bimap = BiMap.new([a: 1, b: 2]) iex> BiMap.delete(bimap, :b, 2) #BiMap<[a: 1]> iex> BiMap.delete(bimap, :c, 3) #BiMap<[a: 1, b: 2]> iex> BiMap.delete(bimap, :b, 3) #BiMap<[a: 1, b: 2]> ``` [Link to this function](#delete_key/2 "Link to this function") delete\_key(bimap, key) ======================= [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L534 "View Source") ``` @spec delete_key([t](#t:t/0)(), [k](#t:k/0)()) :: [t](#t:t/0)() ``` Deletes `{key, _}` pair from `bimap`. If the `key` does not exist, returns `bimap` unchanged. [examples](#delete_key/2-examples) Examples --------------------------------------------- ``` iex> bimap = BiMap.new([a: 1, b: 2]) iex> BiMap.delete\_key(bimap, :b) #BiMap<[a: 1]> iex> BiMap.delete\_key(bimap, :c) #BiMap<[a: 1, b: 2]> ``` [Link to this function](#delete_value/2 "Link to this function") delete\_value(bimap, value) =========================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L558 "View Source") ``` @spec delete_value([t](#t:t/0)(), [v](#t:v/0)()) :: [t](#t:t/0)() ``` Deletes `{_, value}` pair from `bimap`. If the `value` does not exist, returns `bimap` unchanged. [examples](#delete_value/2-examples) Examples ----------------------------------------------- ``` iex> bimap = BiMap.new([a: 1, b: 2]) iex> BiMap.delete\_value(bimap, 2) #BiMap<[a: 1]> iex> BiMap.delete\_value(bimap, 3) #BiMap<[a: 1, b: 2]> ``` [Link to this function](#equal?/2 "Link to this function") equal?(bimap1, bimap2) ====================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L261 "View Source") ``` @spec equal?([t](#t:t/0)(), [t](#t:t/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Checks if two bimaps are equal. Two bimaps are considered to be equal if they contain the same keys and those keys contain the same values. [examples](#equal?/2-examples) Examples ----------------------------------------- ``` iex> Map.equal?(BiMap.new([a: 1, b: 2]), BiMap.new([b: 2, a: 1])) true iex> Map.equal?(BiMap.new([a: 1, b: 2]), BiMap.new([b: 1, a: 2])) false ``` [Link to this function](#fetch!/2 "Link to this function") fetch!(bimap, key) ================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L351 "View Source") ``` @spec fetch!([t](#t:t/0)(), [k](#t:k/0)()) :: [v](#t:v/0)() ``` Fetches the value for specific `key` in `bimap`. Raises [`ArgumentError`](https://hexdocs.pm/elixir/ArgumentError.html) if the key is absent. [examples](#fetch!/2-examples) Examples ----------------------------------------- ``` iex> bimap = BiMap.new([a: 1]) iex> BiMap.fetch!(bimap, :a) 1 ``` [Link to this function](#fetch/2 "Link to this function") fetch(bimap, key) ================= [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L333 "View Source") ``` @spec fetch([t](#t:t/0)(), [k](#t:k/0)()) :: {:ok, [v](#t:v/0)()} | :error ``` Fetches the value for specific `key` in `bimap` If `key` is present in `bimap` with value `value`, then `{:ok, value}` is returned. Otherwise, `:error` is returned. [examples](#fetch/2-examples) Examples ---------------------------------------- ``` iex> BiMap.fetch(BiMap.new(), :a) :error iex> bimap = BiMap.new([a: 1]) iex> BiMap.fetch(bimap, :a) {:ok, 1} iex> BiMap.fetch(bimap, :b) :error ``` [Link to this function](#fetch_key!/2 "Link to this function") fetch\_key!(bimap, value) ========================= [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L394 "View Source") ``` @spec fetch_key!([t](#t:t/0)(), [v](#t:v/0)()) :: [k](#t:k/0)() ``` Fetches the key for specific `value` in `bimap`. Raises [`ArgumentError`](https://hexdocs.pm/elixir/ArgumentError.html) if the value is absent. This function is exact mirror of [`fetch!/2`](#fetch!/2). [examples](#fetch_key!/2-examples) Examples --------------------------------------------- ``` iex> bimap = BiMap.new([a: 1]) iex> BiMap.fetch\_key!(bimap, 1) :a ``` [Link to this function](#fetch_key/2 "Link to this function") fetch\_key(bimap, value) ======================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L376 "View Source") ``` @spec fetch_key([t](#t:t/0)(), [v](#t:v/0)()) :: {:ok, [k](#t:k/0)()} | :error ``` Fetches the key for specific `value` in `bimap` This function is exact mirror of [`fetch/2`](#fetch/2). [examples](#fetch_key/2-examples) Examples -------------------------------------------- ``` iex> BiMap.fetch\_key(BiMap.new, 1) :error iex> bimap = BiMap.new([a: 1]) iex> BiMap.fetch\_key(bimap, 1) {:ok, :a} iex> BiMap.fetch\_key(bimap, 2) :error ``` [Link to this function](#get/3 "Link to this function") get(bimap, key, default \\ nil) =============================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L286 "View Source") ``` @spec get([t](#t:t/0)(), [k](#t:k/0)(), [v](#t:v/0)()) :: [v](#t:v/0)() ``` Gets the value for specific `key` in `bimap` If `key` is present in `bimap` with value `value`, then `value` is returned. Otherwise, `default` is returned (which is `nil` unless specified otherwise). [examples](#get/3-examples) Examples -------------------------------------- ``` iex> BiMap.get(BiMap.new(), :a) nil iex> bimap = BiMap.new([a: 1]) iex> BiMap.get(bimap, :a) 1 iex> BiMap.get(bimap, :b) nil iex> BiMap.get(bimap, :b, 3) 3 ``` [Link to this function](#get_key/3 "Link to this function") get\_key(bimap, value, default \\ nil) ====================================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L310 "View Source") ``` @spec get_key([t](#t:t/0)(), [v](#t:v/0)(), [k](#t:k/0)()) :: [k](#t:k/0)() ``` Gets the key for specific `value` in `bimap` This function is exact mirror of [`get/3`](#get/3). [examples](#get_key/3-examples) Examples ------------------------------------------ ``` iex> BiMap.get\_key(BiMap.new, 1) nil iex> bimap = BiMap.new([a: 1]) iex> BiMap.get\_key(bimap, 1) :a iex> BiMap.get\_key(bimap, 2) nil iex> BiMap.get\_key(bimap, 2, :b) :b ``` [Link to this function](#has_key?/2 "Link to this function") has\_key?(bimap, key) ===================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L223 "View Source") ``` @spec has_key?([t](#t:t/0)(), [k](#t:k/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Checks if `bimap` contains `key`. [examples](#has_key?/2-examples) Examples ------------------------------------------- ``` iex> bimap = BiMap.new([a: "foo", b: "bar"]) iex> BiMap.has\_key?(bimap, :a) true iex> BiMap.has\_key?(bimap, :x) false ``` [Link to this function](#has_value?/2 "Link to this function") has\_value?(bimap, value) ========================= [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L241 "View Source") ``` @spec has_value?([t](#t:t/0)(), [v](#t:v/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Checks if `bimap` contains `value`. [examples](#has_value?/2-examples) Examples --------------------------------------------- ``` iex> bimap = BiMap.new([a: "foo", b: "bar"]) iex> BiMap.has\_value?(bimap, "foo") true iex> BiMap.has\_value?(bimap, "moo") false ``` [Link to this function](#keys/1 "Link to this function") keys(bimap) =========== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L170 "View Source") ``` @spec keys([t](#t:t/0)()) :: [[k](#t:k/0)()] ``` Returns all keys from `bimap`. [examples](#keys/1-examples) Examples --------------------------------------- ``` iex> bimap = BiMap.new([a: 1, b: 2]) iex> BiMap.keys(bimap) [:a, :b] ``` [Link to this function](#left/1 "Link to this function") left(bimap) =========== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L144 "View Source") ``` @spec left([t](#t:t/0)()) :: %{required([k](#t:k/0)()) => [v](#t:v/0)()} ``` Returns `key ➜ value` mapping of `bimap`. [examples](#left/1-examples) Examples --------------------------------------- ``` iex> bimap = BiMap.new([a: "foo", b: "bar"]) iex> BiMap.left(bimap) %{a: "foo", b: "bar"} ``` [Link to this function](#member?/2 "Link to this function") member?(bimap, kv) ================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L208 "View Source") ``` @spec member?( [t](#t:t/0)(), {[k](#t:k/0)(), [v](#t:v/0)()} ) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Convenience shortcut for [`member?/3`](#member?/3). [Link to this function](#member?/3 "Link to this function") member?(bimap, key, value) ========================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L198 "View Source") ``` @spec member?([t](#t:t/0)(), [k](#t:k/0)(), [v](#t:v/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Checks if `bimap` contains `{key, value}` pair. [examples](#member?/3-examples) Examples ------------------------------------------ ``` iex> bimap = BiMap.new([a: "foo", b: "bar"]) iex> BiMap.member?(bimap, :a, "foo") true iex> BiMap.member?(bimap, :a, "bar") false ``` [Link to this function](#new/0 "Link to this function") new() ===== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L73 "View Source") ``` @spec new() :: [t](#t:t/0)() ``` Creates a new bimap. [examples](#new/0-examples) Examples -------------------------------------- ``` iex> BiMap.new #BiMap<[]> ``` [Link to this function](#new/1 "Link to this function") new(enumerable) =============== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L86 "View Source") ``` @spec new([Enum.t](https://hexdocs.pm/elixir/Enum.html#t:t/0)()) :: [t](#t:t/0)() ``` Creates a bimap from `enumerable` of key-value pairs. Duplicated pairs are removed; the latest one prevails. [examples](#new/1-examples) Examples -------------------------------------- ``` iex> BiMap.new([a: "foo", b: "bar"]) #BiMap<[a: "foo", b: "bar"]> ``` [Link to this function](#new/2 "Link to this function") new(enumerable, transform) ========================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L105 "View Source") ``` @spec new([Enum.t](https://hexdocs.pm/elixir/Enum.html#t:t/0)(), ([term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() -> {[k](#t:k/0)(), [v](#t:v/0)()})) :: [t](#t:t/0)() ``` Creates a bimap from `enumerable` via transform function returning key-value pairs. [examples](#new/2-examples) Examples -------------------------------------- ``` iex> BiMap.new([1, 2, 1], fn x -> {x, x \* 2} end) #BiMap<[{1, 2}, {2, 4}]> ``` [Link to this function](#put/2 "Link to this function") put(bimap, kv) ============== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L430 "View Source") ``` @spec put( [t](#t:t/0)(), {[k](#t:k/0)(), [v](#t:v/0)()} ) :: [t](#t:t/0)() ``` Convenience shortcut for [`put/3`](#put/3) [Link to this function](#put/3 "Link to this function") put(bimap, key, value) ====================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L421 "View Source") ``` @spec put([t](#t:t/0)(), [k](#t:k/0)(), [v](#t:v/0)()) :: [t](#t:t/0)() ``` Inserts `{key, value}` pair into `bimap`. If either `key` or `value` is already in `bimap`, any overlapping bindings are deleted. [examples](#put/3-examples) Examples -------------------------------------- ``` iex> bimap = BiMap.new #BiMap<[]> iex> bimap = BiMap.put(bimap, :a, 0) #BiMap<[a: 0]> iex> bimap = BiMap.put(bimap, :a, 1) #BiMap<[a: 1]> iex> BiMap.put(bimap, :b, 1) #BiMap<[b: 1]> ``` [Link to this function](#put_new_key/3 "Link to this function") put\_new\_key(bimap, key, value) ================================ [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L455 "View Source") ``` @spec put_new_key([t](#t:t/0)(), [k](#t:k/0)(), [v](#t:v/0)()) :: [t](#t:t/0)() ``` Inserts `{key, value}` pair into `bimap` if `key` is not already in `bimap`. If `key` already exists in `bimap`, `bimap` is returned unchanged. If `key` does not exist and `value` is already in `bimap`, any overlapping bindings are deleted. [examples](#put_new_key/3-examples) Examples ---------------------------------------------- ``` iex> bimap = BiMap.new #BiMap<[]> iex> bimap = BiMap.put\_new\_key(bimap, :a, 0) #BiMap<[a: 0]> iex> bimap = BiMap.put\_new\_key(bimap, :a, 1) #BiMap<[a: 0]> iex> BiMap.put\_new\_key(bimap, :b, 1) #BiMap<[a: 0, b: 1]> iex> BiMap.put\_new\_key(bimap, :c, 1) #BiMap<[a: 0, c: 1]> ``` [Link to this function](#put_new_value/3 "Link to this function") put\_new\_value(bimap, key, value) ================================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L485 "View Source") ``` @spec put_new_value([t](#t:t/0)(), [k](#t:k/0)(), [v](#t:v/0)()) :: [t](#t:t/0)() ``` Inserts `{key, value}` pair into `bimap` if `value` is not already in `bimap`. If `value` already exists in `bimap`, `bimap` is returned unchanged. If `value` does not exist and `key` is already in `bimap`, any overlapping bindings are deleted. [examples](#put_new_value/3-examples) Examples ------------------------------------------------ ``` iex> bimap = BiMap.new #BiMap<[]> iex> bimap = BiMap.put\_new\_value(bimap, :a, 0) #BiMap<[a: 0]> iex> bimap = BiMap.put\_new\_value(bimap, :a, 1) #BiMap<[a: 1]> iex> BiMap.put\_new\_value(bimap, :b, 1) #BiMap<[a: 1]> iex> BiMap.put\_new\_value(bimap, :c, 2) #BiMap<[a: 1, c: 2]> ``` [Link to this function](#right/1 "Link to this function") right(bimap) ============ [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L157 "View Source") ``` @spec right([t](#t:t/0)()) :: %{required([v](#t:v/0)()) => [k](#t:k/0)()} ``` Returns `value ➜ key` mapping of `bimap`. [examples](#right/1-examples) Examples ---------------------------------------- ``` iex> bimap = BiMap.new([a: "foo", b: "bar"]) iex> BiMap.right(bimap) %{"foo" => :a, "bar" => :b} ``` [Link to this function](#size/1 "Link to this function") size(bimap) =========== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L128 "View Source") ``` @spec size([t](#t:t/0)()) :: [non\_neg\_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Returns the number of elements in `bimap`. The size of a bimap is the number of key-value pairs that the map contains. [examples](#size/1-examples) Examples --------------------------------------- ``` iex> BiMap.size(BiMap.new) 0 iex> bimap = BiMap.new([a: "foo", b: "bar"]) iex> BiMap.size(bimap) 2 ``` [Link to this function](#to_list/1 "Link to this function") to\_list(bimap) =============== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L585 "View Source") ``` @spec to_list([t](#t:t/0)()) :: [{[k](#t:k/0)(), [v](#t:v/0)()}] ``` Returns list of unique key-value pairs in `bimap`. [examples](#to_list/1-examples) Examples ------------------------------------------ ``` iex> bimap = BiMap.new([a: "foo", b: "bar"]) iex> BiMap.to\_list(bimap) [a: "foo", b: "bar"] ``` [Link to this function](#values/1 "Link to this function") values(bimap) ============= [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimap.ex#L183 "View Source") ``` @spec values([t](#t:t/0)()) :: [[v](#t:v/0)()] ``` Returns all values from `bimap`. [examples](#values/1-examples) Examples ----------------------------------------- ``` iex> bimap = BiMap.new([a: 1, b: 2]) iex> BiMap.values(bimap) [1, 2] ``` BiMultiMap β€” BiMap v1.2.2 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L1 "View Source") BiMultiMap (BiMap v1.2.2) =========================================================================================================================================== Bi-directional multimap implementation backed by two multimaps. Entries in bimap do not follow any order. BiMultiMaps do not impose any restriction on the key and value type: anything can be a key in a bimap, and also anything can be a value. BiMultiMaps differ from [`BiMap`](BiMap.html)s by disallowing duplicates only among key-value pairs, not among keys and values separately. This means it is possible to store `[(A, B), (A, C)]` or `[(X, Z), (Y, Z)]` in BiMultiMap. Keys and values are compared using the exact-equality operator (`===`). [example](#module-example) Example ------------------------------------ ``` iex> mm = BiMultiMap.new(a: 1, b: 2, b: 1) #BiMultiMap<[a: 1, b: 1, b: 2]> iex> BiMultiMap.get(mm, :a) [1] iex> BiMultiMap.get\_keys(mm, 1) [:a, :b] iex> BiMultiMap.put(mm, :a, 3) #BiMultiMap<[a: 1, a: 3, b: 1, b: 2]> ``` [protocols](#module-protocols) Protocols ------------------------------------------ [`BiMultiMap`](BiMultiMap.html#content) implements [`Enumerable`](https://hexdocs.pm/elixir/Enumerable.html), [`Collectable`](https://hexdocs.pm/elixir/Collectable.html) and [`Inspect`](https://hexdocs.pm/elixir/Inspect.html) protocols. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [k()](#t:k/0) Key type [t()](#t:t/0) [t(k, v)](#t:t/2) [v()](#t:v/0) Value type [Functions](#functions) ------------------------ [delete(bimultimap, kv)](#delete/2) Convenience shortcut for [`delete/3`](#delete/3). [delete(bimultimap, key, value)](#delete/3) Deletes `{key, value}` pair from `bimultimap`. [delete\_key(bimultimap, key)](#delete_key/2) Deletes `{key, _}` pair from `bimultimap`. [delete\_value(bimultimap, value)](#delete_value/2) Deletes `{_, value}` pair from `bimultimap`. [equal?(bimultimap1, bimultimap2)](#equal?/2) Checks if two bimultimaps are equal. [fetch!(bimultimap, key)](#fetch!/2) Fetches all values for specific `key` in `bimultimap` [fetch(bimultimap, key)](#fetch/2) Fetches all values for specific `key` in `bimultimap` [fetch\_keys!(bimultimap, value)](#fetch_keys!/2) Fetches all keys for specific `value` in `bimultimap` [fetch\_keys(bimultimap, value)](#fetch_keys/2) Fetches all keys for specific `value` in `bimultimap` [get(bimultimap, key, default \\ [])](#get/3) Gets all values for specific `key` in `bimultimap` [get\_keys(bimultimap, value, default \\ [])](#get_keys/3) Gets all keys for specific `value` in `bimultimap` [has\_key?(bimultimap, key)](#has_key?/2) Checks if `bimultimap` contains `key`. [has\_value?(bimultimap, value)](#has_value?/2) Checks if `bimultimap` contains `value`. [keys(bimultimap)](#keys/1) Returns all unique keys from `bimultimap`. [left(bimultimap)](#left/1) Returns `key ➜ [value]` mapping of `bimultimap`. [member?(bimultimap, kv)](#member?/2) Convenience shortcut for [`member?/3`](#member?/3). [member?(bimultimap, key, value)](#member?/3) Checks if `bimultimap` contains `{key, value}` pair. [new()](#new/0) Creates a new bimultimap. [new(enumerable)](#new/1) Creates a bimultimap from `enumerable` of key-value pairs. [new(enumerable, transform)](#new/2) Creates a bimultimap from `enumerable` via transform function returning key-value pairs. [put(bimultimap, kv)](#put/2) Convenience shortcut for [`put/3`](#put/3) [put(bimultimap, key, value)](#put/3) Inserts `{key, value}` pair into `bimultimap`. [right(bimultimap)](#right/1) Returns `value ➜ key` mapping of `bimultimap`. [size(bimultimap)](#size/1) Returns the number of elements in `bimultimap`. [to\_list(bimultimap)](#to_list/1) Returns list of unique key-value pairs in `bimultimap`. [values(bimultimap)](#values/1) Returns all unique values from `bimultimap`. [Link to this section](#types) Types ===================================== [Link to this type](#t:k/0 "Link to this type") k() === [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L33 "View Source") ``` @type k() :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Key type [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L53 "View Source") ``` @type t() :: [t](#t:t/2)([term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) ``` [Link to this type](#t:t/2 "Link to this type") t(k, v) ======= [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L47 "View Source") ``` @type t(k, v) :: %BiMultiMap{ keys: internal_keys(k, v), size: internal_size(), values: internal_values(k, v) } ``` [Link to this type](#t:v/0 "Link to this type") v() === [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L36 "View Source") ``` @type v() :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Value type [Link to this section](#functions) Functions ============================================= [Link to this function](#delete/2 "Link to this function") delete(bimultimap, kv) ====================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L592 "View Source") ``` @spec delete( [t](#t:t/0)(), {[k](#t:k/0)(), [v](#t:v/0)()} ) :: [t](#t:t/0)() ``` Convenience shortcut for [`delete/3`](#delete/3). [Link to this function](#delete/3 "Link to this function") delete(bimultimap, key, value) ============================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L498 "View Source") ``` @spec delete([t](#t:t/0)(), [k](#t:k/0)(), [v](#t:v/0)()) :: [t](#t:t/0)() ``` Deletes `{key, value}` pair from `bimultimap`. If the `key` does not exist, or `value` does not match, returns `bimultimap` unchanged. [examples](#delete/3-examples) Examples ----------------------------------------- ``` iex> bimultimap = BiMultiMap.new([a: 1, b: 2, c: 2]) iex> BiMultiMap.delete(bimultimap, :b, 2) #BiMultiMap<[a: 1, c: 2]> iex> BiMultiMap.delete(bimultimap, :c, 3) #BiMultiMap<[a: 1, b: 2, c: 2]> ``` [Link to this function](#delete_key/2 "Link to this function") delete\_key(bimultimap, key) ============================ [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L550 "View Source") ``` @spec delete_key([t](#t:t/0)(), [k](#t:k/0)()) :: [t](#t:t/0)() ``` Deletes `{key, _}` pair from `bimultimap`. If the `key` does not exist, returns `bimultimap` unchanged. [examples](#delete_key/2-examples) Examples --------------------------------------------- ``` iex> bimultimap = BiMultiMap.new([a: 1, b: 2, b: 3]) iex> BiMultiMap.delete\_key(bimultimap, :b) #BiMultiMap<[a: 1]> iex> BiMultiMap.delete\_key(bimultimap, :c) #BiMultiMap<[a: 1, b: 2, b: 3]> ``` [Link to this function](#delete_value/2 "Link to this function") delete\_value(bimultimap, value) ================================ [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L576 "View Source") ``` @spec delete_value([t](#t:t/0)(), [v](#t:v/0)()) :: [t](#t:t/0)() ``` Deletes `{_, value}` pair from `bimultimap`. If the `value` does not exist, returns `bimultimap` unchanged. [examples](#delete_value/2-examples) Examples ----------------------------------------------- ``` iex> bimultimap = BiMultiMap.new([a: 1, b: 2, c: 1]) iex> BiMultiMap.delete\_value(bimultimap, 1) #BiMultiMap<[b: 2]> iex> BiMultiMap.delete\_value(bimultimap, 3) #BiMultiMap<[a: 1, b: 2, c: 1]> ``` [Link to this function](#equal?/2 "Link to this function") equal?(bimultimap1, bimultimap2) ================================ [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L264 "View Source") ``` @spec equal?([t](#t:t/0)(), [t](#t:t/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Checks if two bimultimaps are equal. Two bimultimaps are considered to be equal if they contain the same keys and those keys are bound with the same values. [examples](#equal?/2-examples) Examples ----------------------------------------- ``` iex> Map.equal?(BiMultiMap.new([a: 1, b: 2, b: 3]), BiMultiMap.new([b: 2, b: 3, a: 1])) true iex> Map.equal?(BiMultiMap.new([a: 1, b: 2, b: 3]), BiMultiMap.new([b: 1, b: 3, a: 2])) false ``` [Link to this function](#fetch!/2 "Link to this function") fetch!(bimultimap, key) ======================= [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L372 "View Source") ``` @spec fetch!([t](#t:t/0)(), [k](#t:k/0)()) :: [[v](#t:v/0)()] ``` Fetches all values for specific `key` in `bimultimap` Raises [`ArgumentError`](https://hexdocs.pm/elixir/ArgumentError.html) if the key is absent. [examples](#fetch!/2-examples) Examples ----------------------------------------- ``` iex> bimultimap = BiMultiMap.new([a: 1, c: 1, c: 2]) iex> BiMultiMap.fetch!(bimultimap, :a) [1] iex> BiMultiMap.fetch!(bimultimap, :c) [1, 2] ``` [Link to this function](#fetch/2 "Link to this function") fetch(bimultimap, key) ====================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L349 "View Source") ``` @spec fetch([t](#t:t/0)(), [k](#t:k/0)()) :: {:ok, [[v](#t:v/0)()]} | :error ``` Fetches all values for specific `key` in `bimultimap` If `key` is present in `bimultimap` with values `values`, then `{:ok, values}` is returned. Otherwise, `:error` is returned. [examples](#fetch/2-examples) Examples ---------------------------------------- ``` iex> BiMultiMap.fetch(BiMultiMap.new(), :a) :error iex> bimultimap = BiMultiMap.new([a: 1, c: 1, c: 2]) iex> BiMultiMap.fetch(bimultimap, :a) {:ok, [1]} iex> BiMultiMap.fetch(bimultimap, :b) :error iex> BiMultiMap.fetch(bimultimap, :c) {:ok, [1, 2]} ``` [Link to this function](#fetch_keys!/2 "Link to this function") fetch\_keys!(bimultimap, value) =============================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L422 "View Source") ``` @spec fetch_keys!([t](#t:t/0)(), [v](#t:v/0)()) :: [[k](#t:k/0)()] ``` Fetches all keys for specific `value` in `bimultimap` Raises [`ArgumentError`](https://hexdocs.pm/elixir/ArgumentError.html) if the key is absent. This function is exact mirror of [`fetch!/2`](#fetch!/2). [examples](#fetch_keys!/2-examples) Examples ---------------------------------------------- ``` iex> bimultimap = BiMultiMap.new([a: 1, c: 3, d: 3]) iex> BiMultiMap.fetch\_keys!(bimultimap, 1) [:a] iex> BiMultiMap.fetch\_keys!(bimultimap, 3) [:c, :d] ``` [Link to this function](#fetch_keys/2 "Link to this function") fetch\_keys(bimultimap, value) ============================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L399 "View Source") ``` @spec fetch_keys([t](#t:t/0)(), [v](#t:v/0)()) :: {:ok, [[k](#t:k/0)()]} | :error ``` Fetches all keys for specific `value` in `bimultimap` This function is exact mirror of [`fetch/2`](#fetch/2). [examples](#fetch_keys/2-examples) Examples --------------------------------------------- ``` iex> BiMultiMap.fetch\_keys(BiMultiMap.new, 1) :error iex> bimultimap = BiMultiMap.new([a: 1, c: 3, d: 3]) iex> BiMultiMap.fetch\_keys(bimultimap, 1) {:ok, [:a]} iex> BiMultiMap.fetch\_keys(bimultimap, 2) :error iex> BiMultiMap.fetch\_keys(bimultimap, 3) {:ok, [:c, :d]} ``` [Link to this function](#get/3 "Link to this function") get(bimultimap, key, default \\ []) =================================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L292 "View Source") ``` @spec get([t](#t:t/0)(), [k](#t:k/0)(), [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [[v](#t:v/0)()] | [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Gets all values for specific `key` in `bimultimap` If `key` is present in `bimultimap` with values `values`, then `values` are returned. Otherwise, `default` is returned (which is `[]` unless specified otherwise). [examples](#get/3-examples) Examples -------------------------------------- ``` iex> BiMultiMap.get(BiMultiMap.new(), :a) [] iex> bimultimap = BiMultiMap.new([a: 1, c: 1, c: 2]) iex> BiMultiMap.get(bimultimap, :a) [1] iex> BiMultiMap.get(bimultimap, :b) [] iex> BiMultiMap.get(bimultimap, :b, 3) 3 iex> BiMultiMap.get(bimultimap, :c) [1, 2] ``` [Link to this function](#get_keys/3 "Link to this function") get\_keys(bimultimap, value, default \\ []) =========================================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L321 "View Source") ``` @spec get_keys([t](#t:t/0)(), [v](#t:v/0)(), [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [[k](#t:k/0)()] | [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Gets all keys for specific `value` in `bimultimap` This function is exact mirror of [`get/3`](#get/3). [examples](#get_keys/3-examples) Examples ------------------------------------------- ``` iex> BiMultiMap.get\_keys(BiMultiMap.new, 1) [] iex> bimultimap = BiMultiMap.new([a: 1, c: 3, d: 3]) iex> BiMultiMap.get\_keys(bimultimap, 1) [:a] iex> BiMultiMap.get\_keys(bimultimap, 2) [] iex> BiMultiMap.get\_keys(bimultimap, 2, :b) :b iex> BiMultiMap.get\_keys(bimultimap, 3) [:c, :d] ``` [Link to this function](#has_key?/2 "Link to this function") has\_key?(bimultimap, key) ========================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L226 "View Source") ``` @spec has_key?([t](#t:t/0)(), [k](#t:k/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Checks if `bimultimap` contains `key`. [examples](#has_key?/2-examples) Examples ------------------------------------------- ``` iex> bimultimap = BiMultiMap.new([a: "foo", b: "bar"]) iex> BiMultiMap.has\_key?(bimultimap, :a) true iex> BiMultiMap.has\_key?(bimultimap, :x) false ``` [Link to this function](#has_value?/2 "Link to this function") has\_value?(bimultimap, value) ============================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L244 "View Source") ``` @spec has_value?([t](#t:t/0)(), [v](#t:v/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Checks if `bimultimap` contains `value`. [examples](#has_value?/2-examples) Examples --------------------------------------------- ``` iex> bimultimap = BiMultiMap.new([a: "foo", b: "bar"]) iex> BiMultiMap.has\_value?(bimultimap, "foo") true iex> BiMultiMap.has\_value?(bimultimap, "moo") false ``` [Link to this function](#keys/1 "Link to this function") keys(bimultimap) ================ [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L171 "View Source") ``` @spec keys([t](#t:t/0)()) :: [[k](#t:k/0)()] ``` Returns all unique keys from `bimultimap`. [examples](#keys/1-examples) Examples --------------------------------------- ``` iex> bimultimap = BiMultiMap.new([a: 1, b: 2, b: 3]) iex> BiMultiMap.keys(bimultimap) [:a, :b] ``` [Link to this function](#left/1 "Link to this function") left(bimultimap) ================ [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L135 "View Source") ``` @spec left([t](#t:t/0)()) :: %{required([k](#t:k/0)()) => [[v](#t:v/0)()]} ``` Returns `key ➜ [value]` mapping of `bimultimap`. [examples](#left/1-examples) Examples --------------------------------------- ``` iex> bimultimap = BiMultiMap.new([a: "foo", b: "bar", b: "moo"]) iex> BiMultiMap.left(bimultimap) %{a: ["foo"], b: ["bar", "moo"]} ``` [Link to this function](#member?/2 "Link to this function") member?(bimultimap, kv) ======================= [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L211 "View Source") ``` @spec member?( [t](#t:t/0)(), {[k](#t:k/0)(), [v](#t:v/0)()} ) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Convenience shortcut for [`member?/3`](#member?/3). [Link to this function](#member?/3 "Link to this function") member?(bimultimap, key, value) =============================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L201 "View Source") ``` @spec member?([t](#t:t/0)(), [k](#t:k/0)(), [v](#t:v/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Checks if `bimultimap` contains `{key, value}` pair. [examples](#member?/3-examples) Examples ------------------------------------------ ``` iex> bimultimap = BiMultiMap.new([a: "foo", a: "moo", b: "bar"]) iex> BiMultiMap.member?(bimultimap, :a, "foo") true iex> BiMultiMap.member?(bimultimap, :a, "moo") true iex> BiMultiMap.member?(bimultimap, :a, "bar") false ``` [Link to this function](#new/0 "Link to this function") new() ===== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L66 "View Source") ``` @spec new() :: [t](#t:t/0)() ``` Creates a new bimultimap. [examples](#new/0-examples) Examples -------------------------------------- ``` iex> BiMultiMap.new #BiMultiMap<[]> ``` [Link to this function](#new/1 "Link to this function") new(enumerable) =============== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L79 "View Source") ``` @spec new([Enum.t](https://hexdocs.pm/elixir/Enum.html#t:t/0)()) :: [t](#t:t/0)() ``` Creates a bimultimap from `enumerable` of key-value pairs. Duplicated pairs are removed; the latest one prevails. [examples](#new/1-examples) Examples -------------------------------------- ``` iex> BiMultiMap.new([a: 1, a: 2]) #BiMultiMap<[a: 1, a: 2]> ``` [Link to this function](#new/2 "Link to this function") new(enumerable, transform) ========================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L98 "View Source") ``` @spec new([Enum.t](https://hexdocs.pm/elixir/Enum.html#t:t/0)(), ([term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() -> {[k](#t:k/0)(), [v](#t:v/0)()})) :: [t](#t:t/0)() ``` Creates a bimultimap from `enumerable` via transform function returning key-value pairs. [examples](#new/2-examples) Examples -------------------------------------- ``` iex> BiMultiMap.new([1, 2, 1], fn x -> {x, x \* 2} end) #BiMultiMap<[{1, 2}, {2, 4}]> ``` [Link to this function](#put/2 "Link to this function") put(bimultimap, kv) =================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L480 "View Source") ``` @spec put( [t](#t:t/0)(), {[k](#t:k/0)(), [v](#t:v/0)()} ) :: [t](#t:t/0)() ``` Convenience shortcut for [`put/3`](#put/3) [Link to this function](#put/3 "Link to this function") put(bimultimap, key, value) =========================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L451 "View Source") ``` @spec put([t](#t:t/0)(), [k](#t:k/0)(), [v](#t:v/0)()) :: [t](#t:t/0)() ``` Inserts `{key, value}` pair into `bimultimap`. If `{key, value}` is already in `bimultimap`, it is deleted. [examples](#put/3-examples) Examples -------------------------------------- ``` iex> bimultimap = BiMultiMap.new #BiMultiMap<[]> iex> bimultimap = BiMultiMap.put(bimultimap, :a, 1) #BiMultiMap<[a: 1]> iex> bimultimap = BiMultiMap.put(bimultimap, :a, 2) #BiMultiMap<[a: 1, a: 2]> iex> BiMultiMap.put(bimultimap, :b, 2) #BiMultiMap<[a: 1, a: 2, b: 2]> ``` [Link to this function](#right/1 "Link to this function") right(bimultimap) ================= [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L153 "View Source") ``` @spec right([t](#t:t/0)()) :: %{required([v](#t:v/0)()) => [[k](#t:k/0)()]} ``` Returns `value ➜ key` mapping of `bimultimap`. [examples](#right/1-examples) Examples ---------------------------------------- ``` iex> bimultimap = BiMultiMap.new([a: "foo", b: "bar", c: "bar"]) iex> BiMultiMap.right(bimultimap) %{"foo" => [:a], "bar" => [:b, :c]} ``` [Link to this function](#size/1 "Link to this function") size(bimultimap) ================ [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L122 "View Source") ``` @spec size([t](#t:t/0)()) :: [non\_neg\_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Returns the number of elements in `bimultimap`. The size of a bimultimap is the number of key-value pairs that the map contains. [examples](#size/1-examples) Examples --------------------------------------- ``` iex> BiMultiMap.size(BiMultiMap.new) 0 iex> bimultimap = BiMultiMap.new([a: "foo", a: "bar"]) iex> BiMultiMap.size(bimultimap) 2 ``` [Link to this function](#to_list/1 "Link to this function") to\_list(bimultimap) ==================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L605 "View Source") ``` @spec to_list([t](#t:t/0)()) :: [{[k](#t:k/0)(), [v](#t:v/0)()}] ``` Returns list of unique key-value pairs in `bimultimap`. [examples](#to_list/1-examples) Examples ------------------------------------------ ``` iex> bimultimap = BiMultiMap.new([a: "foo", b: "bar"]) iex> BiMultiMap.to\_list(bimultimap) [a: "foo", b: "bar"] ``` [Link to this function](#values/1 "Link to this function") values(bimultimap) ================== [View Source](https://github.com/mkaput/elixir-bimap/blob/v1.2.2/lib/bimultimap.ex#L184 "View Source") ``` @spec values([t](#t:t/0)()) :: [[v](#t:v/0)()] ``` Returns all unique values from `bimultimap`. [examples](#values/1-examples) Examples ----------------------------------------- ``` iex> bimultimap = BiMultiMap.new([a: 1, b: 2, c: 2]) iex> BiMultiMap.values(bimultimap) [1, 2] ```
google_api_firebase_rules
hex
API Reference β€” google\_api\_firebase\_rules v0.16.4 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } Settings API Reference google\_api\_firebase\_rules v0.16.4 ===============================================================
ash_core
hex
Ash β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L1 "View Source") =========================================================================================================== Ash Framework ![Logo](https://github.com/ash-project/ash/blob/master/logos/cropped-for-header.png?raw=true) Quick Links -------------- * [Resource DSL Documentation](Ash.Dsl.html) * [Api DSL Documentation](Ash.Api.Dsl.html) * [Api interface documentation](Ash.Api.html) * [Query Documentation](Ash.Query.html) * [Changeset Documentation](Ash.Changeset.html) * [Guides](getting_started.html) Introduction --------------- Traditional MVC Frameworks (Rails, Django, .Net, Phoenix, etc) leave it up to the user to build the glue between requests for data (HTTP requests in various forms as well as server-side domain logic) and their respective ORMs. In that space, there is an incredible amount of boilerplate code that must get written from scratch for each application (authentication, authorization, sorting, filtering, sideloading relationships, serialization, etc). Ash is an opinionated yet configurable framework designed to reduce boilerplate in an Elixir application. Ash does this by providing a layer of abstraction over your system's data layer(s) withΒ `Resources`. It is designed to be used in conjunction with a phoenix application, or on its own. To riff on a famous JRR Tolkien quote, aΒ `Resource`is "One Interface to rule them all, One Interface to find them" and will become an indispensable place to define contracts for interacting with data throughout your application. To start using Ash, first declare your `Resources` using the Ash `Resource` DSL. You could technically stop there, and just leverage the Ash Elixir API to avoid writing boilerplate. More likely, you would use extensions like Ash.JsonApi or Ash.GraphQL with Phoenix to add external interfaces to those resources without having to write any extra code at all. Ash is an open-source project and draws inspiration from similar ideas in other frameworks and concepts. The goal of Ash is to lower the barrier to adopting and using Elixir and Phoenix, and in doing so help these amazing communities attract new developers, projects, and companies. Example Resource ------------------- ``` defmodule Post do use Ash.Resource actions do read :default create :default end attributes do attribute :name, :string end relationships do belongs\_to :author, Author end end ``` See the [getting started guide](getting_started.html) for more information. For those looking to add ash extensions: * see [`Ash.Dsl.Extension`](Ash.Dsl.Extension.html) for adding configuration. * If you are looking to write a new data source, also see the [`Ash.DataLayer`](Ash.DataLayer.html) documentation. * If you are looking to write a new authorizer, see [`Ash.Authorizer`](Ash.Authorizer.html) * If you are looking to write a "front end", something powered by Ash resources, a guide on building those kinds of tools is in the works. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [action()](#t:action/0) [action\_type()](#t:action_type/0) [actor()](#t:actor/0) [api()](#t:api/0) [attribute()](#t:attribute/0) [cardinality\_many\_relationship()](#t:cardinality_many_relationship/0) [cardinality\_one\_relationship()](#t:cardinality_one_relationship/0) [changeset()](#t:changeset/0) [data\_layer()](#t:data_layer/0) [data\_layer\_query()](#t:data_layer_query/0) [error()](#t:error/0) [filter()](#t:filter/0) [params()](#t:params/0) [primary\_key()](#t:primary_key/0) [query()](#t:query/0) [record()](#t:record/0) [relationship()](#t:relationship/0) [relationship\_cardinality()](#t:relationship_cardinality/0) [resource()](#t:resource/0) [side\_loads()](#t:side_loads/0) [sort()](#t:sort/0) [validation()](#t:validation/0) [Functions](#functions) ------------------------ [extensions(resource)](#extensions/1) Returns all extensions of a resource or api [implements\_behaviour?(module, behaviour)](#implements_behaviour?/2) [Link to this section](#types) Types ===================================== [Link to this type](#t:action/0 "Link to this type") action() ======== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L63 "View Source") Specs ----- ``` action() :: [Ash.Resource.Actions.Create.t](Ash.Resource.Actions.Create.html#t:t/0)() | [Ash.Resource.Actions.Read.t](Ash.Resource.Actions.Read.html#t:t/0)() | [Ash.Resource.Actions.Update.t](Ash.Resource.Actions.Update.html#t:t/0)() | [Ash.Resource.Actions.Destroy.t](Ash.Resource.Actions.Destroy.html#t:t/0)() ``` [Link to this type](#t:action_type/0 "Link to this type") action\_type() ============== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L64 "View Source") Specs ----- ``` action_type() :: :read | :create | :update | :destroy ``` [Link to this type](#t:actor/0 "Link to this type") actor() ======= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L65 "View Source") Specs ----- ``` actor() :: [record](#t:record/0)() ``` [Link to this type](#t:api/0 "Link to this type") api() ===== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L66 "View Source") Specs ----- ``` api() :: [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this type](#t:attribute/0 "Link to this type") attribute() =========== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L67 "View Source") Specs ----- ``` attribute() :: Ash.Resource.Attribute.t() ``` [Link to this type](#t:cardinality_many_relationship/0 "Link to this type") cardinality\_many\_relationship() ================================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L68 "View Source") Specs ----- ``` cardinality_many_relationship() :: [Ash.Resource.Relationships.HasMany.t](Ash.Resource.Relationships.HasMany.html#t:t/0)() | [Ash.Resource.Relationships.ManyToMany.t](Ash.Resource.Relationships.ManyToMany.html#t:t/0)() ``` [Link to this type](#t:cardinality_one_relationship/0 "Link to this type") cardinality\_one\_relationship() ================================ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L69 "View Source") Specs ----- ``` cardinality_one_relationship() :: [Ash.Resource.Relationships.HasOne.t](Ash.Resource.Relationships.HasOne.html#t:t/0)() | [Ash.Resource.Relationships.BelongsTo.t](Ash.Resource.Relationships.BelongsTo.html#t:t/0)() ``` [Link to this type](#t:changeset/0 "Link to this type") changeset() =========== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L70 "View Source") Specs ----- ``` changeset() :: [Ash.Changeset.t](Ash.Changeset.html#t:t/0)() ``` [Link to this type](#t:data_layer/0 "Link to this type") data\_layer() ============= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L71 "View Source") Specs ----- ``` data_layer() :: [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this type](#t:data_layer_query/0 "Link to this type") data\_layer\_query() ==================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L72 "View Source") Specs ----- ``` data_layer_query() :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` [Link to this type](#t:error/0 "Link to this type") error() ======= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L73 "View Source") Specs ----- ``` error() :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` [Link to this type](#t:filter/0 "Link to this type") filter() ======== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L74 "View Source") Specs ----- ``` filter() :: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` [Link to this type](#t:params/0 "Link to this type") params() ======== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L75 "View Source") Specs ----- ``` params() :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)() ``` [Link to this type](#t:primary_key/0 "Link to this type") primary\_key() ============== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L76 "View Source") Specs ----- ``` primary_key() :: [record](#t:record/0)() | [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this type](#t:query/0 "Link to this type") query() ======= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L77 "View Source") Specs ----- ``` query() :: [Ash.Query.t](Ash.Query.html#t:t/0)() ``` [Link to this type](#t:record/0 "Link to this type") record() ======== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L78 "View Source") Specs ----- ``` record() :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` [Link to this type](#t:relationship/0 "Link to this type") relationship() ============== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L79 "View Source") Specs ----- ``` relationship() :: [cardinality\_one\_relationship](#t:cardinality_one_relationship/0)() | [cardinality\_many\_relationship](#t:cardinality_many_relationship/0)() ``` [Link to this type](#t:relationship_cardinality/0 "Link to this type") relationship\_cardinality() =========================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L80 "View Source") Specs ----- ``` relationship_cardinality() :: :many | :one ``` [Link to this type](#t:resource/0 "Link to this type") resource() ========== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L81 "View Source") Specs ----- ``` resource() :: [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this type](#t:side_loads/0 "Link to this type") side\_loads() ============= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L82 "View Source") Specs ----- ``` side_loads() :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)() ``` [Link to this type](#t:sort/0 "Link to this type") sort() ====== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L83 "View Source") Specs ----- ``` sort() :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)() ``` [Link to this type](#t:validation/0 "Link to this type") validation() ============ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L84 "View Source") Specs ----- ``` validation() :: [Ash.Resource.Validation.t](Ash.Resource.Validation.html#t:t/0)() ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#extensions/1 "Link to this function") extensions(resource) ==================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L100 "View Source") Specs ----- ``` extensions([resource](#t:resource/0)() | [api](#t:api/0)()) :: [[module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()] ``` Returns all extensions of a resource or api [Link to this function](#implements_behaviour?/2 "Link to this function") implements\_behaviour?(module, behaviour) ========================================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash.ex#L88 "View Source") Ash.Api β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Api behaviour [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L1 "View Source") ================================================================================================================================= An Api allows you to interact with your resources, and holds non-resource-specific configuration. Your Api can also house config that is not resource specific. Defining a resource won't do much for you. Once you have some resources defined, you include them in an Api like so: ``` defmodule MyApp.Api do use Ash.Api resources do resource OneResource resource SecondResource end ``` Then you can interact through that Api with the actions that those resources expose. For example: `MyApp.Api.create(changeset)`, or `MyApp.Api.read(query)`. Corresponding actions must be defined in your resources in order to call them through the Api. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [resource(api, resource)](#resource/2) [resources(api)](#resources/1) [Callbacks](#callbacks) ------------------------ [create(resource, params)](#c:create/2) Create a record. [create!(resource, params)](#c:create!/2) Create a record. See [`create/2`](#c:create/2) for more information. [destroy(record, params)](#c:destroy/2) Destroy a record. [destroy!(record, params)](#c:destroy!/2) Destroy a record. See [`destroy/2`](#c:destroy/2) for more information. [get(resource, id\_or\_filter, params)](#c:get/3) Get a record by a primary key. [get!(resource, id\_or\_filter, params)](#c:get!/3) Get a record by a primary key. See [`get/3`](#c:get/3) for more. [read(arg1, params)](#c:read/2) Run a query on a resource. [read!(arg1, params)](#c:read!/2) Run an ash query. See [`read/2`](#c:read/2) for more. [reload(record)](#c:reload/1) Refetches a record by primary key. [reload!(record, params)](#c:reload!/2) Refetches a record by primary key. See [`reload/1`](#c:reload/1) for more. [side\_load(resource, params)](#c:side_load/2) Side load on already fetched records. [side\_load!(resource, params)](#c:side_load!/2) Side load on already fetched records. See [`side_load/2`](#c:side_load/2) for more information. [update(record, params)](#c:update/2) Update a record. [update!(record, params)](#c:update!/2) Update a record. See [`update/2`](#c:update/2) for more information. [Link to this section](#functions) Functions ============================================= [Link to this function](#resource/2 "Link to this function") resource(api, resource) ======================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L247 "View Source") [Link to this function](#resources/1 "Link to this function") resources(api) ============== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L258 "View Source") Specs ----- ``` resources([Ash.api](Ash.html#t:api/0)()) :: [[Ash.resource](Ash.html#t:resource/0)()] ``` [Link to this section](#callbacks) Callbacks ============================================= [Link to this callback](#c:create/2 "Link to this callback") create(resource, params) ======================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L169 "View Source") Specs ----- ``` create(resource :: [Ash.resource](Ash.html#t:resource/0)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: {:ok, [Ash.record](Ash.html#t:record/0)()} | {:error, [Ash.error](Ash.html#t:error/0)()} ``` Create a record. * `:upsert?` - If a conflict is found based on the primary key, the record is updated in the database (requires upsert support) The default value is `false`. * `:side_load` - Side loads to include in the query, same as you would pass to [`Ash.Query.side_load/2`](Ash.Query.html#side_load/2) * `:verbose?` - Log engine operations (very verbose?) The default value is `false`. * `:action` - The action to use, either an Action struct or the name of the action * `:authorize?` - If an actor is provided, authorization happens automatically. If not, this flag can be used to authorize with no user. The default value is `false`. * `:actor` - If an actor is provided, it will be used in conjunction with the authorizers of a resource to authorize access [Link to this callback](#c:create!/2 "Link to this callback") create!(resource, params) ========================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L161 "View Source") Specs ----- ``` create!(resource :: [Ash.resource](Ash.html#t:resource/0)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: [Ash.record](Ash.html#t:record/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Create a record. See [`create/2`](#c:create/2) for more information. * `:upsert?` - If a conflict is found based on the primary key, the record is updated in the database (requires upsert support) The default value is `false`. * `:side_load` - Side loads to include in the query, same as you would pass to [`Ash.Query.side_load/2`](Ash.Query.html#side_load/2) * `:verbose?` - Log engine operations (very verbose?) The default value is `false`. * `:action` - The action to use, either an Action struct or the name of the action * `:authorize?` - If an actor is provided, authorization happens automatically. If not, this flag can be used to authorize with no user. The default value is `false`. * `:actor` - If an actor is provided, it will be used in conjunction with the authorizers of a resource to authorize access [Link to this callback](#c:destroy/2 "Link to this callback") destroy(record, params) ======================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L200 "View Source") Specs ----- ``` destroy(record :: [Ash.record](Ash.html#t:record/0)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: :ok | {:error, [Ash.error](Ash.html#t:error/0)()} ``` Destroy a record. * `:verbose?` - Log engine operations (very verbose?) The default value is `false`. * `:action` - The action to use, either an Action struct or the name of the action * `:authorize?` - If an actor is provided, authorization happens automatically. If not, this flag can be used to authorize with no user. The default value is `false`. * `:actor` - If an actor is provided, it will be used in conjunction with the authorizers of a resource to authorize access [Link to this callback](#c:destroy!/2 "Link to this callback") destroy!(record, params) ======================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L193 "View Source") Specs ----- ``` destroy!(record :: [Ash.record](Ash.html#t:record/0)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: :ok | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Destroy a record. See [`destroy/2`](#c:destroy/2) for more information. * `:verbose?` - Log engine operations (very verbose?) The default value is `false`. * `:action` - The action to use, either an Action struct or the name of the action * `:authorize?` - If an actor is provided, authorization happens automatically. If not, this flag can be used to authorize with no user. The default value is `false`. * `:actor` - If an actor is provided, it will be used in conjunction with the authorizers of a resource to authorize access [Link to this callback](#c:get/3 "Link to this callback") get(resource, id\_or\_filter, params) ===================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L116 "View Source") Specs ----- ``` get(resource :: [Ash.resource](Ash.html#t:resource/0)(), id_or_filter :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: {:ok, [Ash.record](Ash.html#t:record/0)()} | {:error, [Ash.error](Ash.html#t:error/0)()} ``` Get a record by a primary key. For a resource with a composite primary key, pass a keyword list, e.g `MyApi.get(MyResource, first_key: 1, second_key: 2)` * `:side_load` - Side loads to include in the query, same as you would pass to [`Ash.Query.side_load/2`](Ash.Query.html#side_load/2) * `:verbose?` - Log engine operations (very verbose?) The default value is `false`. * `:action` - The action to use, either an Action struct or the name of the action * `:authorize?` - If an actor is provided, authorization happens automatically. If not, this flag can be used to authorize with no user. The default value is `false`. * `:actor` - If an actor is provided, it will be used in conjunction with the authorizers of a resource to authorize access [Link to this callback](#c:get!/3 "Link to this callback") get!(resource, id\_or\_filter, params) ====================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L105 "View Source") Specs ----- ``` get!(resource :: [Ash.resource](Ash.html#t:resource/0)(), id_or_filter :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: [Ash.record](Ash.html#t:record/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Get a record by a primary key. See [`get/3`](#c:get/3) for more. * `:side_load` - Side loads to include in the query, same as you would pass to [`Ash.Query.side_load/2`](Ash.Query.html#side_load/2) * `:verbose?` - Log engine operations (very verbose?) The default value is `false`. * `:action` - The action to use, either an Action struct or the name of the action * `:authorize?` - If an actor is provided, authorization happens automatically. If not, this flag can be used to authorize with no user. The default value is `false`. * `:actor` - If an actor is provided, it will be used in conjunction with the authorizers of a resource to authorize access [Link to this callback](#c:read/2 "Link to this callback") read(arg1, params) ================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L134 "View Source") Specs ----- ``` read([Ash.query](Ash.html#t:query/0)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: {:ok, [[Ash.resource](Ash.html#t:resource/0)()]} | {:error, [Ash.error](Ash.html#t:error/0)()} ``` Run a query on a resource. For more information, on building a query, see [`Ash.Query`](Ash.Query.html). * `:verbose?` - Log engine operations (very verbose?) The default value is `false`. * `:action` - The action to use, either an Action struct or the name of the action * `:authorize?` - If an actor is provided, authorization happens automatically. If not, this flag can be used to authorize with no user. The default value is `false`. * `:actor` - If an actor is provided, it will be used in conjunction with the authorizers of a resource to authorize access [Link to this callback](#c:read!/2 "Link to this callback") read!(arg1, params) =================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L124 "View Source") Specs ----- ``` read!([Ash.query](Ash.html#t:query/0)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: [[Ash.resource](Ash.html#t:resource/0)()] | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Run an ash query. See [`read/2`](#c:read/2) for more. * `:verbose?` - Log engine operations (very verbose?) The default value is `false`. * `:action` - The action to use, either an Action struct or the name of the action * `:authorize?` - If an actor is provided, authorization happens automatically. If not, this flag can be used to authorize with no user. The default value is `false`. * `:actor` - If an actor is provided, it will be used in conjunction with the authorizers of a resource to authorize access [Link to this callback](#c:reload/1 "Link to this callback") reload(record) ============== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L211 "View Source") Specs ----- ``` reload(record :: [Ash.record](Ash.html#t:record/0)()) :: {:ok, [Ash.record](Ash.html#t:record/0)()} | {:error, [Ash.error](Ash.html#t:error/0)()} ``` Refetches a record by primary key. [Link to this callback](#c:reload!/2 "Link to this callback") reload!(record, params) ======================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L206 "View Source") Specs ----- ``` reload!(record :: [Ash.record](Ash.html#t:record/0)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: [Ash.record](Ash.html#t:record/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Refetches a record by primary key. See [`reload/1`](#c:reload/1) for more. [Link to this callback](#c:side_load/2 "Link to this callback") side\_load(resource, params) ============================ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L153 "View Source") Specs ----- ``` side_load(resource :: [Ash.resource](Ash.html#t:resource/0)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)() | [Ash.query](Ash.html#t:query/0)()) :: {:ok, [[Ash.resource](Ash.html#t:resource/0)()]} | {:error, [Ash.error](Ash.html#t:error/0)()} ``` Side load on already fetched records. Accepts a keyword list of side loads as they would be passed into [`Ash.Query.side_load/2`](Ash.Query.html#side_load/2) or an `%Ash.Query{}`, in which case that query's side loads are used. * `:verbose?` - Log engine operations (very verbose?) The default value is `false`. * `:action` - The action to use, either an Action struct or the name of the action * `:authorize?` - If an actor is provided, authorization happens automatically. If not, this flag can be used to authorize with no user. The default value is `false`. * `:actor` - If an actor is provided, it will be used in conjunction with the authorizers of a resource to authorize access [Link to this callback](#c:side_load!/2 "Link to this callback") side\_load!(resource, params) ============================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L142 "View Source") Specs ----- ``` side_load!(resource :: [Ash.resource](Ash.html#t:resource/0)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)() | [Ash.query](Ash.html#t:query/0)()) :: [[Ash.resource](Ash.html#t:resource/0)()] | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Side load on already fetched records. See [`side_load/2`](#c:side_load/2) for more information. * `:verbose?` - Log engine operations (very verbose?) The default value is `false`. * `:action` - The action to use, either an Action struct or the name of the action * `:authorize?` - If an actor is provided, authorization happens automatically. If not, this flag can be used to authorize with no user. The default value is `false`. * `:actor` - If an actor is provided, it will be used in conjunction with the authorizers of a resource to authorize access [Link to this callback](#c:update/2 "Link to this callback") update(record, params) ====================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L185 "View Source") Specs ----- ``` update(record :: [Ash.record](Ash.html#t:record/0)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: {:ok, [Ash.record](Ash.html#t:record/0)()} | {:error, [Ash.error](Ash.html#t:error/0)()} ``` Update a record. * `:side_load` - Side loads to include in the query, same as you would pass to [`Ash.Query.side_load/2`](Ash.Query.html#side_load/2) * `:verbose?` - Log engine operations (very verbose?) The default value is `false`. * `:action` - The action to use, either an Action struct or the name of the action * `:authorize?` - If an actor is provided, authorization happens automatically. If not, this flag can be used to authorize with no user. The default value is `false`. * `:actor` - If an actor is provided, it will be used in conjunction with the authorizers of a resource to authorize access [Link to this callback](#c:update!/2 "Link to this callback") update!(record, params) ======================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/api.ex#L177 "View Source") Specs ----- ``` update!(record :: [Ash.record](Ash.html#t:record/0)(), params :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: [Ash.record](Ash.html#t:record/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Update a record. See [`update/2`](#c:update/2) for more information. * `:side_load` - Side loads to include in the query, same as you would pass to [`Ash.Query.side_load/2`](Ash.Query.html#side_load/2) * `:verbose?` - Log engine operations (very verbose?) The default value is `false`. * `:action` - The action to use, either an Action struct or the name of the action * `:authorize?` - If an actor is provided, authorization happens automatically. If not, this flag can be used to authorize with no user. The default value is `false`. * `:actor` - If an actor is provided, it will be used in conjunction with the authorizers of a resource to authorize access Ash.Api.Dsl β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Api.Dsl [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/dsl.ex#L1 "View Source") =========================================================================================================================== A small DSL for declaring APIs Apis are the entrypoints for working with your resources. * resources - [`resources/1`](#resources/1) [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [resources(body)](#resources/1) List the resources present in this API [Link to this section](#functions) Functions ============================================= [Link to this macro](#resources/1 "Link to this macro") resources(body) =============== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/dsl.ex#L41 "View Source") (macro) List the resources present in this API Constructors --------------- * resource - [`Ash.Api.Dsl.Resource`](Ash.Api.Dsl.Resource.html) Ash.Api.Dsl.Resource β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Api.Dsl.Resource [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") ============================================================================================================================================ [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [resource(resource, opts \\ [])](#resource/2) A reference to a resource [Link to this section](#functions) Functions ============================================= [Link to this macro](#resource/2 "Link to this macro") resource(resource, opts \\ []) ============================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") (macro) A reference to a resource Examples ----------- ``` resource MyApp.User ``` Arguments ------------ * `:resource` - The module of the resource Ash.Api.ResourceReference β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Api.ResourceReference [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/resource_reference.ex#L1 "View Source") ======================================================================================================================================================== Represents a resource in an API Ash.Api.Transformers.EnsureResourcesCompiled β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Api.Transformers.EnsureResourcesCompiled [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/ensure_resources_compiled.ex#L1 "View Source") =============================================================================================================================================================================================== Ensures that all resources for a given api are compiled. This is required for later transformers. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [after?(\_)](#after?/1) Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1). [before?(\_)](#before?/1) Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1). [compile\_time\_only?()](#compile_time_only?/0) Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0). [transform(module, dsl)](#transform/2) Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2). [Link to this section](#functions) Functions ============================================= [Link to this function](#after?/1 "Link to this function") after?(\_) ========== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/ensure_resources_compiled.ex#L7 "View Source") Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1). [Link to this function](#before?/1 "Link to this function") before?(\_) =========== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/ensure_resources_compiled.ex#L7 "View Source") Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1). [Link to this function](#compile_time_only?/0 "Link to this function") compile\_time\_only?() ====================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/ensure_resources_compiled.ex#L7 "View Source") Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0). [Link to this function](#transform/2 "Link to this function") transform(module, dsl) ====================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/ensure_resources_compiled.ex#L11 "View Source") Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2). Ash.Api.Transformers.ValidateManyToManyJoinAttributes β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Api.Transformers.ValidateManyToManyJoinAttributes [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_many_to_many_join_attributes.ex#L1 "View Source") ==================================================================================================================================================================================================================== Validates that `join_attributes` on many to many relationships exist on the join resource [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [after?(arg1)](#after?/1) Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1). [before?(\_)](#before?/1) Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1). [compile\_time\_only?()](#compile_time_only?/0) Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0). [transform(api, dsl)](#transform/2) Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2). [Link to this section](#functions) Functions ============================================= [Link to this function](#after?/1 "Link to this function") after?(arg1) ============ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_many_to_many_join_attributes.ex#L41 "View Source") Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1). [Link to this function](#before?/1 "Link to this function") before?(\_) =========== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_many_to_many_join_attributes.ex#L5 "View Source") Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1). [Link to this function](#compile_time_only?/0 "Link to this function") compile\_time\_only?() ====================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_many_to_many_join_attributes.ex#L5 "View Source") Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0). [Link to this function](#transform/2 "Link to this function") transform(api, dsl) =================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_many_to_many_join_attributes.ex#L9 "View Source") Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2). Ash.Api.Transformers.ValidateRelatedResourceInclusion β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Api.Transformers.ValidateRelatedResourceInclusion [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_related_resource_inclusion.ex#L1 "View Source") ================================================================================================================================================================================================================== Ensures that all related resources are included in an API. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [before?(\_)](#before?/1) Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1). [compile\_time\_only?()](#compile_time_only?/0) Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0). [Link to this section](#functions) Functions ============================================= [Link to this function](#before?/1 "Link to this function") before?(\_) =========== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_related_resource_inclusion.ex#L5 "View Source") Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1). [Link to this function](#compile_time_only?/0 "Link to this function") compile\_time\_only?() ====================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_related_resource_inclusion.ex#L5 "View Source") Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0). Ash.Api.Transformers.ValidateRelationshipAttributes β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Api.Transformers.ValidateRelationshipAttributes [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_relationship_attributes.ex#L1 "View Source") ============================================================================================================================================================================================================= Validates that all relationships point to valid fields [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [after?(arg1)](#after?/1) Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1). [before?(\_)](#before?/1) Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1). [compile\_time\_only?()](#compile_time_only?/0) Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0). [transform(api, dsl)](#transform/2) Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2). [Link to this section](#functions) Functions ============================================= [Link to this function](#after?/1 "Link to this function") after?(arg1) ============ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_relationship_attributes.ex#L75 "View Source") Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1). [Link to this function](#before?/1 "Link to this function") before?(\_) =========== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_relationship_attributes.ex#L5 "View Source") Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1). [Link to this function](#compile_time_only?/0 "Link to this function") compile\_time\_only?() ====================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_relationship_attributes.ex#L5 "View Source") Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0). [Link to this function](#transform/2 "Link to this function") transform(api, dsl) =================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/api/transformers/validate_relationship_attributes.ex#L9 "View Source") Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2). Ash.Authorizer β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Authorizer behaviour [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L1 "View Source") =========================================================================================================================================== The interface for an ash authorizer These will typically be implemented by an extension, but a custom one can be implemented by defining a module that adopts this behaviour and using `@authorizers YourAuthorizer` to your resource. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [context()](#t:context/0) [state()](#t:state/0) [Functions](#functions) ------------------------ [check(module, state, context)](#check/3) [check\_context(module, state)](#check_context/2) [initial\_state(module, actor, resource, action, verbose?)](#initial_state/5) [strict\_check(module, state, context)](#strict_check/3) [strict\_check\_context(module, state)](#strict_check_context/2) [Callbacks](#callbacks) ------------------------ [check(state, context)](#c:check/2) [check\_context(state)](#c:check_context/1) [initial\_state(arg1, arg2, arg3, boolean)](#c:initial_state/4) [strict\_check(state, context)](#c:strict_check/2) [strict\_check\_context(state)](#c:strict_check_context/1) [Link to this section](#types) Types ===================================== [Link to this type](#t:context/0 "Link to this type") context() ========= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L10 "View Source") Specs ----- ``` context() :: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` [Link to this type](#t:state/0 "Link to this type") state() ======= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L9 "View Source") Specs ----- ``` state() :: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#check/3 "Link to this function") check(module, state, context) ============================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L39 "View Source") [Link to this function](#check_context/2 "Link to this function") check\_context(module, state) ============================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L35 "View Source") [Link to this function](#initial_state/5 "Link to this function") initial\_state(module, actor, resource, action, verbose?) ========================================================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L23 "View Source") [Link to this function](#strict_check/3 "Link to this function") strict\_check(module, state, context) ===================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L31 "View Source") [Link to this function](#strict_check_context/2 "Link to this function") strict\_check\_context(module, state) ===================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L27 "View Source") [Link to this section](#callbacks) Callbacks ============================================= [Link to this callback](#c:check/2 "Link to this callback") check(state, context) ===================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L20 "View Source") Specs ----- ``` check([state](#t:state/0)(), [context](#t:context/0)()) :: :authorized | {:data, [[Ash.record](Ash.html#t:record/0)()]} | {:error, [Ash.error](Ash.html#t:error/0)()} ``` [Link to this callback](#c:check_context/1 "Link to this callback") check\_context(state) ===================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L19 "View Source") Specs ----- ``` check_context([state](#t:state/0)()) :: [[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()] ``` [Link to this callback](#c:initial_state/4 "Link to this callback") initial\_state(arg1, arg2, arg3, boolean) ========================================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L11 "View Source") Specs ----- ``` initial_state([Ash.resource](Ash.html#t:resource/0)(), [Ash.actor](Ash.html#t:actor/0)(), [Ash.action](Ash.html#t:action/0)(), [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [state](#t:state/0)() ``` [Link to this callback](#c:strict_check/2 "Link to this callback") strict\_check(state, context) ============================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L13 "View Source") Specs ----- ``` strict_check([state](#t:state/0)(), [context](#t:context/0)()) :: :authorized | {:continue, [state](#t:state/0)()} | {:filter, [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()} | {:filter_and_continue, [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)(), [state](#t:state/0)()} | {:error, [Ash.error](Ash.html#t:error/0)()} ``` [Link to this callback](#c:strict_check_context/1 "Link to this callback") strict\_check\_context(state) ============================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/authorizer.ex#L12 "View Source") Specs ----- ``` strict_check_context([state](#t:state/0)()) :: [[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()] ``` Ash.Changeset β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Changeset [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L1 "View Source") ========================================================================================================================================= Changesets are used to create and update data in Ash. Create a changeset with `create/2` or `update/2`, and alter the attributes and relationships using the functions provided in this module. Nothing in this module actually incurs changes in a data layer. To commit a changeset, see [`Ash.Api.create/2`](Ash.Api.html#c:create/2) and [`Ash.Api.update/2`](Ash.Api.html#c:update/2). Primary Keys --------------- For relationship manipulation using [`append_to_relationship/3`](#append_to_relationship/3), [`remove_from_relationship/3`](#remove_from_relationship/3) and [`replace_relationship/3`](#replace_relationship/3) there are three types that can be used for primary keys: 1.) An instance of the resource in question. 2.) If the primary key is just a single field, i.e `:id`, then a single value, i.e `1` 3.) A map of keys to values representing the primary key, i.e `%{id: 1}` or `%{id: 1, org_id: 2}` Join Attributes ------------------ For many to many relationships, the attributes on a join relationship may be set while relating items by passing a tuple of the primary key and the changes to be applied. This is done via upserts, so update validations on the join resource are *not* applied, but create validations are. For example: ``` Ash.Changeset.replace\_relationship(changeset, :linked\_tickets, [ {1, %{link\_type: "blocking"}}, {a\_ticket, %{link\_type: "caused\_by"}}, {%{id: 2}, %{link\_type: "related\_to"}} ]) ``` [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [add\_error(changeset, error)](#add_error/2) Adds an error to the changesets errors list, and marks the change as `valid?: false` [after\_action(changeset, func)](#after_action/2) Adds an after\_action hook to the changeset. [append\_to\_relationship(changeset, relationship, record\_or\_records)](#append_to_relationship/3) Appends a record of list of records to a relationship. Stacks with previous removals/additions. [apply\_attributes(changeset)](#apply_attributes/1) Returns the original data with attribute changes merged. [before\_action(changeset, func)](#before_action/2) Adds a before\_action hook to the changeset. [change\_attribute(changeset, attribute, value)](#change_attribute/3) Adds a change to the changeset, unless the value matches the existing value [change\_attributes(changeset, changes)](#change_attributes/2) Calls [`change_attribute/3`](#change_attribute/3) for each key/value pair provided [change\_new\_attribute(changeset, attribute, value)](#change_new_attribute/3) Change an attribute only if is not currently being changed [change\_new\_attribute\_lazy(changeset, attribute, func)](#change_new_attribute_lazy/3) Change an attribute if is not currently being changed, by calling the provided function [changing\_attribute?(changeset, attribute)](#changing_attribute?/2) Returns true if an attribute exists in the changes [fetch\_change(changeset, attribute)](#fetch_change/2) Gets the new value for an attribute, or `:error` if it is not being changed [force\_change\_attribute(changeset, attribute, value)](#force_change_attribute/3) Changes an attribute even if it isn't writable [force\_change\_attributes(changeset, changes)](#force_change_attributes/2) Calls [`force_change_attribute/3`](#force_change_attribute/3) for each key/value pair provided [get\_attribute(changeset, attribute)](#get_attribute/2) Gets the changing value or the original value of an attribute [get\_data(changeset, attribute)](#get_data/2) Gets the original value for an attribute [new(resource, initial\_attributes \\ %{})](#new/2) Return a changeset over a resource or a record [remove\_from\_relationship(changeset, relationship, record\_or\_records)](#remove_from_relationship/3) Removes a record of list of records to a relationship. Stacks with previous removals/additions. [replace\_relationship(changeset, relationship, record\_or\_records)](#replace_relationship/3) Replaces the value of a relationship. Any previous additions/removals are cleared. [with\_hooks(changeset, func)](#with_hooks/2) Wraps a function in the before/after action hooks of a changeset. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L74 "View Source") Specs ----- ``` t() :: %Ash.Changeset{ action_type: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), after_action: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), api: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), attributes: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), before_action: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), change_dependencies: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), data: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), errors: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), relationships: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), requests: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), resource: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), valid?: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#add_error/2 "Link to this function") add\_error(changeset, error) ============================ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L548 "View Source") Specs ----- ``` add_error([t](#t:t/0)(), [Ash.error](Ash.html#t:error/0)()) :: [t](#t:t/0)() ``` Adds an error to the changesets errors list, and marks the change as `valid?: false` [Link to this function](#after_action/2 "Link to this function") after\_action(changeset, func) ============================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L534 "View Source") Specs ----- ``` after_action([t](#t:t/0)(), ([t](#t:t/0)(), [Ash.record](Ash.html#t:record/0)() -> {:ok, [Ash.record](Ash.html#t:record/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()})) :: [t](#t:t/0)() ``` Adds an after\_action hook to the changeset. [Link to this function](#append_to_relationship/3 "Link to this function") append\_to\_relationship(changeset, relationship, record\_or\_records) ====================================================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L185 "View Source") Specs ----- ``` append_to_relationship([t](#t:t/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [Ash.primary\_key](Ash.html#t:primary_key/0)() | [[Ash.primary\_key](Ash.html#t:primary_key/0)()]) :: [t](#t:t/0)() ``` Appends a record of list of records to a relationship. Stacks with previous removals/additions. Accepts a primary key or a list of primary keys. See the section on "Primary Keys" in the module documentation for more. For many to many relationships, accepts changes for any `join_attributes` configured on the resource. See the section on "Join Attributes" in the module documentation for more. Cannot be used with `belongs_to` or `has_one` relationships. See [`replace_relationship/3`](#replace_relationship/3) for manipulating `belongs_to` and `has_one` relationships. [Link to this function](#apply_attributes/1 "Link to this function") apply\_attributes(changeset) ============================ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L540 "View Source") Specs ----- ``` apply_attributes([t](#t:t/0)()) :: [Ash.record](Ash.html#t:record/0)() ``` Returns the original data with attribute changes merged. [Link to this function](#before_action/2 "Link to this function") before\_action(changeset, func) =============================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L528 "View Source") Specs ----- ``` before_action([t](#t:t/0)(), ([t](#t:t/0)() -> [t](#t:t/0)())) :: [t](#t:t/0)() ``` Adds a before\_action hook to the changeset. [Link to this function](#change_attribute/3 "Link to this function") change\_attribute(changeset, attribute, value) ============================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L436 "View Source") Adds a change to the changeset, unless the value matches the existing value [Link to this function](#change_attributes/2 "Link to this function") change\_attributes(changeset, changes) ====================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L429 "View Source") Specs ----- ``` change_attributes([t](#t:t/0)(), [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: [t](#t:t/0)() ``` Calls [`change_attribute/3`](#change_attribute/3) for each key/value pair provided [Link to this function](#change_new_attribute/3 "Link to this function") change\_new\_attribute(changeset, attribute, value) =================================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L404 "View Source") Specs ----- ``` change_new_attribute([t](#t:t/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [t](#t:t/0)() ``` Change an attribute only if is not currently being changed [Link to this function](#change_new_attribute_lazy/3 "Link to this function") change\_new\_attribute\_lazy(changeset, attribute, func) ======================================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L419 "View Source") Specs ----- ``` change_new_attribute_lazy([t](#t:t/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), (() -> [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)())) :: [t](#t:t/0)() ``` Change an attribute if is not currently being changed, by calling the provided function Use this if you want to only perform some expensive calculation for an attribute value only if there isn't already a change for that attribute [Link to this function](#changing_attribute?/2 "Link to this function") changing\_attribute?(changeset, attribute) ========================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L398 "View Source") Specs ----- ``` changing_attribute?([t](#t:t/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Returns true if an attribute exists in the changes [Link to this function](#fetch_change/2 "Link to this function") fetch\_change(changeset, attribute) =================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L162 "View Source") Specs ----- ``` fetch_change([t](#t:t/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: {:ok, [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} | :error ``` Gets the new value for an attribute, or `:error` if it is not being changed [Link to this function](#force_change_attribute/3 "Link to this function") force\_change\_attribute(changeset, attribute, value) ===================================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L488 "View Source") Specs ----- ``` force_change_attribute([t](#t:t/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [t](#t:t/0)() ``` Changes an attribute even if it isn't writable [Link to this function](#force_change_attributes/2 "Link to this function") force\_change\_attributes(changeset, changes) ============================================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L480 "View Source") Specs ----- ``` force_change_attributes([t](#t:t/0)(), [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [t](#t:t/0)() ``` Calls [`force_change_attribute/3`](#force_change_attribute/3) for each key/value pair provided [Link to this function](#get_attribute/2 "Link to this function") get\_attribute(changeset, attribute) ==================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L150 "View Source") Specs ----- ``` get_attribute([t](#t:t/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Gets the changing value or the original value of an attribute [Link to this function](#get_data/2 "Link to this function") get\_data(changeset, attribute) =============================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L168 "View Source") Specs ----- ``` get_data([t](#t:t/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: {:ok, [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} | :error ``` Gets the original value for an attribute [Link to this function](#new/2 "Link to this function") new(resource, initial\_attributes \\ %{}) ========================================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L86 "View Source") Specs ----- ``` new([Ash.resource](Ash.html#t:resource/0)() | [Ash.record](Ash.html#t:record/0)(), [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [t](#t:t/0)() ``` Return a changeset over a resource or a record [Link to this function](#remove_from_relationship/3 "Link to this function") remove\_from\_relationship(changeset, relationship, record\_or\_records) ======================================================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L254 "View Source") Specs ----- ``` remove_from_relationship([t](#t:t/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [Ash.primary\_key](Ash.html#t:primary_key/0)() | [[Ash.primary\_key](Ash.html#t:primary_key/0)()]) :: [t](#t:t/0)() ``` Removes a record of list of records to a relationship. Stacks with previous removals/additions. Accepts a primary key or a list of primary keys. See the section on "Primary Keys" in the module documentation for more. Cannot be used with `belongs_to` or `has_one` relationships. See [`replace_relationship/3`](#replace_relationship/3) for manipulating those relationships. [Link to this function](#replace_relationship/3 "Link to this function") replace\_relationship(changeset, relationship, record\_or\_records) =================================================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L329 "View Source") Specs ----- ``` replace_relationship([t](#t:t/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [Ash.primary\_key](Ash.html#t:primary_key/0)() | [[Ash.primary\_key](Ash.html#t:primary_key/0)()]) :: [t](#t:t/0)() ``` Replaces the value of a relationship. Any previous additions/removals are cleared. Accepts a primary key or a list of primary keys. See the section on "Primary Keys" in the module documentation for more. For many to many relationships, accepts changes for any `join_attributes` configured on the resource. See the section on "Join Attributes" in the module documentation for more. For a `has_many` or `many_to_many` relationship, this means removing any currently related records that are not present in the replacement list, and creating any that do not exist in the data layer. For a `belongs_to` or `has_one`, replace with a `nil` value to unset a relationship. [Link to this function](#with_hooks/2 "Link to this function") with\_hooks(changeset, func) ============================ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/changeset/changeset.ex#L117 "View Source") Specs ----- ``` with_hooks([t](#t:t/0)(), ([t](#t:t/0)() -> {:ok, [Ash.record](Ash.html#t:record/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()})) :: {:ok, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` Wraps a function in the before/after action hooks of a changeset. The function takes a changeset and if it returns `{:ok, result}`, the result will be passed through the after action hooks. Ash.DataLayer β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.DataLayer behaviour [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L1 "View Source") ===================================================================================================================================================== The interface for being an ash data layer. This is a large behaviour, and this capability is not complete, but the idea is to have a large amount of optional callbacks, and use the [`can?/2`](#can?/2) callback to ensure that the engine only ever tries to interact with the data layer in ways that it supports. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [feature()](#t:feature/0) [Functions](#functions) ------------------------ [can?(feature, resource)](#can?/2) [create(resource, changeset)](#create/2) [custom\_filters(resource)](#custom_filters/1) [filter(query, filter, resource)](#filter/3) [limit(query, limit, resource)](#limit/3) [offset(query, offset, resource)](#offset/3) [resource\_to\_query(resource)](#resource_to_query/1) [run\_query(query, central\_resource)](#run_query/2) [sort(query, sort, resource)](#sort/3) [source(resource)](#source/1) [transact(resource, func)](#transact/2) [update(resource, changeset)](#update/2) [upsert(resource, changeset)](#upsert/2) [Callbacks](#callbacks) ------------------------ [can?(arg1, feature)](#c:can?/2) [create(arg1, arg2)](#c:create/2) [custom\_filters(arg1)](#c:custom_filters/1) [destroy(record)](#c:destroy/1) [filter(arg1, arg2, resource)](#c:filter/3) [in\_transaction?(arg1)](#c:in_transaction?/1) [limit(arg1, limit, resource)](#c:limit/3) [offset(arg1, offset, resource)](#c:offset/3) [resource\_to\_query(arg1)](#c:resource_to_query/1) [rollback(arg1, term)](#c:rollback/2) [run\_query(arg1, arg2)](#c:run_query/2) [sort(arg1, arg2, resource)](#c:sort/3) [source(arg1)](#c:source/1) [transaction(arg1, function)](#c:transaction/2) [update(arg1, arg2)](#c:update/2) [upsert(arg1, arg2)](#c:upsert/2) [Link to this section](#types) Types ===================================== [Link to this type](#t:feature/0 "Link to this type") feature() ========= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L10 "View Source") Specs ----- ``` feature() :: :transact | :boolean_filter | :async_engine | :join | :transact | {:filter_predicate, [Ash.Type.t](Ash.Type.html#t:t/0)(), [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} | {:sort, [Ash.Type.t](Ash.Type.html#t:t/0)()} | :upsert | :delete_with_query | :composite_primary_key ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#can?/2 "Link to this function") can?(feature, resource) ======================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L124 "View Source") Specs ----- ``` can?([feature](#t:feature/0)(), [Ash.resource](Ash.html#t:resource/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this function](#create/2 "Link to this function") create(resource, changeset) =========================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L70 "View Source") Specs ----- ``` create([Ash.resource](Ash.html#t:resource/0)(), [Ash.changeset](Ash.html#t:changeset/0)()) :: {:ok, [Ash.record](Ash.html#t:record/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` [Link to this function](#custom_filters/1 "Link to this function") custom\_filters(resource) ========================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L144 "View Source") [Link to this function](#filter/3 "Link to this function") filter(query, filter, resource) =============================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L91 "View Source") Specs ----- ``` filter([Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)(), [Ash.filter](Ash.html#t:filter/0)(), [Ash.resource](Ash.html#t:resource/0)()) :: {:ok, [Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` [Link to this function](#limit/3 "Link to this function") limit(query, limit, resource) ============================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L107 "View Source") Specs ----- ``` limit([Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)(), limit :: [non\_neg\_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [Ash.resource](Ash.html#t:resource/0)()) :: {:ok, [Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` [Link to this function](#offset/3 "Link to this function") offset(query, offset, resource) =============================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L116 "View Source") Specs ----- ``` offset([Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)(), offset :: [non\_neg\_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [Ash.resource](Ash.html#t:resource/0)()) :: {:ok, [Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` [Link to this function](#resource_to_query/1 "Link to this function") resource\_to\_query(resource) ============================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L58 "View Source") Specs ----- ``` resource_to_query([Ash.resource](Ash.html#t:resource/0)()) :: [Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)() ``` [Link to this function](#run_query/2 "Link to this function") run\_query(query, central\_resource) ==================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L131 "View Source") Specs ----- ``` run_query([Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)(), central_resource :: [Ash.resource](Ash.html#t:resource/0)()) :: {:ok, [[Ash.record](Ash.html#t:record/0)()]} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` [Link to this function](#sort/3 "Link to this function") sort(query, sort, resource) =========================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L100 "View Source") Specs ----- ``` sort([Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)(), [Ash.sort](Ash.html#t:sort/0)(), [Ash.resource](Ash.html#t:resource/0)()) :: {:ok, [Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` [Link to this function](#source/1 "Link to this function") source(resource) ================ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L75 "View Source") Specs ----- ``` source([Ash.resource](Ash.html#t:resource/0)()) :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#transact/2 "Link to this function") transact(resource, func) ======================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L135 "View Source") [Link to this function](#update/2 "Link to this function") update(resource, changeset) =========================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L64 "View Source") Specs ----- ``` update([Ash.resource](Ash.html#t:resource/0)(), [Ash.changeset](Ash.html#t:changeset/0)()) :: {:ok, [Ash.record](Ash.html#t:record/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` [Link to this function](#upsert/2 "Link to this function") upsert(resource, changeset) =========================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L85 "View Source") Specs ----- ``` upsert([Ash.resource](Ash.html#t:resource/0)(), [Ash.changeset](Ash.html#t:changeset/0)()) :: {:ok, [Ash.record](Ash.html#t:record/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` [Link to this section](#callbacks) Callbacks ============================================= [Link to this callback](#c:can?/2 "Link to this callback") can?(arg1, feature) =================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L48 "View Source") Specs ----- ``` can?([Ash.resource](Ash.html#t:resource/0)(), [feature](#t:feature/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this callback](#c:create/2 "Link to this callback") create(arg1, arg2) ================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L37 "View Source") Specs ----- ``` create([Ash.resource](Ash.html#t:resource/0)(), [Ash.changeset](Ash.html#t:changeset/0)()) :: {:ok, [Ash.resource](Ash.html#t:resource/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` [Link to this callback](#c:custom_filters/1 "Link to this callback") custom\_filters(arg1) ===================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L22 "View Source") (optional) Specs ----- ``` custom_filters([Ash.resource](Ash.html#t:resource/0)()) :: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` [Link to this callback](#c:destroy/1 "Link to this callback") destroy(record) =============== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L43 "View Source") Specs ----- ``` destroy(record :: [Ash.record](Ash.html#t:record/0)()) :: :ok | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` [Link to this callback](#c:filter/3 "Link to this callback") filter(arg1, arg2, resource) ============================ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L23 "View Source") Specs ----- ``` filter([Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)(), [Ash.filter](Ash.html#t:filter/0)(), resource :: [Ash.resource](Ash.html#t:resource/0)()) :: {:ok, [Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` [Link to this callback](#c:in_transaction?/1 "Link to this callback") in\_transaction?(arg1) ====================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L45 "View Source") (optional) Specs ----- ``` in_transaction?([Ash.resource](Ash.html#t:resource/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this callback](#c:limit/3 "Link to this callback") limit(arg1, limit, resource) ============================ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L27 "View Source") Specs ----- ``` limit( [Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)(), limit :: [non\_neg\_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), resource :: [Ash.resource](Ash.html#t:resource/0)() ) :: {:ok, [Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` [Link to this callback](#c:offset/3 "Link to this callback") offset(arg1, offset, resource) ============================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L29 "View Source") Specs ----- ``` offset( [Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)(), offset :: [non\_neg\_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), resource :: [Ash.resource](Ash.html#t:resource/0)() ) :: {:ok, [Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` [Link to this callback](#c:resource_to_query/1 "Link to this callback") resource\_to\_query(arg1) ========================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L34 "View Source") Specs ----- ``` resource_to_query([Ash.resource](Ash.html#t:resource/0)()) :: [Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)() ``` [Link to this callback](#c:rollback/2 "Link to this callback") rollback(arg1, term) ==================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L47 "View Source") (optional) Specs ----- ``` rollback([Ash.resource](Ash.html#t:resource/0)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this callback](#c:run_query/2 "Link to this callback") run\_query(arg1, arg2) ====================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L35 "View Source") Specs ----- ``` run_query([Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)(), [Ash.resource](Ash.html#t:resource/0)()) :: {:ok, [[Ash.resource](Ash.html#t:resource/0)()]} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` [Link to this callback](#c:sort/3 "Link to this callback") sort(arg1, arg2, resource) ========================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L25 "View Source") Specs ----- ``` sort([Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)(), [Ash.sort](Ash.html#t:sort/0)(), resource :: [Ash.resource](Ash.html#t:resource/0)()) :: {:ok, [Ash.data\_layer\_query](Ash.html#t:data_layer_query/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` [Link to this callback](#c:source/1 "Link to this callback") source(arg1) ============ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L46 "View Source") (optional) Specs ----- ``` source([Ash.resource](Ash.html#t:resource/0)()) :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this callback](#c:transaction/2 "Link to this callback") transaction(arg1, function) =========================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L44 "View Source") (optional) Specs ----- ``` transaction([Ash.resource](Ash.html#t:resource/0)(), (() -> [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)())) :: {:ok, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` [Link to this callback](#c:update/2 "Link to this callback") update(arg1, arg2) ================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L41 "View Source") Specs ----- ``` update([Ash.resource](Ash.html#t:resource/0)(), [Ash.changeset](Ash.html#t:changeset/0)()) :: {:ok, [Ash.resource](Ash.html#t:resource/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` [Link to this callback](#c:upsert/2 "Link to this callback") upsert(arg1, arg2) ================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/data_layer.ex#L39 "View Source") (optional) Specs ----- ``` upsert([Ash.resource](Ash.html#t:resource/0)(), [Ash.changeset](Ash.html#t:changeset/0)()) :: {:ok, [Ash.resource](Ash.html#t:resource/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` Ash.DataLayer.Ets β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.DataLayer.Ets [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/ets.ex#L1 "View Source") ======================================================================================================================================== An ETS (Erlang Term Storage) backed Ash Datalayer, for testing. This is used for testing. *Do not use this data layer in production* [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [ets(body)](#ets/1) A section for configuring the ets data layer [filter\_matches(records, filter)](#filter_matches/2) [private?(resource)](#private?/1) [Link to this section](#functions) Functions ============================================= [Link to this macro](#ets/1 "Link to this macro") ets(body) ========= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/ets.ex#L27 "View Source") (macro) A section for configuring the ets data layer Options ---------- * `:private?` - The default value is `false`. [Link to this function](#filter_matches/2 "Link to this function") filter\_matches(records, filter) ================================ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/ets.ex#L112 "View Source") [Link to this function](#private?/1 "Link to this function") private?(resource) ================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/ets.ex#L31 "View Source") Specs ----- ``` private?([Ash.resource](Ash.html#t:resource/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Ash.DataLayer.Mnesia β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.DataLayer.Mnesia [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/mnesia.ex#L1 "View Source") ============================================================================================================================================== An Mnesia backed Ash Datalayer. In your application intialization, you will need to call `Mnesia.create_schema([node()])`. Additionally, you will want to create your mnesia tables there. This data layer is *extremely unoptimized*, fetching all records from a table and filtering them in place. This is primarily used for testing the behavior of data layers in Ash. If it was improved, it could be a viable data layer. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [mnesia(body)](#mnesia/1) A section for configuring the mnesia data layer [start(api)](#start/1) [table(resource)](#table/1) [Link to this section](#functions) Functions ============================================= [Link to this macro](#mnesia/1 "Link to this macro") mnesia(body) ============ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/mnesia.ex#L60 "View Source") (macro) A section for configuring the mnesia data layer Options ---------- * `:table` - The table name to use, defaults to the name of the resource [Link to this function](#start/1 "Link to this function") start(api) ========== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/mnesia.ex#L18 "View Source") [Link to this function](#table/1 "Link to this function") table(resource) =============== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/data_layer/mnesia.ex#L64 "View Source") Ash.Dsl β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Dsl [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/dsl.ex#L1 "View Source") ======================================================================================================================= The built in resource DSL. The four core DSL components of a resource are: * attributes - [`attributes/1`](#attributes/1) * relationships - [`relationships/1`](#relationships/1) * actions - [`actions/1`](#actions/1) * validations - [`validations/1`](#validations/1) [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [actions(body)](#actions/1) A section for declaring resource actions. [attributes(body)](#attributes/1) A section for declaring attributes on the resource. [relationships(body)](#relationships/1) A section for declaring relationships on the resource. [resource(body)](#resource/1) Resource-wide configuration [validations(body)](#validations/1) Declare validations prior to performing actions against the resource [Link to this section](#functions) Functions ============================================= [Link to this macro](#actions/1 "Link to this macro") actions(body) ============= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/dsl.ex#L296 "View Source") (macro) A section for declaring resource actions. All manipulation of data through the underlying data layer happens through actions. There are four types of action: `create`, `read`, `update`, and `destroy`. You may recognize these from the acronym `CRUD`. You can have multiple actions of the same type, as long as they have different names. This is the primary mechanism for customizing your resources to conform to your business logic. It is normal and expected to have multiple actions of each type in a large application. If you have multiple actions of the same type, one of them must be designated as the primary action for that type, via: `primary?: true`. This tells the ash what to do if an action of that type is requested, but no specific action name is given. Constructors --------------- * create - [`Ash.Dsl.Create`](Ash.Dsl.Create.html) * read - [`Ash.Dsl.Read`](Ash.Dsl.Read.html) * update - [`Ash.Dsl.Update`](Ash.Dsl.Update.html) * destroy - [`Ash.Dsl.Destroy`](Ash.Dsl.Destroy.html) [Link to this macro](#attributes/1 "Link to this macro") attributes(body) ================ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/dsl.ex#L296 "View Source") (macro) A section for declaring attributes on the resource. Attributes are fields on an instance of a resource. The two required pieces of knowledge are the field name, and the type. Constructors --------------- * attribute - [`Ash.Dsl.Attribute`](Ash.Dsl.Attribute.html) * create\_timestamp - [`Ash.Dsl.CreateTimestamp`](Ash.Dsl.CreateTimestamp.html) * update\_timestamp - [`Ash.Dsl.UpdateTimestamp`](Ash.Dsl.UpdateTimestamp.html) [Link to this macro](#relationships/1 "Link to this macro") relationships(body) =================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/dsl.ex#L296 "View Source") (macro) A section for declaring relationships on the resource. Relationships are a core component of resource oriented design. Many components of Ash will use these relationships. A simple use case is side\_loading (done via the [`Ash.Query.side_load/2`](Ash.Query.html#side_load/2)). Constructors --------------- * has\_one - [`Ash.Dsl.HasOne`](Ash.Dsl.HasOne.html) * has\_many - [`Ash.Dsl.HasMany`](Ash.Dsl.HasMany.html) * many\_to\_many - [`Ash.Dsl.ManyToMany`](Ash.Dsl.ManyToMany.html) * belongs\_to - [`Ash.Dsl.BelongsTo`](Ash.Dsl.BelongsTo.html) [Link to this macro](#resource/1 "Link to this macro") resource(body) ============== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/dsl.ex#L296 "View Source") (macro) Resource-wide configuration Options ---------- * `:description` [Link to this macro](#validations/1 "Link to this macro") validations(body) ================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/dsl.ex#L296 "View Source") (macro) Declare validations prior to performing actions against the resource Constructors --------------- * validate - [`Ash.Dsl.Validate`](Ash.Dsl.Validate.html) Ash.Dsl.Attribute β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Dsl.Attribute [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") ========================================================================================================================================= [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [attribute(name, type, opts \\ [])](#attribute/3) Declares an attribute on the resource [Link to this section](#functions) Functions ============================================= [Link to this macro](#attribute/3 "Link to this macro") attribute(name, type, opts \\ []) ================================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") (macro) Declares an attribute on the resource Type can be either a built in type (see [`Ash.Type`](Ash.Type.html)) for more, or a module implementing the [`Ash.Type`](Ash.Type.html) behaviour. Examples ----------- ``` attribute :first\_name, :string, primary\_key?: true ``` Arguments ------------ * `:name` - The name of the attribute. * `:type` - The type of the attribute. Options ---------- * `:constraints` - Constraints to provide to the type when casting the value. See the type's documentation for more information. * `:primary_key?` - Whether or not the attribute is part of the primary key (one or more fields that uniquely identify a resource) The default value is `false`. * `:allow_nil?` - Whether or not the attribute can be set to nil The default value is `true`. * `:generated?` - Whether or not the value may be generated by the data layer. If it is, the data layer will know to read the value back after writing. The default value is `false`. * `:writable?` - Whether or not the value can be written to The default value is `true`. * `:update_default` - A zero argument function, an {mod, fun, args} triple or `{:constant, value}`. If no value is provided for the attribute on update, this value is used. * `:default` - A zero argument function, an {mod, fun, args} triple or `{:constant, value}`. If no value is provided for the attribute on create, this value is used. Ash.Dsl.BelongsTo β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Dsl.BelongsTo [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") ========================================================================================================================================= [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [belongs\_to(name, destination, opts \\ [])](#belongs_to/3) Declares a belongs\_to relationship. In a relational database, the foreign key would be on the *source* table. [Link to this section](#functions) Functions ============================================= [Link to this macro](#belongs_to/3 "Link to this macro") belongs\_to(name, destination, opts \\ []) ========================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") (macro) Declares a belongs\_to relationship. In a relational database, the foreign key would be on the *source* table. This creates a field on the resource with the corresponding name and type, unless `define_field?: false` is provided. Examples ----------- ``` # In a resource called `Word` belongs\_to :dictionary\_entry, DictionaryEntry, source\_field: :text, destination\_field: :word\_text ``` Arguments ------------ * `:name` - The name of the relationship * `:destination` - The destination resource Options ---------- * `:primary_key?` - Whether this field is, or is part of, the primary key of a resource. The default value is `false`. * `:define_field?` - If set to `false` a field is not created on the resource for this relationship, and one must be manually added in `attributes`. The default value is `true`. * `:field_type` - The field type of the automatically created field. The default value is `:uuid`. * `:destination_field` - The field on the related resource that should match the `source_field` on this resource. The default value is `:id`. * `:source_field` - The field on this resource that should match the `destination_field` on the related resource. - Defaults to <name>\_id * `:writable?` - Whether or not the relationship may be edited. The default value is `true`. Ash.Dsl.Create β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Dsl.Create [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") ====================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [create(name, opts \\ [])](#create/2) Declares a `create` action. For calling this action, see the [`Ash.Api`](Ash.Api.html) documentation. [Link to this section](#functions) Functions ============================================= [Link to this macro](#create/2 "Link to this macro") create(name, opts \\ []) ======================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") (macro) Declares a `create` action. For calling this action, see the [`Ash.Api`](Ash.Api.html) documentation. Examples ----------- ``` create :register, primary?: true ``` Arguments ------------ * `:name` - The name of the action Options ---------- * `:primary?` - Whether or not this action should be used when no action is specified by the caller. The default value is `false`. Ash.Dsl.CreateTimestamp β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Dsl.CreateTimestamp [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") =============================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [create\_timestamp(name, opts \\ [])](#create_timestamp/2) Declares a non-writable attribute with a create default of `&DateTime.utc_now/0` [Link to this section](#functions) Functions ============================================= [Link to this macro](#create_timestamp/2 "Link to this macro") create\_timestamp(name, opts \\ []) =================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") (macro) Declares a non-writable attribute with a create default of `&DateTime.utc_now/0` Examples ----------- ``` create\_timestamp :inserted\_at ``` Arguments ------------ * `:name` - The name of the attribute. Options ---------- * `:type` - The type of the attribute. The default value is `:utc_datetime`. * `:constraints` - Constraints to provide to the type when casting the value. See the type's documentation for more information. * `:primary_key?` - Whether or not the attribute is part of the primary key (one or more fields that uniquely identify a resource) The default value is `false`. * `:allow_nil?` - Whether or not the attribute can be set to nil The default value is `true`. * `:generated?` - Whether or not the value may be generated by the data layer. If it is, the data layer will know to read the value back after writing. The default value is `false`. * `:writable?` - Whether or not the value can be written to The default value is `false`. * `:update_default` - A zero argument function, an {mod, fun, args} triple or `{:constant, value}`. If no value is provided for the attribute on update, this value is used. * `:default` - A zero argument function, an {mod, fun, args} triple or `{:constant, value}`. If no value is provided for the attribute on create, this value is used. The default value is `&DateTime.utc_now/0`. Ash.Dsl.Destroy β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Dsl.Destroy [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") ======================================================================================================================================= [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [destroy(name, opts \\ [])](#destroy/2) Declares a `destroy` action. For calling this action, see the [`Ash.Api`](Ash.Api.html) documentation. [Link to this section](#functions) Functions ============================================= [Link to this macro](#destroy/2 "Link to this macro") destroy(name, opts \\ []) ========================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") (macro) Declares a `destroy` action. For calling this action, see the [`Ash.Api`](Ash.Api.html) documentation. Examples ----------- ``` destroy :soft\_delete, primary?: true ``` Arguments ------------ * `:name` - The name of the action Options ---------- * `:primary?` - Whether or not this action should be used when no action is specified by the caller. The default value is `false`. Ash.Dsl.Entity β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Dsl.Entity [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/entity.ex#L1 "View Source") ================================================================================================================================= Declares a DSL entity. A dsl entity represents a dsl constructor who's resulting value is a struct. This lets the user create complex objects with arbitrary(mostly) validation rules. The lifecycle of creating entities is complex, happening as Elixir is compiling the modules in question. Some of the patterns around validating/transforming entities have not yet solidified. If you aren't careful and don't follow the guidelines listed here, you can have subtle and strange bugs during compilation. Anything not isolated to simple value validations should be done in `transformers`. See [`Ash.Dsl.Transformer`](Ash.Dsl.Transformer.html). An entity has a `target` indicating which struct will ultimately be built. An entity also has a `schema`. This schema is used for documentation, and the options are validated against it before continuing on with the DSL. To create positional arguments to the builder, use `args`. The values provided to `args` need to be in the provided schema as well. They will be positional arguments in the same order that they are provided in the `args` key. `auto_set_fields` will set the provided values into the produced struct (they do not need to be included in the schema). `transform` is a function that takes a created struct and can alter it. This happens immediately after handling the DSL options, and can be useful for setting field values on a struct based on other values in that struct. If you need things that aren't contained in that struct, use an [`Ash.Dsl.Transformer`](Ash.Dsl.Transformer.html). `entities` allows you to specify a keyword list of nested entities. Nested entities are stored on the struct in the corresponding key, and are used in the same way entities are otherwise. For a full example, see [`Ash.Dsl.Extension`](Ash.Dsl.Extension.html). [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [build(map, opts, nested\_entities)](#build/3) [describe(entity, depth \\ 2)](#describe/2) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/entity.ex#L47 "View Source") Specs ----- ``` t() :: %Ash.Dsl.Entity{ args: [[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()], auto_set_fields: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)(), describe: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), entities: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)(), examples: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()], name: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), schema: [NimbleOptions.schema](https://hexdocs.pm/nimble_options/NimbleOptions.html#t:schema/0)(), target: [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), transform: [mfa](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#build/3 "Link to this function") build(map, opts, nested\_entities) ================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/entity.ex#L59 "View Source") [Link to this function](#describe/2 "Link to this function") describe(entity, depth \\ 2) ============================ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/entity.ex#L80 "View Source") Ash.Dsl.Extension β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Dsl.Extension behaviour [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L1 "View Source") ================================================================================================================================================= An extension to the Ash DSL. This allows configuring custom DSL components, whos configurations can then be read back. The example at the bottom shows how you might build a (not very contextually relevant) DSL extension that would be used like so: ``` defmodule MyApp.MyResource do use Ash.Resource, extensions: [MyApp.CarExtension] cars do car :mazda, "6", trim: :touring car :toyota, "corolla" end end ``` For (a not very contextually relevant) example: ``` defmodule MyApp.CarExtension do @car\_schema [ make: [ type: :atom, required: true, doc: "The make of the car" ], model: [ type: :atom, required: true, doc: "The model of the car" ], type: [ type: :atom, required: true, doc: "The type of the car", default: :sedan ] ] @car %Ash.Dsl.Entity{ name: :car, describe: "Adds a car", examples: [ "car :mazda, "6"" ], target: MyApp.Car, args: [:make, :model], schema: @car\_schema } @cars %Ash.Dsl.Section{ name: :cars, # The DSL constructor will be `cars` describe: """ Configure what cars are available. More, deeper explanation. Always have a short one liner explanation, an empty line, and then a longer explanation. """, entities: [ @car # See `Ash.Dsl.Entity` docs ], schema: [ default\_manufacturer: [ type: :atom, doc: "The default manufacturer" ] ] } use Ash.Dsl.Extension, sections: [@cars] end ``` Often, we will need to do complex validation/validate based on the configuration of other resources. Due to the nature of building compile time DSLs, there are many restrictions around that process. To support these complex use cases, extensions can include `transformers` which can validate/transform the DSL state after all basic sections/entities have been created. See [`Ash.Dsl.Transformer`](Ash.Dsl.Transformer.html) for more information. Transformers are provided as an option to `use`, like so: ``` use Ash.Dsl.Extension, sections: [@cars], transformers: [ MyApp.Transformers.ValidateNoOverlappingMakesAndModels ] ``` To expose the configuration of your DSL, define functions that use the helpers like [`get_entities/2`](#get_entities/2) and `get_opt/3`. For example: ``` defmodule MyApp.Cars do def cars(resource) do Ash.Dsl.Extension.get\_entities(resource, [:cars]) end end MyApp.Cars.cars(MyResource) # [%MyApp.Car{...}, %MyApp.Car{...}] ``` [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [get\_entities(resource, path)](#get_entities/2) Get the entities configured for a given section [get\_opt(resource, path, value, default, configurable? \\ false)](#get_opt/5) Get an option value for a section at a given path. [get\_opt\_config(resource, path, value)](#get_opt_config/3) [import\_mods(mods)](#import_mods/1) [load()](#load/0) [run\_transformers(mod, transformers, ash\_dsl\_config)](#run_transformers/3) [unimport\_mods(mods)](#unimport_mods/1) [Callbacks](#callbacks) ------------------------ [sections()](#c:sections/0) [transformers()](#c:transformers/0) [Link to this section](#functions) Functions ============================================= [Link to this function](#get_entities/2 "Link to this function") get\_entities(resource, path) ============================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L105 "View Source") Get the entities configured for a given section [Link to this function](#get_opt/5 "Link to this function") get\_opt(resource, path, value, default, configurable? \\ false) ================================================================ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L114 "View Source") Get an option value for a section at a given path. Checks to see if it has been overridden via configuration. [Link to this function](#get_opt_config/3 "Link to this function") get\_opt\_config(resource, path, value) ======================================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L136 "View Source") [Link to this macro](#import_mods/1 "Link to this macro") import\_mods(mods) ================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L738 "View Source") (macro) [Link to this macro](#load/0 "Link to this macro") load() ====== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L246 "View Source") (macro) [Link to this function](#run_transformers/3 "Link to this function") run\_transformers(mod, transformers, ash\_dsl\_config) ====================================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L255 "View Source") [Link to this macro](#unimport_mods/1 "Link to this macro") unimport\_mods(mods) ==================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L746 "View Source") (macro) [Link to this section](#callbacks) Callbacks ============================================= [Link to this callback](#c:sections/0 "Link to this callback") sections() ========== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L101 "View Source") Specs ----- ``` sections() :: [[Ash.Dsl.Section.t](Ash.Dsl.Section.html#t:t/0)()] ``` [Link to this callback](#c:transformers/0 "Link to this callback") transformers() ============== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L102 "View Source") Specs ----- ``` transformers() :: [[module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()] ``` Ash.Dsl.HasMany β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Dsl.HasMany [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") ======================================================================================================================================= [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [has\_many(name, destination, opts \\ [])](#has_many/3) Declares a has\_many relationship. There can be any number of related entities. [Link to this section](#functions) Functions ============================================= [Link to this macro](#has_many/3 "Link to this macro") has\_many(name, destination, opts \\ []) ======================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") (macro) Declares a has\_many relationship. There can be any number of related entities. Examples ----------- ``` # In a resource called `Word` has\_many :definitions, DictionaryDefinition, source\_field: :text, destination\_field: :word\_text ``` Arguments ------------ * `:name` - The name of the relationship * `:destination` - The destination resource Options ---------- * `:destination_field` - Required. The field on the related resource that should match the `source_field` on this resource. * `:source_field` - The field on this resource that should match the `destination_field` on the related resource. The default value is `:id`. * `:writable?` - Whether or not the relationship may be edited. The default value is `true`. Ash.Dsl.HasOne β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Dsl.HasOne [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") ====================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [has\_one(name, destination, opts \\ [])](#has_one/3) Declares a has\_one relationship. In a relationsal database, the foreign key would be on the *other* table. [Link to this section](#functions) Functions ============================================= [Link to this macro](#has_one/3 "Link to this macro") has\_one(name, destination, opts \\ []) ======================================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") (macro) Declares a has\_one relationship. In a relationsal database, the foreign key would be on the *other* table. Generally speaking, a `has_one` also implies that the destination table is unique on that foreign key. Examples ----------- ``` # In a resource called `Word` has\_one :dictionary\_entry, DictionaryEntry, source\_field: :text, destination\_field: :word\_text ``` Arguments ------------ * `:name` - The name of the relationship * `:destination` - The destination resource Options ---------- * `:destination_field` - Required. The field on the related resource that should match the `source_field` on this resource. * `:source_field` - The field on this resource that should match the `destination_field` on the related resource. The default value is `:id`. * `:writable?` - Whether or not the relationship may be edited. The default value is `true`. Ash.Dsl.ManyToMany β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Dsl.ManyToMany [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") ========================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [many\_to\_many(name, destination, opts \\ [])](#many_to_many/3) Declares a many\_to\_many relationship. Many to many relationships require a join table. [Link to this section](#functions) Functions ============================================= [Link to this macro](#many_to_many/3 "Link to this macro") many\_to\_many(name, destination, opts \\ []) ============================================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") (macro) Declares a many\_to\_many relationship. Many to many relationships require a join table. A join table is typically a table who's primary key consists of one foreign key to each resource. Examples ----------- ``` # In a resource called `Word` many\_to\_many :books, Book, through: BookWord, source\_field: :text, source\_field\_on\_join\_table: :word\_text, destination\_field: :id, destination\_field\_on\_join\_table: :book\_id ``` Arguments ------------ * `:name` - The name of the relationship * `:destination` - The destination resource Options ---------- * `:source_field_on_join_table` - Required. The field on the join table that should line up with `source_field` on this resource. * `:destination_field_on_join_table` - Required. The field on the join table that should line up with `destination_field` on the related resource. Default: [relationshihp\_name]\_id * `:through` - Required. The resource to use as the join resource. * `:join_relationship` - The has\_many relationship to the join table. Defaults to <relationship\_name>\_join\_assoc * `:join_attributes` - Attributes to expose as editable when modifying the relationship. Extensions may use this when deciding what fields to render from the join table. See [`Ash.Changeset.append_to_relationship/3`](Ash.Changeset.html#append_to_relationship/3) and [`Ash.Changeset.replace_relationship/3`](Ash.Changeset.html#replace_relationship/3) for how to edit these fields. The default value is `[]`. * `:destination_field` - The field on the related resource that should match the `source_field` on this resource. The default value is `:id`. * `:source_field` - The field on this resource that should match the `destination_field` on the related resource. The default value is `:id`. * `:writable?` - Whether or not the relationship may be edited. The default value is `true`. Ash.Dsl.Read β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Dsl.Read [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") ==================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [read(name, opts \\ [])](#read/2) Declares a `read` action. For calling this action, see the [`Ash.Api`](Ash.Api.html) documentation. [Link to this section](#functions) Functions ============================================= [Link to this macro](#read/2 "Link to this macro") read(name, opts \\ []) ====================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") (macro) Declares a `read` action. For calling this action, see the [`Ash.Api`](Ash.Api.html) documentation. Examples ----------- ``` read :read\_all, primary?: true ``` Arguments ------------ * `:name` - The name of the action Options ---------- * `:primary?` - Whether or not this action should be used when no action is specified by the caller. The default value is `false`. Ash.Dsl.Section β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Dsl.Section [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/section.ex#L1 "View Source") =================================================================================================================================== Declares a DSL section. A dsl section allows you to organize related configurations. All extensions configure sections, they cannot add DSL builders to the top level. This keeps things organized, and concerns separated. A section may have nested sections, which will be configured the same as other sections. Getting the options/entities of a section is done by providing a path, so you would use the nested path to retrieve that configuration. See [`Ash.Dsl.Extension.get_entities/2`](Ash.Dsl.Extension.html#get_entities/2) and [`Ash.Dsl.Extension.get_opt/4`](Ash.Dsl.Extension.html#get_opt/4). A section may have entities, which are constructors that produce instances of structs. For more on entities, see [`Ash.Dsl.Entity`](Ash.Dsl.Entity.html). A section may also have a `schema`, which is a [`NimbleOptions`](https://hexdocs.pm/nimble_options/NimbleOptions.html) schema. Ash will produce builders for those options, so that they may be configured. They are retrived with [`Ash.Dsl.Extension.get_opt/4`](Ash.Dsl.Extension.html#get_opt/4). For a full example, see [`Ash.Dsl.Extension`](Ash.Dsl.Extension.html). [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [describe(mod, section, depth \\ 2)](#describe/3) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/section.ex#L33 "View Source") Specs ----- ``` t() :: %Ash.Dsl.Section{ configurable: [[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()], describe: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), entities: [[Ash.Dsl.Entity.t](Ash.Dsl.Entity.html#t:t/0)()], imports: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), name: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), schema: [NimbleOptions.schema](https://hexdocs.pm/nimble_options/NimbleOptions.html#t:schema/0)(), sections: [ %Ash.Dsl.Section{ configurable: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), describe: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), entities: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), imports: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), name: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), schema: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), sections: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() } ] } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#describe/3 "Link to this function") describe(mod, section, depth \\ 2) ================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/section.ex#L42 "View Source") Ash.Dsl.Transformer β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Dsl.Transformer behaviour [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L1 "View Source") ===================================================================================================================================================== A transformer manipulates and/or validates the entire DSL state of a resource. It's `transform/2` takes a `map`, which is just the values/configurations at each point of the DSL. Don't manipulate it directly, if possible, instead use functions like `get_entities/3` and `replace_entity/5` to manipulate it. Use the `after?/1` and `before?/1` callbacks to ensure that your transformer runs either before or after some other transformer. The pattern for requesting information from other modules that use the DSL and are also currently compiling has not yet been determined. If you have that requirement you will need extra utilities to ensure that some other DSL based module has either completed or reached a certain point in its transformers. These utilities have not yet been written. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [add\_entity(dsl\_state, path, entity)](#add_entity/3) [build\_before\_after\_list(transformer, transformers, already\_touched \\ [])](#build_before_after_list/3) [build\_entity(extension, path, name, opts)](#build_entity/4) [compare(arg1, arg2)](#compare/2) [get\_entities(dsl\_state, path)](#get_entities/2) [get\_option(dsl\_state, path, option)](#get_option/3) [persist(dsl, key, value)](#persist/3) [replace\_entity(dsl\_state, path, replacement, matcher)](#replace_entity/4) [sort(transformers)](#sort/1) [wait\_for\_transformer(resource, transformers, timeout \\ :timer.seconds(15), wait \\ 50)](#wait_for_transformer/4) [Callbacks](#callbacks) ------------------------ [after?(module)](#c:after?/1) [before?(module)](#c:before?/1) [compile\_time\_only?()](#c:compile_time_only?/0) [transform(module, map)](#c:transform/2) [Link to this section](#functions) Functions ============================================= [Link to this function](#add_entity/3 "Link to this function") add\_entity(dsl\_state, path, entity) ===================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L79 "View Source") [Link to this function](#build_before_after_list/3 "Link to this function") build\_before\_after\_list(transformer, transformers, already\_touched \\ []) ============================================================================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L126 "View Source") [Link to this function](#build_entity/4 "Link to this function") build\_entity(extension, path, name, opts) ========================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L59 "View Source") [Link to this function](#compare/2 "Link to this function") compare(arg1, arg2) =================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L148 "View Source") [Link to this function](#get_entities/2 "Link to this function") get\_entities(dsl\_state, path) =============================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L87 "View Source") [Link to this function](#get_option/3 "Link to this function") get\_option(dsl\_state, path, option) ===================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L93 "View Source") [Link to this function](#persist/3 "Link to this function") persist(dsl, key, value) ======================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L55 "View Source") [Link to this function](#replace_entity/4 "Link to this function") replace\_entity(dsl\_state, path, replacement, matcher) ======================================================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L101 "View Source") [Link to this function](#sort/1 "Link to this function") sort(transformers) ================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L119 "View Source") [Link to this function](#wait_for_transformer/4 "Link to this function") wait\_for\_transformer(resource, transformers, timeout \\ :timer.seconds(15), wait \\ 50) ========================================================================================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L35 "View Source") [Link to this section](#callbacks) Callbacks ============================================= [Link to this callback](#c:after?/1 "Link to this callback") after?(module) ============== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L20 "View Source") Specs ----- ``` after?([module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this callback](#c:before?/1 "Link to this callback") before?(module) =============== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L19 "View Source") Specs ----- ``` before?([module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this callback](#c:compile_time_only?/0 "Link to this callback") compile\_time\_only?() ====================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L21 "View Source") Specs ----- ``` compile_time_only?() :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this callback](#c:transform/2 "Link to this callback") transform(module, map) ====================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/transformer.ex#L18 "View Source") Specs ----- ``` transform([module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: {:ok, [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | :halt ``` Ash.Dsl.Update β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Dsl.Update [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") ====================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [update(name, opts \\ [])](#update/2) Declares a `update` action. For calling this action, see the [`Ash.Api`](Ash.Api.html) documentation. [Link to this section](#functions) Functions ============================================= [Link to this macro](#update/2 "Link to this macro") update(name, opts \\ []) ======================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") (macro) Declares a `update` action. For calling this action, see the [`Ash.Api`](Ash.Api.html) documentation. Examples ----------- ``` update :flag\_for\_review, primary?: true ``` Arguments ------------ * `:name` - The name of the action Options ---------- * `:primary?` - Whether or not this action should be used when no action is specified by the caller. The default value is `false`. Ash.Dsl.UpdateTimestamp β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Dsl.UpdateTimestamp [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") =============================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [update\_timestamp(name, opts \\ [])](#update_timestamp/2) Declares a non-writable attribute with a create and update default of `&DateTime.utc_now/0` [Link to this section](#functions) Functions ============================================= [Link to this macro](#update_timestamp/2 "Link to this macro") update\_timestamp(name, opts \\ []) =================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") (macro) Declares a non-writable attribute with a create and update default of `&DateTime.utc_now/0` Examples ----------- ``` update\_timestamp :inserted\_at ``` Arguments ------------ * `:name` - The name of the attribute. Options ---------- * `:type` - The type of the attribute. The default value is `:utc_datetime`. * `:constraints` - Constraints to provide to the type when casting the value. See the type's documentation for more information. * `:primary_key?` - Whether or not the attribute is part of the primary key (one or more fields that uniquely identify a resource) The default value is `false`. * `:allow_nil?` - Whether or not the attribute can be set to nil The default value is `true`. * `:generated?` - Whether or not the value may be generated by the data layer. If it is, the data layer will know to read the value back after writing. The default value is `false`. * `:writable?` - Whether or not the value can be written to The default value is `false`. * `:update_default` - A zero argument function, an {mod, fun, args} triple or `{:constant, value}`. If no value is provided for the attribute on update, this value is used. The default value is `&DateTime.utc_now/0`. * `:default` - A zero argument function, an {mod, fun, args} triple or `{:constant, value}`. If no value is provided for the attribute on create, this value is used. The default value is `&DateTime.utc_now/0`. Ash.Dsl.Validate β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Dsl.Validate [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") ======================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [validate(validation, opts \\ [])](#validate/2) Declares a validation for creates and updates. [Link to this section](#functions) Functions ============================================= [Link to this macro](#validate/2 "Link to this macro") validate(validation, opts \\ []) ================================ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/dsl/extension.ex#L732 "View Source") (macro) Declares a validation for creates and updates. Examples ----------- ``` validate {Mod, [foo: :bar]} ``` ``` validate at\_least\_one\_of\_present([:first\_name, :last\_name]) ``` Arguments ------------ * `:validation` - The module/opts pair of the validation Options ---------- * `:on` - The action types the validation should run on. Many validations don't make sense in the context of deletion, so by default it is left out of the list. The default value is `[:create, :update]`. * `:expensive?` - If a validation is expensive, it won't be run on invalid changes. All inexpensive validations are always run, to provide informative validations. The default value is `false`. Ash.Error.Changes.InvalidAttribute β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Changes.InvalidAttribute exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/changes/invalid_attribute.ex#L1 "View Source") ==================================================================================================================================================================================== Used when an invalid value is provided for an attribute change Ash.Error.Changes.InvalidChanges β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Changes.InvalidChanges exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/changes/invalid_changes.ex#L1 "View Source") ================================================================================================================================================================================ Used when a change is provided that covers multiple attributes/relationships Ash.Error.Changes.InvalidRelationship β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Changes.InvalidRelationship exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/changes/invalid_relationship.ex#L1 "View Source") ========================================================================================================================================================================================== Used when an invalid value is provided for a relationship change Ash.Error.Changes.NoSuchAttribute β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Changes.NoSuchAttribute exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/changes/no_such_attribute.ex#L1 "View Source") =================================================================================================================================================================================== Used when a change is provided for an attribute that does not exist Ash.Error.Changes.NoSuchRelationship β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Changes.NoSuchRelationship exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/changes/no_such_relationship.ex#L1 "View Source") ========================================================================================================================================================================================= Used when a change is provided for an relationship that does not exist Ash.Error.Changes.UnknownError β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Changes.UnknownError exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/changes/unknown_error.ex#L1 "View Source") ============================================================================================================================================================================ Used when a change fails for an unknown reason Ash.Error.Dsl.DslError β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Dsl.DslError exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/dsl/dsl_error.ex#L1 "View Source") ============================================================================================================================================================ Used when a DSL is incorrectly configured. Ash.Error.Filter.InvalidFilterValue β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Filter.InvalidFilterValue exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/filter/invalid_filter_value.ex#L1 "View Source") ======================================================================================================================================================================================= Used when an invalid value is provided for a filter Ash.Error.Filter.NoSuchAttributeOrRelationship β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Filter.NoSuchAttributeOrRelationship exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/filter/no_such_attribute_or_relationship.ex#L1 "View Source") =============================================================================================================================================================================================================== Used when a key in a filter contains something that is neither an attribute or a relationship Ash.Error.Filter.NoSuchFilterPredicate β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Filter.NoSuchFilterPredicate exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/filter/no_such_filter_predicate.ex#L1 "View Source") ============================================================================================================================================================================================== Used when a filter predicate that does not exist is referenced Ash.Error.Filter.ReadActionRequired β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Filter.ReadActionRequired exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/filter/read_action_required.ex#L1 "View Source") ======================================================================================================================================================================================= Used when a relationship is filtered and the destination does not have a default read action Ash.Error.Filter.UnsupportedPredicate β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Filter.UnsupportedPredicate exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/filter/unsupported_predicate.ex#L1 "View Source") ========================================================================================================================================================================================== Used when the datalayer does not support a provided predicate Ash.Error.Forbidden β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Forbidden exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/forbidden.ex#L1 "View Source") ===================================================================================================================================================== Used when authorization for an action fails Ash.Error.Forbidden.MustPassStrictCheck β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Forbidden.MustPassStrictCheck exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/forbidden/must_pass_strict_check.ex#L1 "View Source") ================================================================================================================================================================================================ Used when unreachable code/conditions are reached in the framework Ash.Error.Framework β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Framework exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/framework.ex#L1 "View Source") ===================================================================================================================================================== Used when an unknown/generic framework error occurs Ash.Error.Framework.AssumptionFailed β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Framework.AssumptionFailed exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/framework/assumption_failed.ex#L1 "View Source") ======================================================================================================================================================================================== Used when unreachable code/conditions are reached in the framework Ash.Error.Framework.SynchronousEngineStuck β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Framework.SynchronousEngineStuck exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/framework/synchronous_engine_stuck.ex#L1 "View Source") ===================================================================================================================================================================================================== Used when the sycnrhonous engine cannot proceed Ash.Error.Invalid β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Invalid exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/invalid.ex#L1 "View Source") ================================================================================================================================================= The top level invalid error Ash.Error.Invalid.DuplicatedPath β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Invalid.DuplicatedPath exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/invalid/duplicated_path.ex#L1 "View Source") ================================================================================================================================================================================ Used when multiple requests with the same path are passed to the internal engine Ash.Error.Invalid.ImpossiblePath β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Invalid.ImpossiblePath exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/invalid/impossible_path.ex#L1 "View Source") ================================================================================================================================================================================ Used when a request expresses a dependency on another request that doesn't exist Ash.Error.Invalid.InvalidPrimaryKey β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Invalid.InvalidPrimaryKey exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/invalid/invalid_primary_key.ex#L1 "View Source") ======================================================================================================================================================================================= Used when an invalid primary key is given to an Api's `get` Ash.Error.Invalid.NoSuchAction β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Invalid.NoSuchAction exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/invalid/no_such_action.ex#L1 "View Source") ============================================================================================================================================================================= Used when an action name is provided that doesn't exist Ash.Error.Invalid.NoSuchResource β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Invalid.NoSuchResource exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/invalid/no_such_resource.ex#L1 "View Source") ================================================================================================================================================================================= Used when a resource or alias is provided that doesn't exist Ash.Error.Query.InvalidLimit β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Query.InvalidLimit exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/query/invalid_limit.ex#L1 "View Source") ======================================================================================================================================================================== Used when an invalid limit is provided Ash.Error.Query.InvalidOffset β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Query.InvalidOffset exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/query/offset.ex#L1 "View Source") ================================================================================================================================================================== Used when an invalid offset is provided Ash.Error.Query.InvalidSortOrder β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Query.InvalidSortOrder exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/query/invalid_sort_order.ex#L1 "View Source") ================================================================================================================================================================================= Used when an invalid sort order is provided Ash.Error.Query.NoSuchAttribute β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Query.NoSuchAttribute exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/query/no_such_attribute.ex#L1 "View Source") =============================================================================================================================================================================== Used when an attribute that doesn't exist is used in a query Ash.Error.Query.UnsortableAttribute β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Query.UnsortableAttribute exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/query/unsortable_field.ex#L1 "View Source") ================================================================================================================================================================================== Used when attempting to sort on a field that cannot be used for sorting Ash.Error.SideLoad.InvalidQuery β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.SideLoad.InvalidQuery exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/side_load/invalid_query.ex#L1 "View Source") =============================================================================================================================================================================== Used when an invalid query is provided in a side load Ash.Error.SideLoad.NoSuchRelationship β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.SideLoad.NoSuchRelationship exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/side_load/no_such_relationship.ex#L1 "View Source") ============================================================================================================================================================================================ Used when attempting to side load a relationship that does not exist Ash.Error.Unknown β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Error.Unknown exception [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/error/unknown.ex#L1 "View Source") ================================================================================================================================================= The top level unknown error container Ash.Filter β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Filter [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L1 "View Source") ================================================================================================================================ The representation of a filter in Ash. Ash filters are stored as nested `Ash.Filter.Expression{}` and `%Ash.Filter.Not{}` structs, terminating in a `%Ash.Filter.Predicate{}` struct. An expression is simply a boolean operator and the left and right hand side of that operator. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [add\_to\_filter(base, op \\ :and, addition)](#add_to_filter/3) [add\_to\_filter!(base, op \\ :and, addition)](#add_to_filter!/3) [do\_map(expression, func)](#do_map/2) [do\_reduce(expression, acc, func)](#do_reduce/3) [filter\_expression\_by\_relationship\_path(filter, path, scope? \\ false)](#filter_expression_by_relationship_path/3) [map(filter, func)](#map/2) [parse(resource, statement)](#parse/2) [parse!(resource, statement)](#parse!/2) [read\_requests(api, filter)](#read_requests/2) [reduce(filter, acc \\ nil, func)](#reduce/3) [relationship\_filter\_request\_paths(filter)](#relationship_filter_request_paths/1) [relationship\_paths(filter\_or\_expression, kind \\ :all)](#relationship_paths/2) [run\_other\_data\_layer\_filters(api, resource, filter)](#run_other_data_layer_filters/3) [strict\_subset\_of(filter, candidate)](#strict_subset_of/2) Returns true if the second argument is a strict subset (always returns the same or less data) of the first [strict\_subset\_of?(filter, candidate)](#strict_subset_of?/2) [Link to this section](#functions) Functions ============================================= [Link to this function](#add_to_filter/3 "Link to this function") add\_to\_filter(base, op \\ :and, addition) =========================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L248 "View Source") [Link to this function](#add_to_filter!/3 "Link to this function") add\_to\_filter!(base, op \\ :and, addition) ============================================ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L238 "View Source") [Link to this function](#do_map/2 "Link to this function") do\_map(expression, func) ========================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L346 "View Source") [Link to this function](#do_reduce/3 "Link to this function") do\_reduce(expression, acc, func) ================================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L399 "View Source") [Link to this function](#filter_expression_by_relationship_path/3 "Link to this function") filter\_expression\_by\_relationship\_path(filter, path, scope? \\ false) ========================================================================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L489 "View Source") [Link to this function](#map/2 "Link to this function") map(filter, func) ================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L334 "View Source") [Link to this function](#parse/2 "Link to this function") parse(resource, statement) ========================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L43 "View Source") [Link to this function](#parse!/2 "Link to this function") parse!(resource, statement) =========================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L33 "View Source") [Link to this function](#read_requests/2 "Link to this function") read\_requests(api, filter) =========================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L299 "View Source") [Link to this function](#reduce/3 "Link to this function") reduce(filter, acc \\ nil, func) ================================ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L362 "View Source") [Link to this function](#relationship_filter_request_paths/1 "Link to this function") relationship\_filter\_request\_paths(filter) ============================================ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L293 "View Source") [Link to this function](#relationship_paths/2 "Link to this function") relationship\_paths(filter\_or\_expression, kind \\ :all) ========================================================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L222 "View Source") [Link to this function](#run_other_data_layer_filters/3 "Link to this function") run\_other\_data\_layer\_filters(api, resource, filter) ======================================================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L58 "View Source") [Link to this function](#strict_subset_of/2 "Link to this function") strict\_subset\_of(filter, candidate) ===================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L277 "View Source") Returns true if the second argument is a strict subset (always returns the same or less data) of the first [Link to this function](#strict_subset_of?/2 "Link to this function") strict\_subset\_of?(filter, candidate) ====================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/filter.ex#L289 "View Source") Ash.Filter.Expression β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Filter.Expression [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/expression.ex#L1 "View Source") =============================================================================================================================================== Represents a boolean expression [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [new(op, left, right)](#new/3) [Link to this section](#functions) Functions ============================================= [Link to this function](#new/3 "Link to this function") new(op, left, right) ==================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/expression.ex#L6 "View Source") Ash.Filter.Not β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Filter.Not [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/not.ex#L1 "View Source") ================================================================================================================================= Represents the negation of the contained expression [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [new(expression)](#new/1) [Link to this section](#functions) Functions ============================================= [Link to this function](#new/1 "Link to this function") new(expression) =============== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/not.ex#L7 "View Source") Ash.Filter.Predicate β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Filter.Predicate behaviour [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate.ex#L1 "View Source") ======================================================================================================================================================= Represents a filter predicate [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [comparison()](#t:comparison/0) [predicate()](#t:predicate/0) [t()](#t:t/0) [Functions](#functions) ------------------------ [add\_inspect\_path(inspect\_opts, field)](#add_inspect_path/2) [compare(pred, right)](#compare/2) [match?(predicate, value, type)](#match?/3) [new(resource, attribute, predicate, value, relationship\_path)](#new/5) [Callbacks](#callbacks) ------------------------ [compare(predicate, predicate)](#c:compare/2) [match?(predicate, term, arg3)](#c:match?/3) [new(arg1, arg2, term)](#c:new/3) [Link to this section](#types) Types ===================================== [Link to this type](#t:comparison/0 "Link to this type") comparison() ============ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate.ex#L12 "View Source") Specs ----- ``` comparison() :: :unknown | :right_excludes_left | :left_excludes_right | :right_includes_left | :left_includes_right | :mutually_inclusive | {:simplify, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | {:simplify, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` [Link to this type](#t:predicate/0 "Link to this type") predicate() =========== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate.ex#L10 "View Source") Specs ----- ``` predicate() :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate.ex#L23 "View Source") Specs ----- ``` t() :: %Ash.Filter.Predicate{ attribute: [Ash.attribute](Ash.html#t:attribute/0)(), predicate: [predicate](#t:predicate/0)(), relationship_path: [[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()], resource: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), value: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#add_inspect_path/2 "Link to this function") add\_inspect\_path(inspect\_opts, field) ======================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate.ex#L134 "View Source") [Link to this function](#compare/2 "Link to this function") compare(pred, right) ==================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate.ex#L52 "View Source") Specs ----- ``` compare([predicate](#t:predicate/0)(), [predicate](#t:predicate/0)()) :: [comparison](#t:comparison/0)() ``` [Link to this function](#match?/3 "Link to this function") match?(predicate, value, type) ============================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate.ex#L47 "View Source") [Link to this function](#new/5 "Link to this function") new(resource, attribute, predicate, value, relationship\_path) ============================================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate.ex#L105 "View Source") [Link to this section](#callbacks) Callbacks ============================================= [Link to this callback](#c:compare/2 "Link to this callback") compare(predicate, predicate) ============================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate.ex#L30 "View Source") Specs ----- ``` compare([predicate](#t:predicate/0)(), [predicate](#t:predicate/0)()) :: [comparison](#t:comparison/0)() ``` [Link to this callback](#c:match?/3 "Link to this callback") match?(predicate, term, arg3) ============================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate.ex#L31 "View Source") Specs ----- ``` match?([predicate](#t:predicate/0)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [Ash.Type.t](Ash.Type.html#t:t/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | :unknown ``` [Link to this callback](#c:new/3 "Link to this callback") new(arg1, arg2, term) ===================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate.ex#L29 "View Source") Specs ----- ``` new([Ash.resource](Ash.html#t:resource/0)(), [Ash.attribute](Ash.html#t:attribute/0)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: {:ok, [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` Ash.Filter.Predicate.Eq β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Filter.Predicate.Eq [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate/eq.ex#L1 "View Source") =================================================================================================================================================== A predicate for strict value equality [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [new(resource, attribute, value)](#new/3) Callback implementation for [`Ash.Filter.Predicate.new/3`](Ash.Filter.Predicate.html#c:new/3). [Link to this section](#functions) Functions ============================================= [Link to this function](#new/3 "Link to this function") new(resource, attribute, value) =============================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate/eq.ex#L10 "View Source") Callback implementation for [`Ash.Filter.Predicate.new/3`](Ash.Filter.Predicate.html#c:new/3). Ash.Filter.Predicate.GreaterThan β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Filter.Predicate.GreaterThan [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate/greater_than.ex#L1 "View Source") ====================================================================================================================================================================== A predicate for a value being greater than the provided value [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [new(resource, attribute, value)](#new/3) Callback implementation for [`Ash.Filter.Predicate.new/3`](Ash.Filter.Predicate.html#c:new/3). [Link to this section](#functions) Functions ============================================= [Link to this function](#new/3 "Link to this function") new(resource, attribute, value) =============================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate/greater_than.ex#L11 "View Source") Callback implementation for [`Ash.Filter.Predicate.new/3`](Ash.Filter.Predicate.html#c:new/3). Ash.Filter.Predicate.In β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Filter.Predicate.In [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate/in.ex#L1 "View Source") =================================================================================================================================================== A predicate for a value being in a list of provided values [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [new(resource, attribute, values)](#new/3) Callback implementation for [`Ash.Filter.Predicate.new/3`](Ash.Filter.Predicate.html#c:new/3). [Link to this section](#functions) Functions ============================================= [Link to this function](#new/3 "Link to this function") new(resource, attribute, values) ================================ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate/in.ex#L12 "View Source") Callback implementation for [`Ash.Filter.Predicate.new/3`](Ash.Filter.Predicate.html#c:new/3). Ash.Filter.Predicate.LessThan β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Filter.Predicate.LessThan [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate/less_than.ex#L1 "View Source") ================================================================================================================================================================ A predicate for a value being greater than the provided value [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [new(resource, attribute, value)](#new/3) Callback implementation for [`Ash.Filter.Predicate.new/3`](Ash.Filter.Predicate.html#c:new/3). [Link to this section](#functions) Functions ============================================= [Link to this function](#new/3 "Link to this function") new(resource, attribute, value) =============================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/predicate/less_than.ex#L11 "View Source") Callback implementation for [`Ash.Filter.Predicate.new/3`](Ash.Filter.Predicate.html#c:new/3). Ash.Filter.Runtime β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Filter.Runtime [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/runtime.ex#L1 "View Source") ========================================================================================================================================= Checks a record to see if it matches a filter statement. We can't always tell if a record matches a filter statement, and as such this function may return `:unknown` [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [matches?(api, record, filter, dirty\_fields \\ [])](#matches?/4) [Link to this section](#functions) Functions ============================================= [Link to this function](#matches?/4 "Link to this function") matches?(api, record, filter, dirty\_fields \\ []) ================================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/filter/runtime.ex#L10 "View Source") Ash.Query β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Query [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/query.ex#L1 "View Source") ======================================================================================================================= Utilties around constructing/manipulating ash queries. Ash queries are used for read actions and side loads, and ultimately map to queries to a resource's data layer. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [do\_validate\_side\_load(resource, query, path)](#do_validate_side_load/3) [filter(query, filter)](#filter/2) [limit(query, limit)](#limit/2) Limit the results returned from the query [new(resource, api \\ nil)](#new/2) Create a new query. [offset(query, offset)](#offset/2) Skip the first n records [set\_api(query, api)](#set_api/2) Set the query's api, and any side loaded query's api [side\_load(query, statement)](#side_load/2) Side loads related entities [sort(query, sorts)](#sort/2) [unset(query, keys)](#unset/2) [validate\_side\_load(resource, side\_loads, path \\ [])](#validate_side_load/3) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/query.ex#L21 "View Source") Specs ----- ``` t() :: %Ash.Query{ api: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), data_layer_query: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), errors: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), filter: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), limit: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), offset: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), resource: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), side_load: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), sort: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), valid?: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#do_validate_side_load/3 "Link to this function") do\_validate\_side\_load(resource, query, path) =============================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/query.ex#L137 "View Source") [Link to this function](#filter/2 "Link to this function") filter(query, filter) ===================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/query.ex#L186 "View Source") [Link to this function](#limit/2 "Link to this function") limit(query, limit) =================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/query.ex#L87 "View Source") Limit the results returned from the query [Link to this function](#new/2 "Link to this function") new(resource, api \\ nil) ========================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/query.ex#L71 "View Source") Create a new query. [Link to this function](#offset/2 "Link to this function") offset(query, offset) ===================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/query.ex#L101 "View Source") Skip the first n records [Link to this function](#set_api/2 "Link to this function") set\_api(query, api) ==================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/query.ex#L81 "View Source") Set the query's api, and any side loaded query's api [Link to this function](#side_load/2 "Link to this function") side\_load(query, statement) ============================ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/query.ex#L117 "View Source") Side loads related entities [Link to this function](#sort/2 "Link to this function") sort(query, sorts) ================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/query.ex#L230 "View Source") [Link to this function](#unset/2 "Link to this function") unset(query, keys) ================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/query.ex#L245 "View Source") [Link to this function](#validate_side_load/3 "Link to this function") validate\_side\_load(resource, side\_loads, path \\ []) ======================================================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/query.ex#L130 "View Source") Ash.Resource β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Resource [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L1 "View Source") ============================================================================================================================= A resource is a static definition of an entity in your system. Resource DSL documentation: [`Ash.Dsl`](Ash.Dsl.html) [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [action(resource, name, type)](#action/3) Returns the action with the matching name and type on the resource [actions(resource)](#actions/1) Returns all actions of a resource [attribute(resource, name)](#attribute/2) Get an attribute name from the resource [attributes(resource)](#attributes/1) Returns all attributes of a resource [authorizers(resource)](#authorizers/1) A list of authorizers to be used when accessing [data\_layer(resource)](#data_layer/1) The data layer of the resource, or nil if it does not have one [data\_layer\_can?(resource, feature)](#data_layer_can?/2) Whether ornot the data layer supports a specific feature [data\_layer\_filters(resource)](#data_layer_filters/1) Custom filters suppoted by the data layer of the resource [in\_transaction?(resource)](#in_transaction?/1) Whether or not the data layer for the resource is currently in a transaction [primary\_action(resource, type)](#primary_action/2) Returns the primary action of a given type [primary\_action!(resource, type)](#primary_action!/2) Returns the primary action of the given type [primary\_key(resource)](#primary_key/1) A list of field names corresponding to the primary key [related(resource, relationship)](#related/2) [relationship(resource, relationship\_name)](#relationship/2) Get a relationship by name or path [relationships(resource)](#relationships/1) [resource?(module)](#resource?/1) Whether or not a given module is a resource module [rollback(resource, term)](#rollback/2) Rolls back the current transaction [transaction(resource, func)](#transaction/2) Wraps the execution of the function in a transaction with the resource's datalayer [validations(resource)](#validations/1) A list of all validations for the resource [validations(resource, type)](#validations/2) [Link to this section](#functions) Functions ============================================= [Link to this function](#action/3 "Link to this function") action(resource, name, type) ============================ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L169 "View Source") Specs ----- ``` action([Ash.resource](Ash.html#t:resource/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [Ash.action\_type](Ash.html#t:action_type/0)()) :: [Ash.action](Ash.html#t:action/0)() | nil ``` Returns the action with the matching name and type on the resource [Link to this function](#actions/1 "Link to this function") actions(resource) ================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L163 "View Source") Specs ----- ``` actions([Ash.resource](Ash.html#t:resource/0)()) :: [[Ash.action](Ash.html#t:action/0)()] ``` Returns all actions of a resource [Link to this function](#attribute/2 "Link to this function") attribute(resource, name) ========================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L183 "View Source") Specs ----- ``` attribute([Ash.resource](Ash.html#t:resource/0)(), [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [Ash.attribute](Ash.html#t:attribute/0)() | nil ``` Get an attribute name from the resource [Link to this function](#attributes/1 "Link to this function") attributes(resource) ==================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L177 "View Source") Specs ----- ``` attributes([Ash.resource](Ash.html#t:resource/0)()) :: [[Ash.attribute](Ash.html#t:attribute/0)()] ``` Returns all attributes of a resource [Link to this function](#authorizers/1 "Link to this function") authorizers(resource) ===================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L74 "View Source") Specs ----- ``` authorizers([Ash.resource](Ash.html#t:resource/0)()) :: [[module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()] ``` A list of authorizers to be used when accessing [Link to this function](#data_layer/1 "Link to this function") data\_layer(resource) ===================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L212 "View Source") Specs ----- ``` data_layer([Ash.resource](Ash.html#t:resource/0)()) :: [Ash.data\_layer](Ash.html#t:data_layer/0)() ``` The data layer of the resource, or nil if it does not have one [Link to this function](#data_layer_can?/2 "Link to this function") data\_layer\_can?(resource, feature) ==================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L218 "View Source") Specs ----- ``` data_layer_can?([Ash.resource](Ash.html#t:resource/0)(), [Ash.DataLayer.feature](Ash.DataLayer.html#t:feature/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Whether ornot the data layer supports a specific feature [Link to this function](#data_layer_filters/1 "Link to this function") data\_layer\_filters(resource) ============================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L226 "View Source") Specs ----- ``` data_layer_filters([Ash.resource](Ash.html#t:resource/0)()) :: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Custom filters suppoted by the data layer of the resource [Link to this function](#in_transaction?/1 "Link to this function") in\_transaction?(resource) ========================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L232 "View Source") Specs ----- ``` in_transaction?([Ash.resource](Ash.html#t:resource/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Whether or not the data layer for the resource is currently in a transaction [Link to this function](#primary_action/2 "Link to this function") primary\_action(resource, type) =============================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L151 "View Source") Specs ----- ``` primary_action([Ash.resource](Ash.html#t:resource/0)(), [Ash.action\_type](Ash.html#t:action_type/0)()) :: [Ash.action](Ash.html#t:action/0)() | nil ``` Returns the primary action of a given type [Link to this function](#primary_action!/2 "Link to this function") primary\_action!(resource, type) ================================ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L142 "View Source") Specs ----- ``` primary_action!([Ash.resource](Ash.html#t:resource/0)(), [Ash.action\_type](Ash.html#t:action_type/0)()) :: [Ash.action](Ash.html#t:action/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Returns the primary action of the given type [Link to this function](#primary_key/1 "Link to this function") primary\_key(resource) ====================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L103 "View Source") Specs ----- ``` primary_key([Ash.resource](Ash.html#t:resource/0)()) :: [[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()] ``` A list of field names corresponding to the primary key [Link to this function](#related/2 "Link to this function") related(resource, relationship) =============================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L197 "View Source") Specs ----- ``` related([Ash.resource](Ash.html#t:resource/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | [[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()]) :: [Ash.resource](Ash.html#t:resource/0)() | nil ``` [Link to this function](#relationship/2 "Link to this function") relationship(resource, relationship\_name) ========================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L114 "View Source") Specs ----- ``` relationship([Ash.resource](Ash.html#t:resource/0)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()]) :: [Ash.relationship](Ash.html#t:relationship/0)() | nil ``` Get a relationship by name or path [Link to this function](#relationships/1 "Link to this function") relationships(resource) ======================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L108 "View Source") Specs ----- ``` relationships([Ash.resource](Ash.html#t:resource/0)()) :: [[Ash.relationship](Ash.html#t:relationship/0)()] ``` [Link to this function](#resource?/1 "Link to this function") resource?(module) ================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L95 "View Source") Specs ----- ``` resource?([module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Whether or not a given module is a resource module [Link to this function](#rollback/2 "Link to this function") rollback(resource, term) ======================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L248 "View Source") Specs ----- ``` rollback([Ash.resource](Ash.html#t:resource/0)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Rolls back the current transaction [Link to this function](#transaction/2 "Link to this function") transaction(resource, func) =========================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L238 "View Source") Specs ----- ``` transaction([Ash.resource](Ash.html#t:resource/0)(), (() -> [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)())) :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Wraps the execution of the function in a transaction with the resource's datalayer [Link to this function](#validations/1 "Link to this function") validations(resource) ===================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L89 "View Source") Specs ----- ``` validations([Ash.resource](Ash.html#t:resource/0)()) :: [[Ash.validation](Ash.html#t:validation/0)()] ``` A list of all validations for the resource [Link to this function](#validations/2 "Link to this function") validations(resource, type) =========================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource.ex#L81 "View Source") Specs ----- ``` validations([Ash.resource](Ash.html#t:resource/0)(), :create | :update | :destroy) :: [[Ash.validation](Ash.html#t:validation/0)()] ``` Ash.Resource.Actions.Create β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Resource.Actions.Create [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/actions/create.ex#L1 "View Source") =========================================================================================================================================================== Represents a create action on a resource. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/actions/create.ex#L5 "View Source") Specs ----- ``` t() :: %Ash.Resource.Actions.Create{ name: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), primary?: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), type: :create } ``` Ash.Resource.Actions.Destroy β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Resource.Actions.Destroy [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/actions/destroy.ex#L1 "View Source") ============================================================================================================================================================= Represents a destroy action on a resource. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/actions/destroy.ex#L6 "View Source") Specs ----- ``` t() :: %Ash.Resource.Actions.Destroy{ name: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), primary?: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), type: :destroy } ``` Ash.Resource.Actions.Read β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Resource.Actions.Read [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/actions/read.ex#L1 "View Source") ======================================================================================================================================================= Represents a read action on a resource. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/actions/read.ex#L6 "View Source") Specs ----- ``` t() :: %Ash.Resource.Actions.Read{ name: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), primary?: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), type: :read } ``` Ash.Resource.Actions.Update β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Resource.Actions.Update [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/actions/update.ex#L1 "View Source") =========================================================================================================================================================== Represents a update action on a resource. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/actions/update.ex#L6 "View Source") Specs ----- ``` t() :: %Ash.Resource.Actions.Update{ name: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), primary?: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), type: :update } ``` Ash.Resource.Relationships.BelongsTo β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Resource.Relationships.BelongsTo [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/relationships/belongs_to.ex#L1 "View Source") ============================================================================================================================================================================== Represents a belongs\_to relationship on a resource [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/relationships/belongs_to.ex#L18 "View Source") Specs ----- ``` t() :: %Ash.Resource.Relationships.BelongsTo{ cardinality: :one, define_field?: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), destination: [Ash.resource](Ash.html#t:resource/0)(), destination_field: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), field_type: [Ash.Type.t](Ash.Type.html#t:t/0)(), name: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), primary_key?: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), source: [Ash.resource](Ash.html#t:resource/0)(), source_field: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil, type: :belongs_to, writable?: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() } ``` Ash.Resource.Relationships.HasMany β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Resource.Relationships.HasMany [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/relationships/has_many.ex#L1 "View Source") ========================================================================================================================================================================== Represents a has\_many relationship on a resource [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/relationships/has_many.ex#L14 "View Source") Specs ----- ``` t() :: %Ash.Resource.Relationships.HasMany{ cardinality: :many, destination: [Ash.resource](Ash.html#t:resource/0)(), destination_field: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), name: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), source: [Ash.resource](Ash.html#t:resource/0)(), source_field: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), type: :has_many, writable?: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() } ``` Ash.Resource.Relationships.HasOne β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Resource.Relationships.HasOne [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/relationships/has_one.ex#L1 "View Source") ======================================================================================================================================================================== Represents a has\_one relationship on a resource [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/relationships/has_one.ex#L16 "View Source") Specs ----- ``` t() :: %Ash.Resource.Relationships.HasOne{ allow_orphans?: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), cardinality: :one, destination: [Ash.resource](Ash.html#t:resource/0)(), destination_field: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), name: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), source: [Ash.resource](Ash.html#t:resource/0)(), source_field: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), type: :has_one, writable?: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() } ``` Ash.Resource.Relationships.ManyToMany β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Resource.Relationships.ManyToMany [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/relationships/many_to_many.ex#L1 "View Source") ================================================================================================================================================================================= Represents a many\_to\_many relationship on a resource [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [transform(relationship)](#transform/1) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/relationships/many_to_many.ex#L19 "View Source") Specs ----- ``` t() :: %Ash.Resource.Relationships.ManyToMany{ cardinality: :many, destination: [Ash.resource](Ash.html#t:resource/0)(), destination_field: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), destination_field_on_join_table: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), join_attributes: [[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()], join_relationship: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), name: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), source: [Ash.resource](Ash.html#t:resource/0)(), source_field: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), source_field_on_join_table: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), through: [Ash.resource](Ash.html#t:resource/0)(), type: :many_to_many, writable?: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#transform/1 "Link to this function") transform(relationship) ======================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/relationships/many_to_many.ex#L87 "View Source") Ash.Resource.Transformers.BelongsToAttribute β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Resource.Transformers.BelongsToAttribute [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/belongs_to_attribute.ex#L1 "View Source") =============================================================================================================================================================================================== Creates the attribute for belongs\_to relationships that have `define_field?: true` [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [after?(arg1)](#after?/1) Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1). [before?(\_)](#before?/1) Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1). [compile\_time\_only?()](#compile_time_only?/0) Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0). [transform(resource, dsl\_state)](#transform/2) Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2). [Link to this section](#functions) Functions ============================================= [Link to this function](#after?/1 "Link to this function") after?(arg1) ============ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/belongs_to_attribute.ex#L44 "View Source") Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1). [Link to this function](#before?/1 "Link to this function") before?(\_) =========== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/belongs_to_attribute.ex#L5 "View Source") Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1). [Link to this function](#compile_time_only?/0 "Link to this function") compile\_time\_only?() ====================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/belongs_to_attribute.ex#L5 "View Source") Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0). [Link to this function](#transform/2 "Link to this function") transform(resource, dsl\_state) =============================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/belongs_to_attribute.ex#L12 "View Source") Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2). Ash.Resource.Transformers.BelongsToSourceField β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Resource.Transformers.BelongsToSourceField [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/belongs_to_source_field.ex#L1 "View Source") ==================================================================================================================================================================================================== Sets the default `source_field` for belongs\_to attributes [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [after?(\_)](#after?/1) Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1). [before?(\_)](#before?/1) Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1). [compile\_time\_only?()](#compile_time_only?/0) Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0). [transform(resource, dsl\_state)](#transform/2) Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2). [Link to this section](#functions) Functions ============================================= [Link to this function](#after?/1 "Link to this function") after?(\_) ========== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/belongs_to_source_field.ex#L5 "View Source") Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1). [Link to this function](#before?/1 "Link to this function") before?(\_) =========== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/belongs_to_source_field.ex#L5 "View Source") Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1). [Link to this function](#compile_time_only?/0 "Link to this function") compile\_time\_only?() ====================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/belongs_to_source_field.ex#L5 "View Source") Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0). [Link to this function](#transform/2 "Link to this function") transform(resource, dsl\_state) =============================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/belongs_to_source_field.ex#L10 "View Source") Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2). Ash.Resource.Transformers.CachePrimaryKey β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Resource.Transformers.CachePrimaryKey [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/cache_primary_key.ex#L1 "View Source") ========================================================================================================================================================================================= Validates the primary key of a resource [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [after?(arg1)](#after?/1) Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1). [before?(\_)](#before?/1) Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1). [compile\_time\_only?()](#compile_time_only?/0) Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0). [transform(resource, dsl\_state)](#transform/2) Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2). [Link to this section](#functions) Functions ============================================= [Link to this function](#after?/1 "Link to this function") after?(arg1) ============ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/cache_primary_key.ex#L37 "View Source") Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1). [Link to this function](#before?/1 "Link to this function") before?(\_) =========== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/cache_primary_key.ex#L3 "View Source") Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1). [Link to this function](#compile_time_only?/0 "Link to this function") compile\_time\_only?() ====================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/cache_primary_key.ex#L3 "View Source") Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0). [Link to this function](#transform/2 "Link to this function") transform(resource, dsl\_state) =============================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/cache_primary_key.ex#L8 "View Source") Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2). Ash.Resource.Transformers.CreateJoinRelationship β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Resource.Transformers.CreateJoinRelationship [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/create_join_relationship.ex#L1 "View Source") ======================================================================================================================================================================================================= Creates an automatically named `has_many` relationship for each many\_to\_many. This will likely not be around for long, as our logic around many to many relationships will update soon. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [after?(\_)](#after?/1) Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1). [before?(arg1)](#before?/1) Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1). [compile\_time\_only?()](#compile_time_only?/0) Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0). [transform(resource, dsl\_state)](#transform/2) Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2). [Link to this section](#functions) Functions ============================================= [Link to this function](#after?/1 "Link to this function") after?(\_) ========== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/create_join_relationship.ex#L8 "View Source") Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1). [Link to this function](#before?/1 "Link to this function") before?(arg1) ============= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/create_join_relationship.ex#L36 "View Source") Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1). [Link to this function](#compile_time_only?/0 "Link to this function") compile\_time\_only?() ====================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/create_join_relationship.ex#L8 "View Source") Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0). [Link to this function](#transform/2 "Link to this function") transform(resource, dsl\_state) =============================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/create_join_relationship.ex#L14 "View Source") Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2). Ash.Resource.Transformers.SetPrimaryActions β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Resource.Transformers.SetPrimaryActions [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/set_primary_actions.ex#L1 "View Source") ============================================================================================================================================================================================= Creates/validates the primary action configuration If only one action of a given type is defined, it is marked as primary. If multiple exist, and one is not primary, this results in an error. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [after?(\_)](#after?/1) Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1). [before?(\_)](#before?/1) Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1). [compile\_time\_only?()](#compile_time_only?/0) Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0). [transform(resource, dsl\_state)](#transform/2) Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2). [Link to this section](#functions) Functions ============================================= [Link to this function](#after?/1 "Link to this function") after?(\_) ========== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/set_primary_actions.ex#L9 "View Source") Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1). [Link to this function](#before?/1 "Link to this function") before?(\_) =========== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/set_primary_actions.ex#L9 "View Source") Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1). [Link to this function](#compile_time_only?/0 "Link to this function") compile\_time\_only?() ====================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/set_primary_actions.ex#L9 "View Source") Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0). [Link to this function](#transform/2 "Link to this function") transform(resource, dsl\_state) =============================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/set_primary_actions.ex#L14 "View Source") Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2). Ash.Resource.Transformers.SetRelationshipSource β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Resource.Transformers.SetRelationshipSource [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/set_relationship_source.ex#L1 "View Source") ===================================================================================================================================================================================================== Sets the `source` key on relationships to be the resource they were defined on [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [after?(\_)](#after?/1) Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1). [before?(\_)](#before?/1) Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1). [compile\_time\_only?()](#compile_time_only?/0) Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0). [transform(resource, dsl\_state)](#transform/2) Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2). [Link to this section](#functions) Functions ============================================= [Link to this function](#after?/1 "Link to this function") after?(\_) ========== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/set_relationship_source.ex#L3 "View Source") Callback implementation for [`Ash.Dsl.Transformer.after?/1`](Ash.Dsl.Transformer.html#c:after?/1). [Link to this function](#before?/1 "Link to this function") before?(\_) =========== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/set_relationship_source.ex#L3 "View Source") Callback implementation for [`Ash.Dsl.Transformer.before?/1`](Ash.Dsl.Transformer.html#c:before?/1). [Link to this function](#compile_time_only?/0 "Link to this function") compile\_time\_only?() ====================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/set_relationship_source.ex#L3 "View Source") Callback implementation for [`Ash.Dsl.Transformer.compile_time_only?/0`](Ash.Dsl.Transformer.html#c:compile_time_only?/0). [Link to this function](#transform/2 "Link to this function") transform(resource, dsl\_state) =============================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/transformers/set_relationship_source.ex#L7 "View Source") Callback implementation for [`Ash.Dsl.Transformer.transform/2`](Ash.Dsl.Transformer.html#c:transform/2). Ash.Resource.Validation β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Resource.Validation behaviour [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation.ex#L1 "View Source") ============================================================================================================================================================= Represents a validation in Ash. See `Ash.Resource.Validation.Builtin` for a list of builtin validations. To write your own validation, define a module that implements the [`init/1`](#c:init/1) callback to validate options at compile time, and [`validate/2`](#c:validate/2) callback to do the validation. Then, in a resource, you can say: ``` validations do validation {MyValidation, [foo: :bar]} end ``` To make it more readable, you can define a function in the module that returns that tuple, and import it into your resource. ``` defmodule MyValidation do def my\_validation(value) do {\_\_MODULE\_\_, foo: value} end end ``` ``` defmodule MyResource do ... import MyValidation validations do validate my\_validation(:foo) end end ``` [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [path()](#t:path/0) [t()](#t:t/0) [Functions](#functions) ------------------------ [on(list)](#on/1) [opt\_schema()](#opt_schema/0) [transform(validation)](#transform/1) [validation(module)](#validation/1) [Callbacks](#callbacks) ------------------------ [init(arg1)](#c:init/1) [validate(arg1, arg2)](#c:validate/2) [Link to this section](#types) Types ===================================== [Link to this type](#t:path/0 "Link to this type") path() ====== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation.ex#L45 "View Source") Specs ----- ``` path() :: [[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)()] ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation.ex#L44 "View Source") Specs ----- ``` t() :: %Ash.Resource.Validation{ expensive?: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), module: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), on: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), opts: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), validation: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#on/1 "Link to this function") on(list) ======== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation.ex#L78 "View Source") [Link to this function](#opt_schema/0 "Link to this function") opt\_schema() ============= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation.ex#L76 "View Source") [Link to this function](#transform/1 "Link to this function") transform(validation) ===================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation.ex#L72 "View Source") [Link to this function](#validation/1 "Link to this function") validation(module) ================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation.ex#L91 "View Source") [Link to this section](#callbacks) Callbacks ============================================= [Link to this callback](#c:init/1 "Link to this callback") init(arg1) ========== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation.ex#L46 "View Source") Specs ----- ``` init([Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: {:ok, [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()} | {:error, [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()} ``` [Link to this callback](#c:validate/2 "Link to this callback") validate(arg1, arg2) ==================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation.ex#L47 "View Source") Specs ----- ``` validate([Ash.changeset](Ash.html#t:changeset/0)(), [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: :ok | {:error, [Ash.error](Ash.html#t:error/0)()} ``` Ash.Resource.Validation.Builtins β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Resource.Validation.Builtins [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation/builtins.ex#L1 "View Source") ===================================================================================================================================================================== Built in validations that are available to all resources The functions in this module are imported by default in the validations section. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [absent(attributes, opts \\ [])](#absent/2) [present(attributes, opts \\ [])](#present/2) [Link to this section](#functions) Functions ============================================= [Link to this function](#absent/2 "Link to this function") absent(attributes, opts \\ []) ============================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation/builtins.ex#L20 "View Source") [Link to this function](#present/2 "Link to this function") present(attributes, opts \\ []) =============================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation/builtins.ex#L10 "View Source") Ash.Resource.Validation.Present β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Resource.Validation.Present [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/resource/validation/present.ex#L1 "View Source") =================================================================================================================================================================== Validates that the provided attribute is non-nil Ash.Type β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Type behaviour [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L1 "View Source") ==================================================================================================================================== This behaviour is a superset of the Ecto.Type behavior, that also contains api level information, like what kinds of filters are allowed. Eventually, this may be used for composite types or serialization. Much better to `use Ash.Type` than to say `@behaviour Ash.Type` and define everything yourself. Built in types ----------------- * `:term` - [`Ash.Type.Term`](Ash.Type.Term.html) * `:string` - [`Ash.Type.String`](Ash.Type.String.html) * `:integer` - [`Ash.Type.Integer`](Ash.Type.Integer.html) * `:boolean` - [`Ash.Type.Boolean`](Ash.Type.Boolean.html) * `:uuid` - [`Ash.Type.UUID`](Ash.Type.UUID.html) * `:date` - [`Ash.Type.Date`](Ash.Type.Date.html) * `:utc_datetime` - [`Ash.Type.UtcDatetime`](Ash.Type.UtcDatetime.html) ### Composite Types Currently, the only composite type supported is a list type, specified via: `{:array, Type}`. The constraints available are: * `:items` - Constraints for the elements of the list. See the contained type's docs for more. * `:min_length` - A minimum length for the items * `:max_length` - A maximum length for the items * `:nil_items?` - Whether or not the list can contain nil items The default value is `true`. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [constraints()](#t:constraints/0) [t()](#t:t/0) [Functions](#functions) ------------------------ [apply\_constraints(type, term, constraints)](#apply_constraints/3) Confirms if a casted value matches the provided constraints. [ash\_type?(module)](#ash_type?/1) Returns true if the value is a builtin type or adopts the [`Ash.Type`](#content) behaviour [cast\_input(type, term)](#cast_input/2) Casts input (e.g. unknown) data to an instance of the type, or errors [cast\_stored(type, term)](#cast_stored/2) Casts a value from the data store to an instance of the type, or errors [constraints(type)](#constraints/1) [dump\_to\_native(type, term)](#dump_to_native/2) Casts a value from the Elixir type to a value that the data store can persist [ecto\_type(type)](#ecto_type/1) Returns the ecto compatible type for an Ash.Type. [equal?(type, left, right)](#equal?/3) Determines if two values of a given type are equal. [get\_type(value)](#get_type/1) [storage\_type(type)](#storage_type/1) Returns the *underlying* storage type (the underlying type of the *ecto type* of the *ash type*) [Callbacks](#callbacks) ------------------------ [apply\_constraints(term, constraints)](#c:apply_constraints/2) [cast\_input(term)](#c:cast_input/1) [cast\_stored(term)](#c:cast_stored/1) [constraints()](#c:constraints/0) [dump\_to\_native(term)](#c:dump_to_native/1) [ecto\_type()](#c:ecto_type/0) [equal?(term, term)](#c:equal?/2) [storage\_type()](#c:storage_type/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:constraints/0 "Link to this type") constraints() ============= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L56 "View Source") Specs ----- ``` constraints() :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)() ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L66 "View Source") Specs ----- ``` t() :: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | {:array, [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#apply_constraints/3 "Link to this function") apply\_constraints(type, term, constraints) =========================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L197 "View Source") Specs ----- ``` apply_constraints([t](#t:t/0)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [constraints](#t:constraints/0)()) :: :ok | {:error, [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()} ``` Confirms if a casted value matches the provided constraints. [Link to this function](#ash_type?/1 "Link to this function") ash\_type?(module) ================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L113 "View Source") Specs ----- ``` ash_type?([term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Returns true if the value is a builtin type or adopts the [`Ash.Type`](#content) behaviour [Link to this function](#cast_input/2 "Link to this function") cast\_input(type, term) ======================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L130 "View Source") Specs ----- ``` cast_input([t](#t:t/0)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: {:ok, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | {:error, [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()} | :error ``` Casts input (e.g. unknown) data to an instance of the type, or errors Maps to [`Ecto.Type.cast/2`](https://hexdocs.pm/ecto/Ecto.Type.html#cast/2) [Link to this function](#cast_stored/2 "Link to this function") cast\_stored(type, term) ======================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L171 "View Source") Specs ----- ``` cast_stored([t](#t:t/0)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: {:ok, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | {:error, [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | :error ``` Casts a value from the data store to an instance of the type, or errors Maps to [`Ecto.Type.load/2`](https://hexdocs.pm/ecto/Ecto.Type.html#load/2) [Link to this function](#constraints/1 "Link to this function") constraints(type) ================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L283 "View Source") Specs ----- ``` constraints([t](#t:t/0)()) :: [constraints](#t:constraints/0)() ``` [Link to this function](#dump_to_native/2 "Link to this function") dump\_to\_native(type, term) ============================ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L297 "View Source") Specs ----- ``` dump_to_native([t](#t:t/0)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: {:ok, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | {:error, [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | :error ``` Casts a value from the Elixir type to a value that the data store can persist Maps to [`Ecto.Type.dump/2`](https://hexdocs.pm/ecto/Ecto.Type.html#dump/2) [Link to this function](#ecto_type/1 "Link to this function") ecto\_type(type) ================ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L101 "View Source") Specs ----- ``` ecto_type([t](#t:t/0)()) :: [Ecto.Type.t](https://hexdocs.pm/ecto/Ecto.Type.html#t:t/0)() ``` Returns the ecto compatible type for an Ash.Type. If you `use Ash.Type`, this is created for you. For builtin types this may return a corresponding ecto builtin type (atom) [Link to this function](#equal?/3 "Link to this function") equal?(type, left, right) ========================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L321 "View Source") Specs ----- ``` equal?([t](#t:t/0)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Determines if two values of a given type are equal. Maps to [`Ecto.Type.equal?/3`](https://hexdocs.pm/ecto/Ecto.Type.html#equal?/3) [Link to this function](#get_type/1 "Link to this function") get\_type(value) ================ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L72 "View Source") Specs ----- ``` get_type([atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this function](#storage_type/1 "Link to this function") storage\_type(type) =================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L91 "View Source") Specs ----- ``` storage_type([t](#t:t/0)()) :: [Ecto.Type.t](https://hexdocs.pm/ecto/Ecto.Type.html#t:t/0)() ``` Returns the *underlying* storage type (the underlying type of the *ecto type* of the *ash type*) [Link to this section](#callbacks) Callbacks ============================================= [Link to this callback](#c:apply_constraints/2 "Link to this callback") apply\_constraints(term, constraints) ===================================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L63 "View Source") Specs ----- ``` apply_constraints([term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [constraints](#t:constraints/0)()) :: :ok | {:error, [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()]} ``` [Link to this callback](#c:cast_input/1 "Link to this callback") cast\_input(term) ================= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L59 "View Source") Specs ----- ``` cast_input([term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: {:ok, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | {:error, [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()} | :error ``` [Link to this callback](#c:cast_stored/1 "Link to this callback") cast\_stored(term) ================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L60 "View Source") Specs ----- ``` cast_stored([term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: {:ok, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | :error ``` [Link to this callback](#c:constraints/0 "Link to this callback") constraints() ============= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L62 "View Source") Specs ----- ``` constraints() :: [constraints](#t:constraints/0)() ``` [Link to this callback](#c:dump_to_native/1 "Link to this callback") dump\_to\_native(term) ====================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L61 "View Source") Specs ----- ``` dump_to_native([term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: {:ok, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | :error ``` [Link to this callback](#c:ecto_type/0 "Link to this callback") ecto\_type() ============ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L58 "View Source") Specs ----- ``` ecto_type() :: [Ecto.Type.t](https://hexdocs.pm/ecto/Ecto.Type.html#t:t/0)() ``` [Link to this callback](#c:equal?/2 "Link to this callback") equal?(term, term) ================== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L64 "View Source") Specs ----- ``` equal?([term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this callback](#c:storage_type/0 "Link to this callback") storage\_type() =============== [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/type.ex#L57 "View Source") Specs ----- ``` storage_type() :: [Ecto.Type.t](https://hexdocs.pm/ecto/Ecto.Type.html#t:t/0)() ``` Ash.Type.Boolean β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Type.Boolean [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/boolean.ex#L1 "View Source") ===================================================================================================================================== Represents a boolean. A builtin type that can be referenced via `:boolean` Ash.Type.Date β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Type.Date [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/date.ex#L1 "View Source") =============================================================================================================================== Represents a date in the database A builtin type that can be referenced via `:date` Ash.Type.Integer β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Type.Integer [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/integer.ex#L1 "View Source") ===================================================================================================================================== Represents a simple integer A builtin type that can be referenced via `:integer` ### Constraints * `:max` - Enforces a maximum on the value * `:min` - Enforces a minimum on the value Ash.Type.String β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Type.String [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/string.ex#L1 "View Source") =================================================================================================================================== Stores a string in the database A builtin type that can be referenced via `:string` ### Constraints * `:max_length` - Enforces a maximum length on the value * `:min_length` - Enforces a minimum length on the value * `:match` - Enforces that the string matches a passed in regex [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [match(regex)](#match/1) [Link to this section](#functions) Functions ============================================= [Link to this function](#match/1 "Link to this function") match(regex) ============ [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/string.ex#L82 "View Source") Ash.Type.Term β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Type.Term [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/term.ex#L1 "View Source") =============================================================================================================================== Represents a raw elixir term in the database A builtin type that can be referenced via `:string` Ash.Type.UUID β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Type.UUID [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/uuid.ex#L1 "View Source") =============================================================================================================================== Represents a UUID. A builtin type that can be referenced via `:utc_datetime` Ash.Type.UtcDatetime β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 Ash.Type.UtcDatetime [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/ash/type/utc_datetime.ex#L1 "View Source") ============================================================================================================================================== Represents a utc datetime A builtin type that can be referenced via `:utc_datetime` mix ash.formatter β€” ash v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } ash v0.11.0 mix ash.formatter [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/mix/tasks/ash.formatter.ex#L1 "View Source") ============================================================================================================================================= Generates a .formatter.exs from a list of extensions, and writes it. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [run(opts)](#run/1) Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1). [Link to this section](#functions) Functions ============================================= [Link to this function](#run/1 "Link to this function") run(opts) ========= [View Source](https://github.com/ash-project/ash/blob/v0.11.0/lib/mix/tasks/ash.formatter.ex#L21 "View Source") Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1).
exq_ui
hex
ExqUI β€” exq\_ui v0.14.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } ExqUI [View Source](https://github.com/akira/exq_ui/blob/v0.14.0/README.md#L1 "View Source") =============================================================================================== [![Hex.pm](https://img.shields.io/hexpm/v/exq_ui.svg)](https://hex.pm/packages/exq_ui) ExqUI provides a UI dashboard for [Exq](https://github.com/akira/exq), a job processing library compatible with Resque / Sidekiq for the Elixir language. ExqUI allow you to see various job processing stats, as well as details on failed, retried, scheduled jobs, etc. Configuration ---------------- 1. ExqUI depends on the [api server](https://hexdocs.pm/exq/Exq.Api.html#content) component of the [exq](https://github.com/akira/exq). The user of ExqUI is expected to start the Exq with proper config. The only config required on ExqUI side is the name of the api server. It's set to Exq.Api by default. ``` config :exq\_ui, api\_name: Exq.Api ``` There are two typical scenarios If ExqUI is embedded in a worker node which runs exq jobs, then nothing special needs to be done. Exq by default starts the api server on all worker nodes. If ExqUI needs to be embedded in a node which is not a worker, then Exq can be started in `api` mode, which will only start the api gen server and will not pickup jobs for execution. This can be done by configuring the `mode`. ``` config :exq, mode: :api ``` 2. ExqUI uses Phoenix LiveView. If you already use LiveView, skip to next step. Otherwise follow LiveView [installation docs](https://hexdocs.pm/phoenix_live_view/installation.html). 3. In your phoenix router import [`ExqUIWeb.Router`](ExqUIWeb.Router.html) and add `live_exq_ui(path)` ``` defmodule DemoWeb.Router do use Phoenix.Router import ExqUIWeb.Router pipeline :browser do plug :fetch\_session plug :protect\_from\_forgery end scope "/", DemoWeb do pipe\_through :browser live\_exq\_ui("/exq") end end ``` Exq Scheduler ---------------- ExqUI provides support for [Exq Scheduler](https://github.com/activesphere/exq-scheduler). It can be enabled by giving a name to exq scheduler and specifying the same name in exq ui config. ``` config :exq\_scheduler, name: ExqScheduler config :exq\_ui, exq\_scheduler\_name: ExqScheduler ``` Development -------------- ``` mix setup # on first run mix run --no-halt dev.exs open http://localhost:4000/exq ``` [← Previous Page Changelog](changelog.html) ExqUIWeb.Router β€” exq\_ui v0.14.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } ExqUIWeb.Router (exq\_ui v0.14.0) [View Source](https://github.com/akira/exq_ui/blob/v0.14.0/lib/exq_ui_web/router.ex#L1 "View Source") ======================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [live\_exq\_ui(path, opts \\ [])](#live_exq_ui/2) Exposes ExqUI web interface at the specified `path`. [`Phoenix.LiveView.Router.live_session/3`](https://hexdocs.pm/phoenix_live_view/0.18.18/Phoenix.LiveView.Router.html#live_session/3) is used to wrap all the live routes. [Link to this section](#functions) Functions ============================================= [Link to this macro](#live_exq_ui/2 "Link to this macro") live\_exq\_ui(path, opts \\ []) =============================== [View Source](https://github.com/akira/exq_ui/blob/v0.14.0/lib/exq_ui_web/router.ex#L14 "View Source") (macro) Exposes ExqUI web interface at the specified `path`. [`Phoenix.LiveView.Router.live_session/3`](https://hexdocs.pm/phoenix_live_view/0.18.18/Phoenix.LiveView.Router.html#live_session/3) is used to wrap all the live routes. Options ---------- * live\_session\_name - Name of the live\_session. Defaults to `:exq_ui` * live\_socket\_path - Should match the value used for `socket "/live", Phoenix.LiveView.Socket`. Defaults to `/live` * live\_session\_on\_mount - Declares an optional module callback to be invoked on the LiveView's mount API Reference β€” exq\_ui v0.14.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } API Reference exq\_ui v0.14.0 ============================== Modules ---------- [ExqUIWeb.Router](ExqUIWeb.Router.html) [Next Page β†’ Changelog](changelog.html)
google_api_vm_migration
hex
API Reference β€” google\_api\_vm\_migration v0.5.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } Settings API Reference google\_api\_vm\_migration v0.5.0 ============================================================
deferred_config
hex
README – DeferredConfig v0.1.1 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; Deferred Config ------------------ Seamless runtime config with one line of code. In your application’s `start/2` method, call: ``` DeferredConfig.populate(:otp_app_name) ``` And now you and users of your application or library will be able to write config that is deferred to runtime, like the following: ``` config :otp_app_name, http: %{ # nested config is ok # common 'system tuple' pattern is fully supported port: {:system, "PORT", {String, :to_integer}} }, # more general 'mfa tuple' pattern is also supported secret_key: {:apply, {MyKey, :fetch, ["arg"]}} ``` That’s it. * No β€˜mappings,’ no special access methods β€” just keep using [`Application.get_env/2`](https://hexdocs.pm/elixir/Application.html#get_env/2). * Works for arbitrarily nested config. * Works just as well when run with mix as it does in releases built with `:distillery`, `:exrm`, or `:relx`. * Lets library authors support the common β€œsystem tuples” pattern *effortlessly.* **Why this library?** See β€˜[Rationale](#rationale)’ for more detail. But **TLDR:** `REPLACE_OS_VARS` is string-only and release-only, and `{:system, ...}` support among libraries is inconsistent and easy to get wrong in ways that bite your users come release time β€” in other words, until now it’s been a burden on library authors. This library tries to make it 1 LOC to do the right thing. There are other libraries to manage runtime config (see list at end of readme) but using them is harder as they add things β€” like special config accessor functions, and/or their own config files, or mappings, or DSLs. We don’t need to, because we rely on a [`ReplacingWalk`](ReplacingWalk.html) of an app’s config during [`Application.start/2`](https://hexdocs.pm/elixir/Application.html#start/2), and the only DSL are configuration patterns sourced from the community, like system and mfa tuples. Usage -------- In mix.exs, ``` defp deps, do: [{:deferred_config, "~> 0.1.0"}] ``` Then, in your application startup, add the following line: ``` defmodule Mine.Application do # ... def start(_type, _args) do DeferredConfig.populate(:mine) # <--- here # ... end end ``` Where the app name is `:mine`. Now, you and users of your app can configure as follows, and it’ll work β€” regardless of if they’re running it from iex, or a release with env vars set: ``` config :mine, # string from env var, or `nil` if missing. port1: {:system, "PORT"}, # string from env var |> integer; `nil` if missing. port2: {:system, "PORT", {String, :to_integer}}, # string from env var, or "4000" as default. port3: {:system, "PORT", "4000"}, # converts env var to integer, or 4000 as default. port4: {:system, "PORT", 4000, {String, :to_integer}} ``` Features ----------- **Accessing config does not change.** If you used `Application.get_env(:mine, :port1)` before, that will keep working. Since you can use arbitrary transformation functions, **you can do advanced transformations** if you need to: ``` # lib/mine/ip.ex defmodule Mine.Ip do @doc ":inet uses `{0,0,0,0}` for ipv4 addrs" def str2ip(str) do case :inet_parse:address(str) do {:ok, ip = {_, _, _, _}} -> ip {:error, _} -> nil end end end # config.exs config :my_app, port: {:system, "MY_IP", {127,0,0,1}, {Mine.Ip, :str2ip} ``` If you need even more control β€” say, the source of your config isn’t the system env, but a file in a directory, which is more secure in some use cases β€” you can use the deferred MFA (module, function, arguments) form: ``` config :mine, api_key: {:apply, {File, :read!, ["k.txt"]}} ``` **Nested and arbitrary config** should work. **Can be extended** to recognize and transform other kinds of config as well ([`DeferredConfig.populate/2`](DeferredConfig.html#populate/2)), ie if there’s a pattern like β€˜system tuples’ that you wanted to support, and `{:apply, mfa}` was bad UX. If you have another use case that this doesn’t cover, please file an issue or reach out to github.com/mrluc ### Limitations Note that this only applies to **one OTP app’s config.** We can’t (and shouldn’t try to) monkey-patch every app’s config; they all start up at different times. This limitation applies to all approaches to runtime config except `REPLACE_OS_VARS`. Rationale ------------ Mix configs don’t always work like users would like when they build releases, whether with relx, exrm, distillery, or something else. There are 3 approaches we’ll look at to identify pain points: 1. `REPLACE_OS_VARS` for releases 2. `{:system, ...}` tuples for deferred config 3. Other runtime config libraries ### 1) REPLACE\_OS\_VARS is for releases only The best-supported method of injecting run-time configuration β€” running the release with `REPLACE_OS_VARS` or `RELX_REPLACE_OS_VARS`, supported by `distillery`, `relx` and `exrm` β€” will result in config like the following: ``` config :my_app, field: "${SOME_VAR}" ``` That works in **all your config, for all apps you configure**, even if the app doesn’t do anything particular to support it. Drawbacks of `REPLACE_OS_VARS` * It only works when running a release. Otherwise, your `DB_URL` will literally be `"${DB_URL}"`. * It only gives you string values. Some libs will require that eg `PORT` be a number. Neither is a show-stopper *by any means*, but it’s a small complication … shared users of thousands of libraries. ### 2) `{:system, ...}` tuples have inconsistent support Apps that want to allow run-time configuration from Mix configs (which you could argue is β€˜all of them’) should be configurable with lazy values, which can be filled **on startup of that application, before they are used**. What should those lazy values look like? Many libraries have settled on so-called β€˜system tuples’, like: ``` config :someapp, field: {:system, "ENV_VAR_NAME", "default value"} ``` **The downside**: that approach requires every library author to recognize and support that kind of tuple. Some big libraries do! However, it can be a pain to add support for that kind of config consistently, converting data types appropriately, for all configurable options in your app. (A small pain, spread over many libraries). This library automates that pattern. ### 3) Other runtime config libs use special config files and/or access methods There are many other libs for config, most of which also deal with runtime config: * [:confex](https://hexdocs.pm/confex) * [:flasked](https://hexdocs.pm/flasked) * [:env\_config](https://hexdocs.pm/env_config) * [:config\_ext](https://hexdocs.pm/config_ext) * [libex\_config](https://hex.pm/packages/libex_config) * [:configparser](https://hexdocs.pm/configparser_ex) * [:config](https://hexdocs.pm/config) * [:spellbook](https://hex.pm/packages/spellbook) They solve a wide variety of config-related problems. However, these **all** introduce their own methods for accessing Application config, and other complexity as well (mappings, config files, etc). We avoid that, by doing a replacing walk on the app’s config at startup. β€˜When should I REPLACE\_OS\_VARS?’ ------------------------------------- Always, but not always because of app config! For injecting config, it has the limitations mentioned above in β€˜Rationale.’ * For config: **if** you need to configure many libraries that don’t support deferred config, **and** what you want to configure can be a string (`DB_URL`, for instance) … in that case, maybe a release-only config is a good option. But you should probably use `REPLACE_OS_VARS` (or `RELX_REPLACE_OS_VARS`), because it **also** allows **interpolation in `vm.args`**. * That lets you drive node short/longnames in releases with env vars. Which can be important when eg you don’t know the node IP for a release at compile-time. * It’s nice that the same approach for vm.args templating works across release builders. DeferredConfig – DeferredConfig v0.1.1 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; DeferredConfig v0.1.1 DeferredConfig ====================================== Seamlessly add runtime config to your library, with the β€œsystem tuples” or the `{m,f,a}` patterns. Seamlessly? =========== In your application startup, add the following line: ``` defmodule Mine.Application do def start(_type, _args) do DeferredConfig.populate(:mine) # <-- this one ... end end ``` Where `:mine` is the name of your OTP app. Now you and users of your app or lib can configure as follows, and it’ll work β€” regardless of if they’re running it from iex, or a release with env vars set: ``` config :mine, # string from env var, or `nil` if missing. port1: {:system, "PORT"}, # string from env var |> integer; `nil` if missing. port2: {:system, "PORT", {String, :to_integer}}, # string from env var, or "4000" as default. port3: {:system, "PORT", "4000"}, # converts env var to integer, or 4000 as default. port4: {:system, "PORT", 4000, {String, :to_integer}} ``` **Accessing config does not change.** Since you can use arbitrary transformation functions, you can do advanced transformations if you need to: ``` # lib/mine/ip.ex defmodule Mine.Ip do @doc ":inet_res uses `{0,0,0,0}` for ipv4 addrs" def str2ip(str) do case :inet_parse:address(str) do {:ok, ip = {_, _, _, _}} -> ip {:error, _} -> nil end end end # config.exs config :my_app, port: {:system, "MY_IP", {127,0,0,1}, {Mine.Ip, :str2ip} ``` See `README.md` for explanation of rationale. **TL;DR:** `REPLACE_OS_VARS` is string-only and release-only, and `{:system, ...}` support among libraries is spotty and easy to get wrong in ways that bite your users come release time. This library tries to make it easier to do the right thing with 1 LOC. Other libraries add special config files and/or special config accessors, which is more complex than necessary. Summary ========== [Functions](#functions) ------------------------ [apply\_transformed\_cfg!(kvlist, app)](#apply_transformed_cfg!/2) [`Application.put_env/3`](https://hexdocs.pm/elixir/Application.html#put_env/3) for config kvlist [default\_transforms()](#default_transforms/0) Default recognize/transform pairs used in populating deferred config. Currently r/t pairs for :system tuples and :apply mfa tuples [get\_system\_tuple(t)](#get_system_tuple/1) Return transformed copy of recognized system tuples: gets from env, optionally converts it, with optional default if env returned nothing [populate(app, transforms \\ [{&DeferredConfig.recognize\_system\_tuple/1, &DeferredConfig.get\_system\_tuple/1}, {&DeferredConfig.recognize\_mfa\_tuple/1, &DeferredConfig.transform\_mfa\_tuple/1}])](#populate/2) Populate deferred values in an app’s config. Best run during [`Application.start/2`](https://hexdocs.pm/elixir/Application.html#start/2) [recognize\_mfa\_tuple(arg1)](#recognize_mfa_tuple/1) Recognize mfa tuple, like `{:apply, {File, :read!, ["name"]}}`. Returns `true` on recognition, `false` otherwise [recognize\_system\_tuple(arg1)](#recognize_system_tuple/1) Recognizer for system tuples of forms: * `{:system, "VAR"}` * `{:system, "VAR", default_value}` * `{:system, "VAR", {String, :to_integer}}` * `{:system, "VAR", default_value, {String, :to_integer}}` Returns `true` when it matches one, `false` otherwise [transform\_cfg(cfg, rts \\ [{&DeferredConfig.recognize\_system\_tuple/1, &DeferredConfig.get\_system\_tuple/1}, {&DeferredConfig.recognize\_mfa\_tuple/1, &DeferredConfig.transform\_mfa\_tuple/1}])](#transform_cfg/2) Given a config kvlist, and an enumerable of `{&recognize/1, &transform/1}` functions, returns a kvlist with the values transformed via replacing walk [transform\_mfa\_tuple(arg)](#transform_mfa_tuple/1) Return evaluated `{:apply, {mod, fun, args}}` tuple Functions ============ apply\_transformed\_cfg!(kvlist, app) [`Application.put_env/3`](https://hexdocs.pm/elixir/Application.html#put_env/3) for config kvlist default\_transforms() Default recognize/transform pairs used in populating deferred config. Currently r/t pairs for :system tuples and :apply mfa tuples. get\_system\_tuple(t) Return transformed copy of recognized system tuples: gets from env, optionally converts it, with optional default if env returned nothing. populate(app, transforms \\ [{&DeferredConfig.recognize\_system\_tuple/1, &DeferredConfig.get\_system\_tuple/1}, {&DeferredConfig.recognize\_mfa\_tuple/1, &DeferredConfig.transform\_mfa\_tuple/1}]) Populate deferred values in an app’s config. Best run during [`Application.start/2`](https://hexdocs.pm/elixir/Application.html#start/2). **By default** attempts to populate the common `{:system, "VAR"}` tuple form for getting values from [`System.get_env/1`](https://hexdocs.pm/elixir/System.html#get_env/1), and the more general `{:apply, {Mod, fun, [args]}}` form as well. System tuples support optional defaults and conversion functions, see `Peerage.DeferredConfig.get_system_tuple/1`. Can be extended by passing in a different enumerable of `{&recognizer/1, &transformer/1}` functions. recognize\_mfa\_tuple(arg1) Recognize mfa tuple, like `{:apply, {File, :read!, ["name"]}}`. Returns `true` on recognition, `false` otherwise. recognize\_system\_tuple(arg1) Recognizer for system tuples of forms: * `{:system, "VAR"}` * `{:system, "VAR", default_value}` * `{:system, "VAR", {String, :to_integer}}` * `{:system, "VAR", default_value, {String, :to_integer}}` Returns `true` when it matches one, `false` otherwise. transform\_cfg(cfg, rts \\ [{&DeferredConfig.recognize\_system\_tuple/1, &DeferredConfig.get\_system\_tuple/1}, {&DeferredConfig.recognize\_mfa\_tuple/1, &DeferredConfig.transform\_mfa\_tuple/1}]) Given a config kvlist, and an enumerable of `{&recognize/1, &transform/1}` functions, returns a kvlist with the values transformed via replacing walk. transform\_mfa\_tuple(arg) Return evaluated `{:apply, {mod, fun, args}}` tuple. ReplacingWalk – DeferredConfig v0.1.1 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; DeferredConfig v0.1.1 ReplacingWalk ===================================== A hastily constructed replacing walk for use with [`DeferredConfig`](DeferredConfig.html); not very performant, but for transforming data in options and config, can be convenient. Summary ========== [Functions](#functions) ------------------------ [walk(m, recognize, transform)](#walk/3) Recursive replacing walk that uses `recognize` and `transform` functions to return a transformed version of arbitrary data Functions ============ walk(m, recognize, transform) Recursive replacing walk that uses `recognize` and `transform` functions to return a transformed version of arbitrary data. ``` iex> ReplacingWalk.walk [1, 2, 3], &(&1 == 2), &(&1 * &1) [1,4,3] iex> ReplacingWalk.walk( [1, [2, [3, 2]]], ...> &(&1 == 2), ...> &(&1 * &1) ...> ) [1,[4, [3, 4]]] ``` It works for Maps: ``` iex> ReplacingWalk.walk %{2 => 1, 1 => 2}, &(&1 == 2), &(&1 * &1) %{4 => 1, 1 => 4} ``` Structs in general are considered as leaf nodes; we support structs that implement Enumerable, but \*\*currently we expect their [`Enumerable`](https://hexdocs.pm/elixir/Enumerable.html) implementation to work like a Map. If you feed this an Enumerable struct that doesn’t iterate like Map β€” ie, doesn’t iterate over `{k, v}` β€” it will die. (See an example in tests). We may change that behavior in the future β€” either removing support for arbitrary Enumerables, or provision another protocol that can be implemented to make a data type replacing-walkable. Created quickly for `:deferred_config`, so it’s probably got some holes; tests that break it are welcome.
opengraph_parser
hex
API Reference β€” opengraph\_parser v0.4.3 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings API Reference opengraph\_parser v0.4.3 =================================================== [modules](#modules) Modules ----------------------------- [OpenGraph](OpenGraph.html) Fetch and parse websites to extract Open Graph meta tags. OpenGraph β€” opengraph\_parser v0.4.3 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings OpenGraph (opengraph\_parser v0.4.3) ================================================= Fetch and parse websites to extract Open Graph meta tags. The example above shows how to fetch the GitHub Open Graph rich objects. ``` OpenGraph.fetch("https://github.com") %OpenGraph{description: "GitHub is where people build software. More than 15 million...", image: "https://assets-cdn.github.com/images/modules/open\_graph/github-octocat.png", site\_name: "GitHub", title: "Build software better, together", type: nil, url: "https://github.com"} ``` [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [html()](#t:html/0) [t()](#t:t/0) [Functions](#functions) ------------------------ [parse(html)](#parse/1) Parses the given HTML to extract the Open Graph objects. [Link to this section](#types) Types ===================================== [Link to this type](#t:html/0 "Link to this type") html() ====== ``` @type html() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | [charlist](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this type](#t:t/0 "Link to this type") t() === ``` @type t() :: %OpenGraph{ audio: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, "audio:secure_url": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, "audio:type": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, "book:author": [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil, "book:isbn": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, "book:release_date": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, "book:tag": [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil, description: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, determiner: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, image: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), "image:alt": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, "image:height": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, "image:secure_url": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, "image:type": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, "image:width": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, locale: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, "price:amount": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, "price:currency": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, site_name: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, title: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, type: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, url: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, video: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, "video:alt": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, "video:height": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, "video:secure_url": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, "video:type": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, "video:width": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#parse/1 "Link to this function") parse(html) =========== ``` @spec parse([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) :: [t](#t:t/0)() ``` Parses the given HTML to extract the Open Graph objects. Args: * `html` - raw HTML as a binary string or char list This functions returns an OpenGraph struct.
expyplot
hex
Expyplot.Plot – expyplot v1.2.2 expyplot v1.2.2 Expyplot.Plot =============================== **This is the end-user API for pyplot.**See the matplotlib.plot docs at: <http://matplotlib.org/api/pyplot_api.html> **Most of these functions are UNTESTED. I know. That's terrible. But you can test them by using them! Then, if they don't work, open an issue on the github:**<https://github.com/MaxStrange/expyplot/issues> **Or better yet, you could write some tests or a patch and open a pull request!**Also, since the return values are simply the string representations of whatever was returned to the python server, all of the return values will need to be converted into actual Elixir datastructures. I would love to get around to changing this behavior in the future, but for now, it is as it is. **This also means that numpy arrays that are returned are likely to be truncated**. This documentation is mostly just copied from the matplotlib.plot docs, and much of it isn’t translated to Elixir like it should be. Summary ========== [Functions](#functions) ------------------------ [acorr(x, opts \\ [hold: nil, data: nil], kwargs \\ [])](#acorr/3) Plot the autocorrelation of x [angle\_spectrum(x, opts \\ [\_Fs: 2, \_Fc: 0, pad\_to: nil, sides: :default], kwargs \\ [])](#angle_spectrum/3) Plot the angle spectrum [annotate(opts \\ [], kwargs \\ [])](#annotate/2) Annotate the point xy with text s [arrow(x, y, dx, dy, opts \\ [hold: nil], kwargs \\ [])](#arrow/6) Add an arrow to the axes [autoscale(opts \\ [enable: true, axis: :both, tight: nil])](#autoscale/1) Autoscale the axis view to the data (toggle) [autumn()](#autumn/0) Set the default colormap to autumn and apply to current image if any. See help(colormaps) for more information [axes(opts \\ [], kwargs \\ [])](#axes/2) Add an axes to the figure [axhline(opts \\ [y: 0, xmin: 0, xmax: 1, hold: nil], kwargs \\ [])](#axhline/2) Add a horizontal line across the axis [axhspan(ymin, ymax, opts \\ [xmin: 0, xmax: 1, hold: nil], kwargs \\ [])](#axhspan/4) Add a horizontal span (rectangle) across the axis [axis\_get(kwargs \\ [])](#axis_get/1) **This is how *axis* has been implemented in this library: as two functions - a get and a set, rather than just the one**Convenience method to get or set axis properties [axis\_set(v, kwargs \\ [])](#axis_set/2) **This is how *axis* has been implemented in this library: as two functions - a get and a set, rather than just the one**Convenience method to get or set axis properties [axvline(opts \\ [x: 0, ymin: 0, ymax: 1, hold: nil], kwargs \\ [])](#axvline/2) Add a vertical line across the axes [axvspan(xmin, xmax, opts \\ [ymin: 0, ymax: 1, hold: nil], kwargs \\ [])](#axvspan/4) Add a vertical span (rectangle) across the axes [bar(left, height, opts \\ [width: 0.8, bottom: nil, hold: nil, data: nil], kwargs \\ [])](#bar/4) Make a bar plot [barbs(opts \\ [], kwargs \\ [])](#barbs/2) Plot a 2-D field of barbs [barh(bottom, width, opts \\ [height: 0.8, left: nil, hold: nil], kwargs \\ [])](#barh/4) Make a horizontal bar plot [bone()](#bone/0) Set the default colormap to bone and apply to current image if any [boxplot(x, opts \\ [notch: nil, sym: nil, vert: nil, whis: nil, positions: nil, widths: nil, patch\_artist: nil, bootstrap: nil, usermedians: nil, conf\_intervals: nil, meanline: nil, showmeans: nil, showcaps: nil, showbox: nil, showfliers: nil, boxprops: nil, labels: nil, flierprops: nil, medianprops: nil, meanprops: nil, capprops: nil, whiskerprops: nil, manage\_xticks: true, autorange: false, zorder: nil, hold: nil, data: nil])](#boxplot/2) Make a box and whisker plot [broken\_barh(xranges, yrange, opts \\ [hold: nil, data: nil], kwargs \\ [])](#broken_barh/4) Plot horizontal bars [cla()](#cla/0) Clear the current axes [clabel(cs, opts \\ [], kwargs \\ [])](#clabel/3) Label a contour plot [clf()](#clf/0) Clear the current figure [clim(opts \\ [vmin: nil, vmax: nil])](#clim/1) Set the color limits of the current image [close(opts \\ [])](#close/1) Close a figure window [cohere(x, y, opts \\ [nfft: 256, \_Fs: 2, \_Fc: 0, noverlap: 0, pad\_to: nil, sides: :default, scale\_by\_freq: nil, hold: nil, data: nil], kwargs \\ [])](#cohere/4) Plot the coherence between *x* and *y* [colorbar(opts \\ [mappable: nil, cax: nil, ax: nil], kwargs \\ [])](#colorbar/2) Add a colorbar to a plot [colors()](#colors/0) This is a do-nothing function to provide you with help on how matplotlib handles colors [contour(opts \\ [], kwargs \\ [])](#contour/2) Plot contours [contourf(opts \\ [], kwargs \\ [])](#contourf/2) Plot contours [cool()](#cool/0) Set the default colormap to cool and apply to current image if any [copper()](#copper/0) Set the default colormap to copper and apply to current image if any [csd(x, y, opts \\ [nfft: 256, \_Fs: 2, \_Fc: 0, noverlap: 0, pad\_to: nil, sides: :default, scale\_by\_freq: nil, return\_line: nil], kwargs \\ [])](#csd/4) Plot the cross-spectral density [delaxes(opts \\ [])](#delaxes/1) Remove an axes from the current figure. If *ax* doesn’t exist, an error will be raised [draw()](#draw/0) Redraw the current figure [errorbar(x, y, opts \\ [yerr: nil, xerr: nil, fmt: "", ecolor: nil, elinewidth: nil, capsize: nil, barsabove: false, lolims: false, uplims: false, xlolims: false, xuplims: false, errorevery: 1, capthick: nil, hold: nil, data: nil], kwargs \\ [])](#errorbar/4) Plot an errorbar graph [eventplot(positions, opts \\ [orientation: :horizontal, lineoffsets: 1, linelengths: 1, linewidths: nil, colors: nil, linestyles: :solid, hold: nil, data: nil], kwargs \\ [])](#eventplot/3) Plot identical parallel lines at specific positions [figimage(opts \\ [], kwargs \\ [])](#figimage/2) Adds a non-resampled image to the figure [figlegend(handles, labels, loc, kwargs \\ [])](#figlegend/4) Place a legend in the figure [fignum\_exists(num)](#fignum_exists/1) [figtext(opts \\ [], kwargs \\ [])](#figtext/2) Add text to figure [figure(opts \\ [num: nil, figsize: nil, dpi: nil, facecolor: nil, edgecolor: nil, frameon: true], kwargs \\ [])](#figure/2) Creates a new figure [fill(opts \\ [], kwargs \\ [])](#fill/2) Plot filled polygons [fill\_between\_horizontal(y, x1, opts \\ [x2: 0, where: nil, step: nil, hold: nil, data: nil], kwargs \\ [])](#fill_between_horizontal/4) Make filled polygons between two horizontal curves [fill\_between\_vertical(x, y1, opts \\ [y2: 0, where: nil, interpolate: false, step: nil, hold: nil, data: nil], kwargs \\ [])](#fill_between_vertical/4) Make filled polygons between two curves [findobj(opts \\ [o: nil, match: nil, include\_self: true])](#findobj/1) Find artist objects [flag()](#flag/0) Set the default colormap to flag and apply to current image if any [gca(kwargs \\ [])](#gca/1) Get the current Axes instance on the current figure matching the given keyword args, or create one [gcf()](#gcf/0) Get a reference to the current figure [gci()](#gci/0) Get the current colorable artist. Specifically, returns the current ScalarMappable instance (image or patch collection), or β€œNothing” if no images or patch collections have been defined. The commands imshow() and figimage() create Image instances, and the commands pcolor() and scatter() create Collection instances. The current image is an attribute of the current axes, or the nearest earlier axes in the current figure that contains an image [get\_current\_fig\_manager()](#get_current_fig_manager/0) [get\_figlabels()](#get_figlabels/0) Return a list of existing figure labels [get\_fignums()](#get_fignums/0) Return a list of existing figure numbers [get\_plot\_commands()](#get_plot_commands/0) Get a sorted list of all of the plotting commands [ginput(opts \\ [], kwargs \\ [])](#ginput/2) This will wait for *n* clicks from the user and return a list of the coordinates of each click [gray()](#gray/0) Set the default colormap to gray and apply to current image if any [grid(opts \\ [b: nil, which: :major, axis: :both], kwargs \\ [])](#grid/2) Turn the axes grids on or off [hexbin(x, y, opts \\ [c: nil, gridsize: 100, bins: nil, xscale: :linear, yscale: :linear, extent: nil, cmap: nil, norm: nil, vmin: nil, vmax: nil, alpha: nil, linewidths: nil, edgecolors: :none, mincnt: nil, marginals: false, hold: nil, data: nil], kwargs \\ [])](#hexbin/4) Make a hexagonal binning plot [hist(x, opts \\ [bins: nil, range: nil, normed: false, weights: nil, cumulative: false, bottom: nil, histtype: :bar, align: :mid, orientation: :vertical, rwidth: nil, log: false, color: nil, label: nil, stacked: false, hold: nil, data: nil], kwargs \\ [])](#hist/3) Plot a histogram [hist2d(x, y, opts \\ [bins: 10, range: nil, normed: false, weights: nil, cmin: nil, cmax: nil, hold: nil, data: nil], kwargs \\ [])](#hist2d/4) Make a 2D histogram plot [hlines(y, xmin, xmax, opts \\ [colors: :k, linestyles: :solid, label: "", hold: nil, data: nil], kwargs \\ [])](#hlines/5) Plot horizontal lines at each *y* from *xmin* to *xmax* [hot()](#hot/0) Set the default colormap to hot and apply to current image if any [hsv()](#hsv/0) Set the default colormap to hsv and apply to current image if any [imread(opts \\ [], kwargs \\ [])](#imread/2) Read an image from a file into an array [imsave(opts \\ [], kwargs \\ [])](#imsave/2) Save an array as an image file [imshow(x, opts \\ [cmap: nil, norm: nil, aspect: nil, interpolation: nil, alpha: nil, vmin: nil, vmax: nil, origin: nil, extent: nil, shape: nil, filternorm: 1, filterrad: 4.0, imlim: nil, resample: nil, url: nil, hold: nil, data: nil], kwargs \\ [])](#imshow/3) Display an image on the axes [inferno()](#inferno/0) Set the default colormap to inferno and apply to current image if any [ioff()](#ioff/0) Turn interactive mode off [ion()](#ion/0) Turn interactive mode on [isinteractive()](#isinteractive/0) Return status of interactive mode [jet()](#jet/0) Set the default coormap to jet and apply to current image if any [legend(opts \\ [], kwargs \\ [])](#legend/2) Places a legend on the axes [locator\_params(opts \\ [axis: :both, tight: nil], kwargs \\ [])](#locator_params/2) Control behavior of tick locators [loglog(opts \\ [], kwargs \\ [])](#loglog/2) Make a plot with log scaling on both the *x* and *y* axis [magma()](#magma/0) Set the default colormap to magma and apply to current image if any [magnitude\_spectrum(x, opts \\ [\_Fs: nil, \_Fc: nil, window: nil, pad\_to: nil, sides: nil, scale: nil, hold: nil, data: nil], kwargs \\ [])](#magnitude_spectrum/3) Plot the magnitude spectrum [margins(opts \\ [], kwargs \\ [])](#margins/2) Set or retrieve autoscaling margins [matshow(a, opts \\ [fignum: nil], kwargs \\ [])](#matshow/3) Display an array as a matrix in a new figure window [minorticks\_off()](#minorticks_off/0) Remove minor ticks from the current plot [nipy\_spectral()](#nipy_spectral/0) Set the default colormap to nipy\_spectral and apply to current image if any [pause(interval)](#pause/1) Pause for *interval* seconds [pcolor(opts \\ [], kwargs \\ [])](#pcolor/2) Create a pseudocolor plot of a 2-D array [pcolormesh(opts \\ [], kwargs \\ [])](#pcolormesh/2) Plot a quadrilateral mesh [phase\_spectrum(x, opts \\ [\_Fs: nil, \_Fc: nil, window: nil, pad\_to: nil, sides: nil, hold: nil, data: nil], kwargs \\ [])](#phase_spectrum/3) Plot the phase spectrum [pie(x, opts \\ [explode: nil, labels: nil, colors: nil, autopct: nil, pctdistance: 0.6, shadow: false, labeldistance: 1.1, startangle: nil, radius: nil, counterclock: true, wedgeprops: nil, textprops: nil, center: {0, 0}, frame: false, hold: nil, data: nil])](#pie/2) Plot a pie chart [pink()](#pink/0) Set the default colormap to pink and apply to current image if any [plasma()](#plasma/0) Set the default colormap to plasma and apply to current image if any [plot(opts \\ [], kwargs \\ [])](#plot/2) Plot lines and/or markers to the Axes. *args* is a variable length argument, allowing for multiple *x, y* pairs with an optional format string [plot\_date(x, y, opts \\ [fmt: :o, tz: nil, xdate: true, ydate: false, hold: nil, data: nil], kwargs \\ [])](#plot_date/4) A plot with data that contains dates [plotfile(fname, opts \\ [cols: {0}, plotfuncs: nil, comments: "#", skiprows: 0, checkrows: 5, delimiter: ",", names: nil, subplots: true, newfig: true], kwargs \\ [])](#plotfile/3) Plot the data in a file [polar(opts \\ [], kwargs \\ [])](#polar/2) make a polar plot [prism()](#prism/0) Set the default colormap to prism and apply to current image if any [psd(x, opts \\ [nfft: nil, \_Fs: nil, \_Fc: nil, detrend: nil, window: nil, noverlap: nil, pad\_to: nil, sides: nil, scale\_by\_freq: nil, return\_line: nil, hold: nil, data: nil], kwargs \\ [])](#psd/3) Plot the power spectral density [quiver(opts \\ [], kwargs \\ [])](#quiver/2) Plot a 2-D field of arrows [quiverkey(opts \\ [], kwargs \\ [])](#quiverkey/2) Add a key to a quiver plot [rc(opts \\ [], kwargs \\ [])](#rc/2) Set the current rc params. Group is the grouping for the rc [rcdefaults()](#rcdefaults/0) Restore the default rc params. These are not the params loaded by the rc file, but mpl’s internal params. See rc\_file\_defaults for reloading the default params from the rc file [rgrids(opts \\ [], kwargs \\ [])](#rgrids/2) Get or set the radial gridlines on a polar plot [savefig(opts \\ [], kwargs \\ [])](#savefig/2) Save the current figure [scatter(x, y, opts \\ [s: nil, c: nil, marker: nil, cmap: nil, norm: nil, vmin: nil, vmax: nil, alpha: nil, linewidths: nil, verts: nil, edgecolors: nil, hold: nil, data: nil], kwargs \\ [])](#scatter/4) Make a scatter plot of x vs y [semilogx(opts \\ [], kwargs \\ [])](#semilogx/2) Make a plot with log scaling on the x axis [semilogy(opts \\ [], kwargs \\ [])](#semilogy/2) Make a plot with log scaling on the y axis [set\_cmap(cmap)](#set_cmap/1) Set the default colormap. Applies to the current image if any [show(opts \\ [], kwargs \\ [])](#show/2) Display a figure [specgram(x, opts \\ [nfft: nil, \_Fs: nil, \_Fc: nil, detrend: nil, window: nil, noverlap: nil, cmap: nil, xextent: nil, pad\_to: nil, sides: nil, scale\_by\_freq: nil, mode: nil, scale: nil, vmin: nil, vmax: nil, hold: nil, data: nil], kwargs \\ [])](#specgram/3) Plot a spectrogram [spectral()](#spectral/0) Set the default colormap to spectral and apply to current image if any [spring()](#spring/0) Set the default colormap to spring and apply to current image if any [spy(z, opts \\ [precision: 0, marker: nil, markersize: nil, aspect: :equal], kwargs \\ [])](#spy/3) Plot the sparsity pattern on a 2-D array [stackplot(x, opts \\ [], kwargs \\ [])](#stackplot/3) Draws a stacked area plot [stem(opts \\ [], kwargs \\ [])](#stem/2) Create a stem plot [step(x, y, opts \\ [], kwargs \\ [])](#step/4) Make a step plot [streamplot(x, y, u, v, opts \\ [density: 1, linewidth: nil, color: nil, cmap: nil, norm: nil, arrowsize: 1, arrowstyle: "-|>", minlength: 0.1, transform: nil, zorder: nil, start\_points: nil, hold: nil, data: nil])](#streamplot/5) Draws streamlinkes of a vector flow [subplot(opts \\ [], kwargs \\ [])](#subplot/2) Return a subplot axes positioned by the given grid definition [subplot2grid(shape, loc, opts \\ [rowspan: 1, colspan: 1], kwargs \\ [])](#subplot2grid/4) Create a subplot in a grid. The grid is specified by *shape*, at location of *loc*, spanning *rowspan, colspan* cells in each direction. The index for loc is 0-based [subplot\_tool(opts \\ [targetfig: nil], kwargs \\ [])](#subplot_tool/2) Launch a subplot tool window for a figure [subplots(opts \\ [nrows: 1, ncols: 1, sharex: false, sharey: false, squeeze: true, subplot\_kw: nil, gridspec\_kw: nil], kwargs \\ [])](#subplots/2) Create a figure and a set of subplots [subplots\_adjust(opts \\ [], kwargs \\ [])](#subplots_adjust/2) Tune the subplot layout [summer()](#summer/0) Set the default colormap to summer and apply to current image if any [suptitle(opts \\ [], kwargs \\ [])](#suptitle/2) Add a centered title to the figure [table(kwargs \\ [])](#table/1) Add a table to the current axes [text(x, y, s, opts \\ [fontdict: nil, withdash: false], kwargs \\ [])](#text/5) Add text to the axes [thetagrids(opts \\ [], kwargs \\ [])](#thetagrids/2) Get or set the theta locations of the gridlines in a polar plot [tick\_parameters(opts \\ [axis: :both], kwargs \\ [])](#tick_parameters/2) Change the appearance of ticks and tick labels [ticklabel\_format(kwargs \\ [])](#ticklabel_format/1) Change the ScalarFormatter used by default for linear axes [tight\_layout(opts \\ [pad: 1.08, h\_pad: nil, w\_pad: nil, rect: nil])](#tight_layout/1) Automatically adjust subplot parameters to give specified padding [title(s, opts \\ [], kwargs \\ [])](#title/3) Set a title of the current axes [tricontour(opts \\ [], kwargs \\ [])](#tricontour/2) Draw contours on an unstructured triangular grid tricontour() and tricontourf() draw contour lines and filled contours, respectively [tricontourf(opts \\ [], kwargs \\ [])](#tricontourf/2) Draw contours on an unstructured triangular grid tricontour() and tricontourf() draw contour lines and filled contours, respectively [tripcolor(opts \\ [], kwargs \\ [])](#tripcolor/2) Create a pseudocolor plot of an unstructured triangular grid [triplot(opts \\ [], kwargs \\ [])](#triplot/2) Draw an unstructured triangular grid as lines and/or markers [twinx(opts \\ [ax: nil])](#twinx/1) Make a second axes that shares the *x*-axis. The new axes will overlay *ax* (or the current axes if *ax* is nil). The ticks for *ax2* will be placed on the right, and the *ax2* instance is returned [twiny(opts \\ [ax: nil])](#twiny/1) Make a second axes that shares the *y*-axis. The new axis will overlay *ax* (or the current axes if *ax* is nil). The ticks for *ax2* will be placed on the top, and the *ax2* instance is returned [uninstall\_repl\_displayhook()](#uninstall_repl_displayhook/0) Uninstalls the matplotlib display hook [violinplot(dataset, opts \\ [positions: nil, vert: true, widths: 0.5, showmeans: false, showextrema: true, showmedians: false, points: 100, bw\_method: nil, hold: nil, data: nil])](#violinplot/2) Make a violin plot [viridis()](#viridis/0) Set the default colormap to viridis and apply to current image if any [vlines(x, ymin, ymax, opts \\ [colors: :k, linestyles: :solid, label: "", hold: nil, data: nil], kwargs \\ [])](#vlines/5) Plot vertical lines [waitforbuttonpress(opts \\ [], kwargs \\ [])](#waitforbuttonpress/2) Blocking call to interact with the figure [winter()](#winter/0) Set the default colormap to winter and apply to current image if any [xcorr(x, y, opts \\ [normed: true, usevlines: true, maxlags: 10, hold: nil, data: nil], kwargs \\ [])](#xcorr/4) Plot the cross correlation between *x* and *y* [xkcd(opts \\ [scaled: 1, length: 100, randomness: 2], kwargs \\ [])](#xkcd/2) Turns xkcd sketch-style drawing mode. This will only have effect on things drawn after this function is called [xlabel(s, opts \\ [], kwargs \\ [])](#xlabel/3) Set the x axis label of the current axis [xlim(opts \\ [], kwargs \\ [])](#xlim/2) Get or set the *x* limits of the current axes [xscale(opts \\ [], kwargs \\ [])](#xscale/2) Set the scaling of the x-axis [xticks(opts \\ [], kwargs \\ [])](#xticks/2) Get or set the x-limits of the current tick locations and labels [ylabel(s, opts \\ [], kwargs \\ [])](#ylabel/3) Set the y-axis label of the current axis [ylim(opts \\ [], kwargs \\ [])](#ylim/2) Get or set the y-limits of the current axes [yscale(opts \\ [], kwargs \\ [])](#yscale/2) Set the scaling of the y-axis [yticks(opts \\ [], kwargs \\ [])](#yticks/2) Get or set the y-limits of the current tick locations and labels Functions ============ acorr(x, opts \\ [hold: nil, data: nil], kwargs \\ []) Plot the autocorrelation of x. angle\_spectrum(x, opts \\ [\_Fs: 2, \_Fc: 0, pad\_to: nil, sides: :default], kwargs \\ []) Plot the angle spectrum. Compute the angle spectrum (wrapped phase spectrum) of x. Data is padded to a length of pad\_to and the windowing function *window* **Not used yet in Expyplot** is applied to the signal. Example call: ``` 1..1_000_000 |> Enum.to_list |> Expyplot.Plot.angle_spectrum(x, [_Fs: 2, _Fc: 0, pad_to: nil, sides: "default"]) ``` annotate(opts \\ [], kwargs \\ []) Annotate the point xy with text s. Additional kwargs are passed to Text. arrow(x, y, dx, dy, opts \\ [hold: nil], kwargs \\ []) Add an arrow to the axes. Draws arrow on specified axis from (x, y) to (x + dx, y + dy). Uses FancyArrow patch to construct the arrow. autoscale(opts \\ [enable: true, axis: :both, tight: nil]) Autoscale the axis view to the data (toggle). Convenience method for simple axis view autoscaling. It turns autoscaling on or off, and then, if autoscaling for either axis is on, it performs the autoscaling on the specified axis or axes. autumn() Set the default colormap to autumn and apply to current image if any. See help(colormaps) for more information axes(opts \\ [], kwargs \\ []) Add an axes to the figure. The axes is added at position rect specified by: * axes() by itself creates a default full subplot(111) window axis. * axes(rect, [facecolor: :w]), where rect = [left, bottom, width, height] in normalized (0, 1) units. facecolor is the background color for the axis, default white. * axes(h) where h is an axes instance makes h the current axis. axhline(opts \\ [y: 0, xmin: 0, xmax: 1, hold: nil], kwargs \\ []) Add a horizontal line across the axis. Typical calls: ``` Expyplot.Plot.axhline(linewidth: 4, color: :r) # Draw a thick red hline at 'y'=0 that spans the xrange Expyplot.Plot.axhline(y: 1) # Draw a default hline at 'y'=1 that spans the xrange Expyplot.Plot.axhline(y: 0.5, xmin: 0.25, xmax: 0.75) # Draw a default hline at 'y'=0.5 that spans the middle half of the xrange ``` axhspan(ymin, ymax, opts \\ [xmin: 0, xmax: 1, hold: nil], kwargs \\ []) Add a horizontal span (rectangle) across the axis. Draw a horizontal span (rectangle) from ymin to ymax. With the default values of xmin = 0 and xmax = 1, this always spans the xrange, regardless of the xlim settings, even if you change them, e.g., with the set\_xlim() command. That is, the horizontal extent is in axes coords: 0=left, 0.5=middle, 1.0=right but the y location is in data coordinates. axis\_get(kwargs \\ []) **This is how *axis* has been implemented in this library: as two functions - a get and a set, rather than just the one**Convenience method to get or set axis properties. This function is of limited usefulness at this stage, as it simply returns the string representation of the current axis. ``` iex> Expyplot.Plot.axis_get() "(0.0, 1.0, 0.0, 1.0)" ``` axis\_set(v, kwargs \\ []) **This is how *axis* has been implemented in this library: as two functions - a get and a set, rather than just the one**Convenience method to get or set axis properties. Some examples: -------------- ``` iex> Expyplot.Plot.axis_set("off") # Turn off the axis lines and labels "(0.0, 1.0, 0.0, 1.0)" iex> Expyplot.Plot.axis_set("equal") # Changes limits of x and y axis so that equal increments of x and y have the same length "(-0.055, 0.055, -0.055, 0.055)" ``` axvline(opts \\ [x: 0, ymin: 0, ymax: 1, hold: nil], kwargs \\ []) Add a vertical line across the axes. Examples -------- * Draw a thick read vline at *x* = 0 that spans the yrange: ``` Expyplot.Plot.axvline(linewidth: 4, color: :r) ``` * Draw a default vline at *x* = 1 that spans the yrange: ``` Expyplot.Plot.axvline(x: 1) ``` * Draw a default vline at *x* = 0.5 that spans the middle half of the yrange ``` Expyplot.Plot.axvline(x: 0.5, ymin: 0.25, ymax: 0.75) ``` axvspan(xmin, xmax, opts \\ [ymin: 0, ymax: 1, hold: nil], kwargs \\ []) Add a vertical span (rectangle) across the axes. Draw a vertical span (rectangle) from xmin to xmax. With the default values of ymin = 0 and ymax = 1. This always spans the yrange, regardless of the ylim settings, even if you change them, e.g., with the set\_ylim() command. That is, the vertical extent is in axes coords: 0=bottom, 0.5=middle, 1.0=top but the y location is in data coordinates. Examples -------- Draw a vertical, green, translucent rectangle from x = 1.25 to x = 1.55 that spans the yrange of the axes. ``` iex> Expyplot.Plot.axvspan(1.25, 1.55, facecolor: :g, alpha: 0.5) ``` bar(left, height, opts \\ [width: 0.8, bottom: nil, hold: nil, data: nil], kwargs \\ []) Make a bar plot. Make a bar plot with rectangles bounded by: *left*, *left + width*, *bottom*, *bottom + height* (left, right, bottom and top edges). barbs(opts \\ [], kwargs \\ []) Plot a 2-D field of barbs. barh(bottom, width, opts \\ [height: 0.8, left: nil, hold: nil], kwargs \\ []) Make a horizontal bar plot. Make a horizontal bar plot with rectangles bounded by: *left*, *left + width*, *bottom*, *bottom + height* (lft, right, bottom and top edges). *bottom, width, height*, and *left* can be either scalars or sequences bone() Set the default colormap to bone and apply to current image if any. boxplot(x, opts \\ [notch: nil, sym: nil, vert: nil, whis: nil, positions: nil, widths: nil, patch\_artist: nil, bootstrap: nil, usermedians: nil, conf\_intervals: nil, meanline: nil, showmeans: nil, showcaps: nil, showbox: nil, showfliers: nil, boxprops: nil, labels: nil, flierprops: nil, medianprops: nil, meanprops: nil, capprops: nil, whiskerprops: nil, manage\_xticks: true, autorange: false, zorder: nil, hold: nil, data: nil]) Make a box and whisker plot. Make a box and whisker plot for each column of *x* or each vector in sequence *x*. The box extends from the lower to upper quartile values of the data, with a line at the median. The whiskers extend from the box to show the range of the data. Flier points are those past the end of the whiskers. broken\_barh(xranges, yrange, opts \\ [hold: nil, data: nil], kwargs \\ []) Plot horizontal bars. A collection of horizontal bars spanning *yrange* with a sequence of *xranges*. cla() Clear the current axes. clabel(cs, opts \\ [], kwargs \\ []) Label a contour plot. clf() Clear the current figure. clim(opts \\ [vmin: nil, vmax: nil]) Set the color limits of the current image. To apply clim to all axes images do: ``` clim(vmin: 0, vmax: 0.5) ``` If either *vmin* or *vmax* is nil, the image min/max respectively will be used for color scaling. close(opts \\ []) Close a figure window. *close()* by itself closes the current figure*close(num)* closes figure number *num**close(name)* where *name* is a string, closes figure with that label*close(:all)* closes all the figure windows cohere(x, y, opts \\ [nfft: 256, \_Fs: 2, \_Fc: 0, noverlap: 0, pad\_to: nil, sides: :default, scale\_by\_freq: nil, hold: nil, data: nil], kwargs \\ []) Plot the coherence between *x* and *y*. Plot the coherence between *x* and *y*. Coherence is the normalized cross spectral density. colorbar(opts \\ [mappable: nil, cax: nil, ax: nil], kwargs \\ []) Add a colorbar to a plot. colors() This is a do-nothing function to provide you with help on how matplotlib handles colors. contour(opts \\ [], kwargs \\ []) Plot contours. contour() and contourf() draw contour lines and filled contours, respectively. Except as noted, function signatures and return values are the same for both versions. contourf() differs from the MATLAB version in that it does not draw the polygon edges. To draw edges, add line contours with calls to contour(). contourf(opts \\ [], kwargs \\ []) Plot contours. contour() and contourf() draw contour lines and filled contours, respectively. Except as noted, function signatures and return values are the same for both versions. contourf() differs from the MATLAB version in that it does not draw the polygon edges. To draw edges, add line contours with calls to contour(). cool() Set the default colormap to cool and apply to current image if any. copper() Set the default colormap to copper and apply to current image if any. csd(x, y, opts \\ [nfft: 256, \_Fs: 2, \_Fc: 0, noverlap: 0, pad\_to: nil, sides: :default, scale\_by\_freq: nil, return\_line: nil], kwargs \\ []) Plot the cross-spectral density. delaxes(opts \\ []) Remove an axes from the current figure. If *ax* doesn’t exist, an error will be raised. draw() Redraw the current figure. This is used to update a figure that has been altered, but not automatically re-drawn. If interactive mode is on (ion()), this should be only rarely needed, but there may be ways to modify the state of a figure without marking it as *stale*. errorbar(x, y, opts \\ [yerr: nil, xerr: nil, fmt: "", ecolor: nil, elinewidth: nil, capsize: nil, barsabove: false, lolims: false, uplims: false, xlolims: false, xuplims: false, errorevery: 1, capthick: nil, hold: nil, data: nil], kwargs \\ []) Plot an errorbar graph. Plot x versus y with error deltas in yerr and xerr. Vertical errorbars are plotted if yerr is not nil. Horizontal errorbars are plotted if xerr is not nil. x, y, xerr, and yerr can all be scalars, which plots a single error bar at x, y. eventplot(positions, opts \\ [orientation: :horizontal, lineoffsets: 1, linelengths: 1, linewidths: nil, colors: nil, linestyles: :solid, hold: nil, data: nil], kwargs \\ []) Plot identical parallel lines at specific positions. Plot parallel lines at the given *positions*. *positions* should be a 1D or 2D array-like object, with each row corresponding to a row or column of lines. This type of plot is commonly used in neuroscience for representing neural events, where it is commonly called a spike raster, dot raster, or raster plot. However, it is useful in any situation where you wish to show the timing or position of multiple sets of discrete events, such as the arrival times of people to a business on each day of the month or the date of hurricanes each year of the last century. figimage(opts \\ [], kwargs \\ []) Adds a non-resampled image to the figure. figlegend(handles, labels, loc, kwargs \\ []) Place a legend in the figure. fignum\_exists(num) figtext(opts \\ [], kwargs \\ []) Add text to figure. Add text to figure at location *x, y* (relative 0-1 coords). figure(opts \\ [num: nil, figsize: nil, dpi: nil, facecolor: nil, edgecolor: nil, frameon: true], kwargs \\ []) Creates a new figure. fill(opts \\ [], kwargs \\ []) Plot filled polygons. fill\_between\_horizontal(y, x1, opts \\ [x2: 0, where: nil, step: nil, hold: nil, data: nil], kwargs \\ []) Make filled polygons between two horizontal curves. fill\_between\_vertical(x, y1, opts \\ [y2: 0, where: nil, interpolate: false, step: nil, hold: nil, data: nil], kwargs \\ []) Make filled polygons between two curves. findobj(opts \\ [o: nil, match: nil, include\_self: true]) Find artist objects. Recursively find all Artist instances contained in self. flag() Set the default colormap to flag and apply to current image if any. gca(kwargs \\ []) Get the current Axes instance on the current figure matching the given keyword args, or create one. gcf() Get a reference to the current figure. gci() Get the current colorable artist. Specifically, returns the current ScalarMappable instance (image or patch collection), or β€œNothing” if no images or patch collections have been defined. The commands imshow() and figimage() create Image instances, and the commands pcolor() and scatter() create Collection instances. The current image is an attribute of the current axes, or the nearest earlier axes in the current figure that contains an image. get\_current\_fig\_manager() get\_figlabels() Return a list of existing figure labels. get\_fignums() Return a list of existing figure numbers. get\_plot\_commands() Get a sorted list of all of the plotting commands. ginput(opts \\ [], kwargs \\ []) This will wait for *n* clicks from the user and return a list of the coordinates of each click. If *timeout* is zero or negative, does not timeout. If *n* is zero or negative, accumulated clicks until a middle click (or potentially both mouse buttons at once) terminates the input. Right clicking cancels last input. The buttons used for the various actions (adding points, removing points, terminating the inputs) can be overriden via the arguments *mouse\_add, mouse\_pop* and *mouse\_stop*, that give the associated mouse button: 1 for left, 2 for middle, 3 for right.The keyboard can also be used to select points in case your mouse does not have one or more of the buttons. The delete and backspace keys act like right clicking (i.e., remove last point), the enter key terminates input and any other key (not already used by the window manager) selects a point. gray() Set the default colormap to gray and apply to current image if any. grid(opts \\ [b: nil, which: :major, axis: :both], kwargs \\ []) Turn the axes grids on or off. Set the axes grids on or off; *b* is a boolean. (For MATLAB compatibility, *b* may also be an atom :on or :off.) hexbin(x, y, opts \\ [c: nil, gridsize: 100, bins: nil, xscale: :linear, yscale: :linear, extent: nil, cmap: nil, norm: nil, vmin: nil, vmax: nil, alpha: nil, linewidths: nil, edgecolors: :none, mincnt: nil, marginals: false, hold: nil, data: nil], kwargs \\ []) Make a hexagonal binning plot. Make a hexagonal binning plot of *x* versus *y*, where *x, y* are 1-D sequences of the same length, *N*. If *C* is nil (the default), this is a histogram of the number of occurrences of the observations at (x[i], y[i]). If *C* is specified, it specifies values at the coordinate (x[i], y[i]). These values are accumulated for each hexagonal bin and then reduced according to *reduce\_C\_function*, which defaults to numpy’s mean function (np.mean). (If *C* is specified, it must also be a 1-D sequence of the same length as *x* and *y*.) hist(x, opts \\ [bins: nil, range: nil, normed: false, weights: nil, cumulative: false, bottom: nil, histtype: :bar, align: :mid, orientation: :vertical, rwidth: nil, log: false, color: nil, label: nil, stacked: false, hold: nil, data: nil], kwargs \\ []) Plot a histogram. Compute and draw the histogram of *x*. The return value is a tuple (*n, bins, patches*) or (*[n0, n1, ...], bins, [patches0, patches1, ...]*) if the input contains multiple data. Multiple data can be provided via *x* as a list of datasets of potentially different length, or as a 2-D ndarray in which each column is a dataset. Note that the ndarray form is transposed relative to the list form. Masked arrays are not supported at present. hist2d(x, y, opts \\ [bins: 10, range: nil, normed: false, weights: nil, cmin: nil, cmax: nil, hold: nil, data: nil], kwargs \\ []) Make a 2D histogram plot. hlines(y, xmin, xmax, opts \\ [colors: :k, linestyles: :solid, label: "", hold: nil, data: nil], kwargs \\ []) Plot horizontal lines at each *y* from *xmin* to *xmax*. hot() Set the default colormap to hot and apply to current image if any. hsv() Set the default colormap to hsv and apply to current image if any. imread(opts \\ [], kwargs \\ []) Read an image from a file into an array. *fname* may be a string path, or a valid URL.If *format* is provided, will try to read file of that type, otherwise the format is deduced from the filename. If nothing can be deduced, PNG is tried. Return value is a numpy.array **But in expyplot, this will return a string, and it probably won’t work**. For grayscale images, the return array is MxN. For RGB images, the return value is MxNx4. matplotlib can only read PNGs natively, but if PIL is installed, it will use it to load the image and return an array (if possible) which can be used with imshow(). Note, URL strings may not be compatible with PIL. Check the PIL documentation for more information. imsave(opts \\ [], kwargs \\ []) Save an array as an image file. The output formats available depend on the backend being used. imshow(x, opts \\ [cmap: nil, norm: nil, aspect: nil, interpolation: nil, alpha: nil, vmin: nil, vmax: nil, origin: nil, extent: nil, shape: nil, filternorm: 1, filterrad: 4.0, imlim: nil, resample: nil, url: nil, hold: nil, data: nil], kwargs \\ []) Display an image on the axes. inferno() Set the default colormap to inferno and apply to current image if any. ioff() Turn interactive mode off. ion() Turn interactive mode on. isinteractive() Return status of interactive mode. jet() Set the default coormap to jet and apply to current image if any. legend(opts \\ [], kwargs \\ []) Places a legend on the axes. locator\_params(opts \\ [axis: :both, tight: nil], kwargs \\ []) Control behavior of tick locators. loglog(opts \\ [], kwargs \\ []) Make a plot with log scaling on both the *x* and *y* axis. loglog() supports all the keyword arguments of plot() and matplotlib.axes.Axes.set\_xscale() / matplotlib.axes.Axes.set\_yscale(). magma() Set the default colormap to magma and apply to current image if any. magnitude\_spectrum(x, opts \\ [\_Fs: nil, \_Fc: nil, window: nil, pad\_to: nil, sides: nil, scale: nil, hold: nil, data: nil], kwargs \\ []) Plot the magnitude spectrum. margins(opts \\ [], kwargs \\ []) Set or retrieve autoscaling margins. matshow(a, opts \\ [fignum: nil], kwargs \\ []) Display an array as a matrix in a new figure window. The origin is set at the upper left hand corner and rows (first dimension of the array) are displayed horizontally. The aspect ratio of the figure window is that of the array, unless this would make an excessively short or narrow figure. Tick labels for the xaxis are placed on top. minorticks\_off() Remove minor ticks from the current plot. nipy\_spectral() Set the default colormap to nipy\_spectral and apply to current image if any. pause(interval) Pause for *interval* seconds. If there is an active figure it will be updated and displayed, and the GUI event loop will run during the pause. If there is no active figure, or if a non-interactive backend is in use, this executes time.sleep(interval). This can be used for crude animation. pcolor(opts \\ [], kwargs \\ []) Create a pseudocolor plot of a 2-D array. pcolormesh(opts \\ [], kwargs \\ []) Plot a quadrilateral mesh. phase\_spectrum(x, opts \\ [\_Fs: nil, \_Fc: nil, window: nil, pad\_to: nil, sides: nil, hold: nil, data: nil], kwargs \\ []) Plot the phase spectrum. pie(x, opts \\ [explode: nil, labels: nil, colors: nil, autopct: nil, pctdistance: 0.6, shadow: false, labeldistance: 1.1, startangle: nil, radius: nil, counterclock: true, wedgeprops: nil, textprops: nil, center: {0, 0}, frame: false, hold: nil, data: nil]) Plot a pie chart. Make a pie chart of array x. The fractional area of each wedge is given by x / sum(x). If sum(x) <= 1, then the values of x give the fractional area directly and the array will not be normalized. The wedges are plotted counterclockwise, by default starting from the x-axis. pink() Set the default colormap to pink and apply to current image if any. plasma() Set the default colormap to plasma and apply to current image if any. plot(opts \\ [], kwargs \\ []) Plot lines and/or markers to the Axes. *args* is a variable length argument, allowing for multiple *x, y* pairs with an optional format string. Each of the following is legal: ``` x = 1..10 |> Enum.to_list y = 11..20 |> Enum.to_list Expyplot.Plot.plot([x, y]) # plot x and y using default line style and color Expyplot.Plot.plot([x, y, "bo"]) # plot x and y using blue circle markers Expyplot.Plot.plot([y]) # plot y using x as index array 0..N-1 Expyplot.Plot.plot([y, "r+"]) # ditto, but with red plusses x2 = 1..5 |> Enum.to_list y2 = 3..7 |> Enum.to_list Expyplot.Plot.plot([x, y, "g^", x2, y2, "g-"]) ``` Due to the differences between function signatures in Python and Elixir, the typical usage of this function is a little different than what you would expect: ``` iex> Expyplot.Plot.plot([[1, 2, 3, 4, 5]]) or iex> Expyplot.Plot.plot([1..5]) ``` Notice the nesting of the list or range. Examples with keyword args -------------------------- ``` Expyplot.Plot.plot([[1, 2, 3], [1, 2, 3], "go-"], label: "line 1", linewidth: 2) Expyplot.Plot.plot([[1, 2, 3], [1, 4, 9], "rs"], label: "line 2") Expyplot.Plot.axis_set([0, 4, 0, 10]) # Notice that this signature is 'axis_set', not 'axis' as in matplotlib Expyplot.Plot.legend() ``` plot\_date(x, y, opts \\ [fmt: :o, tz: nil, xdate: true, ydate: false, hold: nil, data: nil], kwargs \\ []) A plot with data that contains dates. plotfile(fname, opts \\ [cols: {0}, plotfuncs: nil, comments: "#", skiprows: 0, checkrows: 5, delimiter: ",", names: nil, subplots: true, newfig: true], kwargs \\ []) Plot the data in a file. polar(opts \\ [], kwargs \\ []) make a polar plot. prism() Set the default colormap to prism and apply to current image if any. psd(x, opts \\ [nfft: nil, \_Fs: nil, \_Fc: nil, detrend: nil, window: nil, noverlap: nil, pad\_to: nil, sides: nil, scale\_by\_freq: nil, return\_line: nil, hold: nil, data: nil], kwargs \\ []) Plot the power spectral density. quiver(opts \\ [], kwargs \\ []) Plot a 2-D field of arrows. quiverkey(opts \\ [], kwargs \\ []) Add a key to a quiver plot. rc(opts \\ [], kwargs \\ []) Set the current rc params. Group is the grouping for the rc. rcdefaults() Restore the default rc params. These are not the params loaded by the rc file, but mpl’s internal params. See rc\_file\_defaults for reloading the default params from the rc file. rgrids(opts \\ [], kwargs \\ []) Get or set the radial gridlines on a polar plot. savefig(opts \\ [], kwargs \\ []) Save the current figure. scatter(x, y, opts \\ [s: nil, c: nil, marker: nil, cmap: nil, norm: nil, vmin: nil, vmax: nil, alpha: nil, linewidths: nil, verts: nil, edgecolors: nil, hold: nil, data: nil], kwargs \\ []) Make a scatter plot of x vs y. Marker size is scaled by s and marker color is mapped to c. semilogx(opts \\ [], kwargs \\ []) Make a plot with log scaling on the x axis. semilogy(opts \\ [], kwargs \\ []) Make a plot with log scaling on the y axis. set\_cmap(cmap) Set the default colormap. Applies to the current image if any. *cmap* must be the name of a registered colormap. show(opts \\ [], kwargs \\ []) Display a figure. specgram(x, opts \\ [nfft: nil, \_Fs: nil, \_Fc: nil, detrend: nil, window: nil, noverlap: nil, cmap: nil, xextent: nil, pad\_to: nil, sides: nil, scale\_by\_freq: nil, mode: nil, scale: nil, vmin: nil, vmax: nil, hold: nil, data: nil], kwargs \\ []) Plot a spectrogram. spectral() Set the default colormap to spectral and apply to current image if any. spring() Set the default colormap to spring and apply to current image if any. spy(z, opts \\ [precision: 0, marker: nil, markersize: nil, aspect: :equal], kwargs \\ []) Plot the sparsity pattern on a 2-D array. spy(z) plots the sparsity pattern of the 2-D array *z*. stackplot(x, opts \\ [], kwargs \\ []) Draws a stacked area plot. stem(opts \\ [], kwargs \\ []) Create a stem plot. step(x, y, opts \\ [], kwargs \\ []) Make a step plot. streamplot(x, y, u, v, opts \\ [density: 1, linewidth: nil, color: nil, cmap: nil, norm: nil, arrowsize: 1, arrowstyle: "-|>", minlength: 0.1, transform: nil, zorder: nil, start\_points: nil, hold: nil, data: nil]) Draws streamlinkes of a vector flow. subplot(opts \\ [], kwargs \\ []) Return a subplot axes positioned by the given grid definition. subplot2grid(shape, loc, opts \\ [rowspan: 1, colspan: 1], kwargs \\ []) Create a subplot in a grid. The grid is specified by *shape*, at location of *loc*, spanning *rowspan, colspan* cells in each direction. The index for loc is 0-based. subplot\_tool(opts \\ [targetfig: nil], kwargs \\ []) Launch a subplot tool window for a figure. subplots(opts \\ [nrows: 1, ncols: 1, sharex: false, sharey: false, squeeze: true, subplot\_kw: nil, gridspec\_kw: nil], kwargs \\ []) Create a figure and a set of subplots. This utility wrapper makes it convenient to create common layouts of subplots, including the enclosing figure object, in a single call. subplots\_adjust(opts \\ [], kwargs \\ []) Tune the subplot layout. summer() Set the default colormap to summer and apply to current image if any. suptitle(opts \\ [], kwargs \\ []) Add a centered title to the figure. table(kwargs \\ []) Add a table to the current axes. text(x, y, s, opts \\ [fontdict: nil, withdash: false], kwargs \\ []) Add text to the axes. Add text in string *s* to axis at location *x, y* data coordinates. thetagrids(opts \\ [], kwargs \\ []) Get or set the theta locations of the gridlines in a polar plot. If no arguments are passed, return a tuple (*lines, labels*) where *lines* is an array of radial gridlines (Line2D instances) and *labels* is an array of tick labels (Text instances). tick\_parameters(opts \\ [axis: :both], kwargs \\ []) Change the appearance of ticks and tick labels. ticklabel\_format(kwargs \\ []) Change the ScalarFormatter used by default for linear axes. tight\_layout(opts \\ [pad: 1.08, h\_pad: nil, w\_pad: nil, rect: nil]) Automatically adjust subplot parameters to give specified padding. title(s, opts \\ [], kwargs \\ []) Set a title of the current axes. Set one of hte three available axes titles. The available titles are positioned above the aces in the center, flush with the left edge, and flush with the right edge. tricontour(opts \\ [], kwargs \\ []) Draw contours on an unstructured triangular grid tricontour() and tricontourf() draw contour lines and filled contours, respectively. tricontourf(opts \\ [], kwargs \\ []) Draw contours on an unstructured triangular grid tricontour() and tricontourf() draw contour lines and filled contours, respectively. tripcolor(opts \\ [], kwargs \\ []) Create a pseudocolor plot of an unstructured triangular grid. triplot(opts \\ [], kwargs \\ []) Draw an unstructured triangular grid as lines and/or markers. twinx(opts \\ [ax: nil]) Make a second axes that shares the *x*-axis. The new axes will overlay *ax* (or the current axes if *ax* is nil). The ticks for *ax2* will be placed on the right, and the *ax2* instance is returned. twiny(opts \\ [ax: nil]) Make a second axes that shares the *y*-axis. The new axis will overlay *ax* (or the current axes if *ax* is nil). The ticks for *ax2* will be placed on the top, and the *ax2* instance is returned. uninstall\_repl\_displayhook() Uninstalls the matplotlib display hook. violinplot(dataset, opts \\ [positions: nil, vert: true, widths: 0.5, showmeans: false, showextrema: true, showmedians: false, points: 100, bw\_method: nil, hold: nil, data: nil]) Make a violin plot. Make a violin plot for each column of *dataset* or each vector in sequence *dataset*. Each filled area extends to represent the entire data range, with optional lines at the mean, the median, the minimum, and the maximum. viridis() Set the default colormap to viridis and apply to current image if any. vlines(x, ymin, ymax, opts \\ [colors: :k, linestyles: :solid, label: "", hold: nil, data: nil], kwargs \\ []) Plot vertical lines. Plot vertical lines at each *x* from *ymin* to *ymax*. waitforbuttonpress(opts \\ [], kwargs \\ []) Blocking call to interact with the figure. This will return β€œTrue” if a key was pressed, β€œFalse” if a mouse button was pressed and β€œNone” if timeout was reached without either being pressed. If *timeout* is negative, does not timeout. winter() Set the default colormap to winter and apply to current image if any. xcorr(x, y, opts \\ [normed: true, usevlines: true, maxlags: 10, hold: nil, data: nil], kwargs \\ []) Plot the cross correlation between *x* and *y*. xkcd(opts \\ [scaled: 1, length: 100, randomness: 2], kwargs \\ []) Turns xkcd sketch-style drawing mode. This will only have effect on things drawn after this function is called. For best results, the β€œHumor Sans” font should be indstalled: it is not included with matplotlib. xlabel(s, opts \\ [], kwargs \\ []) Set the x axis label of the current axis. xlim(opts \\ [], kwargs \\ []) Get or set the *x* limits of the current axes. xscale(opts \\ [], kwargs \\ []) Set the scaling of the x-axis. xticks(opts \\ [], kwargs \\ []) Get or set the x-limits of the current tick locations and labels. ylabel(s, opts \\ [], kwargs \\ []) Set the y-axis label of the current axis. ylim(opts \\ [], kwargs \\ []) Get or set the y-limits of the current axes. yscale(opts \\ [], kwargs \\ []) Set the scaling of the y-axis. yticks(opts \\ [], kwargs \\ []) Get or set the y-limits of the current tick locations and labels. Codebuilder – expyplot v1.2.2 expyplot v1.2.2 Codebuilder ============================= This module holds the functions that translate Elixir function calls into Python function calls. Summary ========== [Functions](#functions) ------------------------ [build\_code(list)](#build_code/1) Functions ============ build\_code(list) Expyplot – expyplot v1.2.2 expyplot v1.2.2 Expyplot ========================== This is the supervisor that runs the application. For now, this module doesn’t really do anything else. Summary ========== [Functions](#functions) ------------------------ [start(type, args)](#start/2) Functions ============ start(type, args) Server.Commapi – expyplot v1.2.2 expyplot v1.2.2 Server.Commapi ================================ This is the API for the pycomm server. Don’t call anything in there except through here. This is also its supervisor. Summary ========== [Functions](#functions) ------------------------ [add\_code(code)](#add_code/1) [start\_link()](#start_link/0) Functions ============ add\_code(code) start\_link() Server.Pycomm – expyplot v1.2.2 expyplot v1.2.2 Server.Pycomm =============================== This module is a GenServer that manages the Python code that will be executed. The general idea is that you will call functions in the library’s API and this will usually add code here. Then when you call Expyplot.Plot.show(), it will flush the code to the Python3 interpretor, thus making the plot. Summary ========== [Functions](#functions) ------------------------ [eval\_code(pid, code)](#eval_code/2) Adds the given code to the buffer [start\_link(name)](#start_link/1) Starts the server Functions ============ eval\_code(pid, code) Adds the given code to the buffer. start\_link(name) Starts the server. Server.Pyserver – expyplot v1.2.2 expyplot v1.2.2 Server.Pyserver ================================= Summary ========== [Functions](#functions) ------------------------ [start\_link(name)](#start_link/1) Starts the server Functions ============ start\_link(name) Starts the server. Server.Pysupervisor – expyplot v1.2.2 expyplot v1.2.2 Server.Pysupervisor ===================================== This is the Supervisor for the python code. It restarts it whenever it goes down. Summary ========== [Functions](#functions) ------------------------ [start\_link()](#start_link/0) Functions ============ start\_link()
ex_sha3
hex
ExSha3 β€” ex\_sha3 v0.1.4 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/dominicletz/exsha3/blob/main/lib/ex_sha3.ex#L4 "View Source") ExSha3 (ex\_sha3 v0.1.4) ==================================================================================================================================== ExSha3 supports the three hash algorithms: ``` \* KECCAK1600-f the original pre-fips version as used in Ethereum \* SHA3 the fips-202 approved final hash \* SHAKE ``` Keccak and SHA3 produce fixed length strings corresponding to their bit length, while shake produces an arbitary length output according to the provided outlen parameter. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [calc(args \\ [])](#calc/1) [calc(record, args)](#calc/2) [keccak\_224(source)](#keccak_224/1) [keccak\_256(source)](#keccak_256/1) [keccak\_384(source)](#keccak_384/1) [keccak\_512(source)](#keccak_512/1) [sha3\_224(source)](#sha3_224/1) [sha3\_256(source)](#sha3_256/1) [sha3\_384(source)](#sha3_384/1) [sha3\_512(source)](#sha3_512/1) [shake\_128(source, outlen)](#shake_128/2) [shake\_256(source, outlen)](#shake_256/2) [xor(a, b)](#xor/2) [Link to this section](#functions) Functions ============================================= [Link to this macro](#calc/1 "Link to this macro") calc(args \\ []) ================ [View Source](https://github.com/dominicletz/exsha3/blob/main/lib/ex_sha3.ex#L80 "View Source") (macro) [Link to this macro](#calc/2 "Link to this macro") calc(record, args) ================== [View Source](https://github.com/dominicletz/exsha3/blob/main/lib/ex_sha3.ex#L80 "View Source") (macro) [Link to this function](#keccak_224/1 "Link to this function") keccak\_224(source) =================== [View Source](https://github.com/dominicletz/exsha3/blob/main/lib/ex_sha3.ex#L236 "View Source") ``` @spec keccak_224([binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this function](#keccak_256/1 "Link to this function") keccak\_256(source) =================== [View Source](https://github.com/dominicletz/exsha3/blob/main/lib/ex_sha3.ex#L238 "View Source") ``` @spec keccak_256([binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this function](#keccak_384/1 "Link to this function") keccak\_384(source) =================== [View Source](https://github.com/dominicletz/exsha3/blob/main/lib/ex_sha3.ex#L240 "View Source") ``` @spec keccak_384([binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this function](#keccak_512/1 "Link to this function") keccak\_512(source) =================== [View Source](https://github.com/dominicletz/exsha3/blob/main/lib/ex_sha3.ex#L242 "View Source") ``` @spec keccak_512([binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this function](#sha3_224/1 "Link to this function") sha3\_224(source) ================= [View Source](https://github.com/dominicletz/exsha3/blob/main/lib/ex_sha3.ex#L226 "View Source") ``` @spec sha3_224([binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this function](#sha3_256/1 "Link to this function") sha3\_256(source) ================= [View Source](https://github.com/dominicletz/exsha3/blob/main/lib/ex_sha3.ex#L228 "View Source") ``` @spec sha3_256([binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this function](#sha3_384/1 "Link to this function") sha3\_384(source) ================= [View Source](https://github.com/dominicletz/exsha3/blob/main/lib/ex_sha3.ex#L230 "View Source") ``` @spec sha3_384([binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this function](#sha3_512/1 "Link to this function") sha3\_512(source) ================= [View Source](https://github.com/dominicletz/exsha3/blob/main/lib/ex_sha3.ex#L232 "View Source") ``` @spec sha3_512([binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this function](#shake_128/2 "Link to this function") shake\_128(source, outlen) ========================== [View Source](https://github.com/dominicletz/exsha3/blob/main/lib/ex_sha3.ex#L220 "View Source") ``` @spec shake_128([binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this function](#shake_256/2 "Link to this function") shake\_256(source, outlen) ========================== [View Source](https://github.com/dominicletz/exsha3/blob/main/lib/ex_sha3.ex#L222 "View Source") ``` @spec shake_256([binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this function](#xor/2 "Link to this function") xor(a, b) ========= [View Source](https://github.com/dominicletz/exsha3/blob/main/lib/ex_sha3.ex#L71 "View Source") ExSha3 β€” ex\_sha3 v0.1.4 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/dominicletz/exsha3/blob/main/README.md#L1 "View Source") ExSha3 ============================================================================================================= Pure Elixir implemtation of Keccak, SHA-3 (FIPS-202) and shake. The provided code is an experiment in porting the c-algorithm to Elixir. While it should be correct don't expect native performance. The Elixir code is a port from: <https://github.com/status-im/nim-keccak-tiny/blob/master/keccak_tiny/keccak-tiny.c> [installation](#installation) Installation -------------------------------------------- The package can be installed by adding `exsha3` to your list of dependencies in `mix.exs`: ``` def deps do [ {:exsha3, "~> 0.1"} ] end ``` [this-is-slow](#this-is-slow) This Is Slow -------------------------------------------- This is a proof of concept, and while is correct it is also really slow. Have a look at these numbers from the included benchmark script: ``` > ./benchmark.sh =========== emu\_flavor = jit =========== Operating System: Linux CPU Information: AMD Ryzen 7 3700U with Radeon Vega Mobile Gfx Number of Available Cores: 8 Available memory: 15.45 GB Elixir 1.11.4 Erlang 24.0-rc1 Benchmark suite executing with the following configuration: warmup: 2 s time: 5 s memory time: 0 ns parallel: 1 inputs: long string, short string Estimated total run time: 28 s Benchmarking ex\_sha3\_256 with input long string... Benchmarking ex\_sha3\_256 with input short string... Benchmarking nif\_sha3\_256 with input long string... Benchmarking nif\_sha3\_256 with input short string... ##### With input long string ##### Name ips average deviation median 99th % nif\_sha3\_256 4.24 K 0.24 ms Β±24.26% 0.21 ms 0.48 ms ex\_sha3\_256 0.00989 K 101.15 ms Β±5.02% 99.30 ms 121.34 ms Comparison: nif\_sha3\_256 4.24 K ex\_sha3\_256 0.00989 K - 428.71x slower +100.91 ms ##### With input short string ##### Name ips average deviation median 99th % nif\_sha3\_256 283.57 K 3.53 ΞΌs Β±499.14% 3.28 ΞΌs 8.17 ΞΌs ex\_sha3\_256 1.61 K 621.56 ΞΌs Β±18.51% 600.85 ΞΌs 1285.68 ΞΌs Comparison: nif\_sha3\_256 283.57 K ex\_sha3\_256 1.61 K - 176.26x slower +618.04 ΞΌs ``` [← Previous Page API Reference](api-reference.html)
bodyguard
hex
Bodyguard β€” Bodyguard v2.4.2 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Bodyguard ========= [![Module Version](https://img.shields.io/hexpm/v/bodyguard.svg)](https://hex.pm/packages/bodyguard) [![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/bodyguard/) [![Total Download](https://img.shields.io/hexpm/dt/bodyguard.svg)](https://hex.pm/packages/bodyguard) [![License](https://img.shields.io/hexpm/l/bodyguard.svg)](https://github.com/schrockwell/bodyguard/blob/master/LICENSE) [![Last Updated](https://img.shields.io/github/last-commit/schrockwell/bodyguard.svg)](https://github.com/schrockwell/bodyguard/commits/master) [![tests](https://github.com/schrockwell/bodyguard/actions/workflows/tests.yml/badge.svg)](https://github.com/schrockwell/bodyguard/actions) Bodyguard protects the context boundaries of your application. πŸ’ͺ Version 2 was built from the ground-up to integrate nicely with Phoenix contexts. Authorization callbacks are implemented directly on contexts, so permissions can be checked from controllers, views, sockets, tests, and even other contexts. The [`Bodyguard.Policy`](Bodyguard.Policy.html) behaviour is implemented with a single required callback. Additionally, the [`Bodyguard.Schema`](Bodyguard.Schema.html) behaviour provides a convention for limiting query results per-user. This is an all-new API, so refer to [the `1.x` branch](https://github.com/schrockwell/bodyguard/tree/1.x) for the earlier readme. * [Docs](https://hexdocs.pm/bodyguard/) ← complete documentation * [Hex](https://hex.pm/packages/bodyguard) * [GitHub](https://github.com/schrockwell/bodyguard) Quick Example ---------------- Define authorization rules directly in the context module: ``` # lib/my\_app/blog/blog.ex defmodule MyApp.Blog do @behaviour Bodyguard.Policy # Admins can update anything def authorize(:update\_post, %{role: :admin} = \_user, \_post), do: :ok # Users can update their owned posts def authorize(:update\_post, %{id: user\_id} = \_user, %{user\_id: user\_id} = \_post), do: :ok # Otherwise, denied def authorize(:update\_post, \_user, \_post), do: :error end # lib/my\_app\_web/controllers/post\_controller.ex defmodule MyAppWeb.PostController do use MyAppWeb, :controller def update(conn, %{"id" => id, "post" => post\_params}) do user = conn.assigns.current\_user post = MyApp.Blog.get\_post!(id) with :ok <- Bodyguard.permit(MyApp.Blog, :update\_post, user, post), {:ok, post} <- MyApp.Blog.update\_post(post, post\_params) do redirect(conn, to: post\_path(conn, :show, post)) end end end ``` Policies ----------- To implement a policy, add `@behaviour Bodyguard.Policy` to a context, then define `authorize(action, user, params)` callbacks, which must return: * `:ok` or `true` to permit an action * `:error`, `{:error, reason}`, or `false` to deny an action Don't use these callbacks directly - instead, go through [`Bodyguard.permit/4`](Bodyguard.html#permit/4). This will convert any keyword-list `params` into a map, and will coerce the callback result into a strict `:ok` or `{:error, reason}` result. The default failure `reason` is `:unauthorized` unless specified otherwise in the callback. Also provided are [`Bodyguard.permit?/4`](Bodyguard.html#permit?/4) (returns a boolean) and [`Bodyguard.permit!/5`](Bodyguard.html#permit!/5) (raises [`Bodyguard.NotAuthorizedError`](Bodyguard.NotAuthorizedError.html) on failure). ``` # lib/my\_app/blog/blog.ex defmodule MyApp.Blog do @behaviour Bodyguard.Policy alias \_\_MODULE\_\_ # Admin users can do anything def authorize(\_, %Blog.User{role: :admin}, \_), do: true # Regular users can create posts def authorize(:create\_post, \_, \_), do: true # Regular users can modify their own posts def authorize(action, %Blog.User{id: user\_id}, %Blog.Post{user\_id: user\_id}) when action in [:update\_post, :delete\_post], do: true # Catch-all: deny everything else def authorize(\_, \_, \_), do: false end ``` If you prefer more structure, define a dedicated policy module outside of the context, and use `defdelegate`: ``` # lib/my\_app/blog/blog.ex defmodule MyApp.Blog do defdelegate authorize(action, user, params), to: MyApp.Blog.Policy end # lib/my\_app/blog/policy.ex defmodule MyApp.Blog.Policy do @behaviour Bodyguard.Policy def authorize(action, user, params), do: # ... end ``` Controllers -------------- Phoenix 1.3 introduces the `action_fallback` controller macro. This is the recommended way to deal with authorization failures. The fallback controller will handle `{:error, reason}` authorization failures. If you are using the [`Bodyguard.Plug.Authorize`](Bodyguard.Plug.Authorize.html) plug, then you must use its `:fallback` option instead, since the plug pipeline will be halted before the controller action is called. Typically, authorization failure results in `{:error, :unauthorized}`. If you wish to deny access without leaking the existence of a particular resource, consider returning `{:error, :not_found}` instead, and handle it separately in the fallback controller. See the section "Overriding `action/2` for custom arguments" in [the Phoenix.Controller docs](https://hexdocs.pm/phoenix/Phoenix.Controller.html) for a clean way to pass in the `user` to each action. ``` # lib/my\_app\_web/controllers/fallback\_controller.ex defmodule MyAppWeb.FallbackController do use MyAppWeb, :controller def call(conn, {:error, :unauthorized}) do conn |> put\_status(:forbidden) |> put\_view(MyAppWeb.ErrorView) |> render(:"403") end end ``` ### Where Should I Perform Checks? Bodyguard doesn't make any assumptions about where authorization checks are performed. You can do it before calling into the context, or within the context itself. There is a good discussion of the tradeoffs [here](https://dockyard.com/blog/2017/08/01/authorization-for-phoenix-contexts). Plugs -------- * [`Bodyguard.Plug.Authorize`](Bodyguard.Plug.Authorize.html) – perform authorization in the middle of a pipeline This plug's config utilizes callback functions called getters, which are 1-arity functions that accept the `conn` and return the appropriate value. ``` # lib/my\_app\_web/controllers/post\_controller.ex defmodule MyAppWeb.PostController do use MyAppWeb, :controller # Fetch the post and put into conn assigns plug :get\_post when action in [:show] # Do the check plug Bodyguard.Plug.Authorize, policy: MyApp.Blog.Policy, action: {Phoenix.Controller, :action\_name}, user: {MyApp.Authentication, :current\_user}, params: {\_\_MODULE\_\_, :extract\_post}, fallback: MyAppWeb.FallbackController def show(conn, \_) do # Already assigned and authorized render(conn, "show.html") end defp get\_post(conn, \_) do assign(conn, :post, MyApp.Posts.get\_post!(conn.params["id"])) end # Helper for the Authorize plug def extract\_post(conn), do: conn.assigns.posts end ``` See the docs for more information about configuring application-wide defaults for the plug. Schema Scopes ---------------- Bodyguard also provides the [`Bodyguard.Schema`](Bodyguard.Schema.html) behaviour to query which items a user can access. Implement it directly on schema modules. ``` # lib/my\_app/blog/post.ex defmodule MyApp.Blog.Post do import Ecto.Query, only: [from: 2] @behaviour Bodyguard.Schema def scope(query, %MyApp.Blog.User{id: user\_id}, \_) do from ms in query, where: ms.user\_id == ^user\_id end end ``` To leverage scopes, the [`Bodyguard.scope/4`](Bodyguard.html#scope/4) helper function (not the callback!) can infer the type of a query and automatically defer to the appropriate callback. ``` # lib/my\_app/blog/blog.ex defmodule MyApp.Blog do def list\_user\_posts(user) do MyApp.Blog.Post |> Bodyguard.scope(user) # <-- defers to MyApp.Blog.Post.scope/3 |> where(draft: false) |> Repo.all end end ``` Configuration ---------------- Here is the default library config. ``` config :bodyguard, # The second element of the {:error, reason} tuple returned on auth failure default\_error: :unauthorized ``` Testing ---------- Testing is pretty straightforward – use the [`Bodyguard`](Bodyguard.html) top-level API. ``` assert :ok == Bodyguard.permit(MyApp.Blog, :successful\_action, user) assert {:error, :unauthorized} == Bodyguard.permit(MyApp.Blog, :failing\_action, user) assert Bodyguard.permit?(MyApp.Blog, :successful\_action, user) refute Bodyguard.permit?(MyApp.Blog, :failing\_action, user) error = assert\_raise Bodyguard.NotAuthorizedError, fun -> Bodyguard.permit(MyApp.Blog, :failing\_action, user) end assert %{status: 403, message: "not authorized"} = error ``` Installation --------------- 1. Add `:bodyguard` to your list of dependencies: ``` # mix.exs def deps do [ {:bodyguard, "~> 2.4"} ] end ``` 2. Create an error view for handling `403 Forbidden`. ``` # lib/my\_app\_web/views/error\_view.ex defmodule MyAppWeb.ErrorView do use MyAppWeb, :view def render("403.html", \_assigns) do "Forbidden" end end ``` 3. Wire up a [fallback controller](#controllers) to render this error view on `{:error, :unauthorized}`. 4. Add `@behaviour Bodyguard.Policy` to contexts that require authorization, and implement `authorize/3` callbacks. 5. (Optional) Add `@behaviour Bodyguard.Schema` on schemas available for user-scoping, and implement `scope/3` callbacks. 6. (Optional) Edit `my_app_web.ex` and add `import Bodyguard` to controllers, views, channels, etc. Alternatives --------------- Not what you're looking for? * [Roll your own](https://dockyard.com/blog/2017/08/01/authorization-for-phoenix-contexts) * [PolicyWonk](https://github.com/boydm/policy_wonk) * [Canada](https://github.com/jarednorman/canada) * [Canary](https://github.com/cpjk/canary) Community ------------ Join our communities! * [Slack](https://elixir-lang.slack.com/messages/CHMTNPSEN/) License ---------- MIT License, Copyright (c) 2017 Rockwell Schrock Acknowledgements ------------------- Thanks to [Ben Cates](https://github.com/bencates) for helping maintain and mature this library. Bodyguard β€” Bodyguard v2.4.2 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Bodyguard (Bodyguard v2.4.2) [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard.ex#L1 "View Source") =================================================================================================================================== Authorize actions at the boundary of a context. Please see the [README](readme.html). [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [action()](#t:action/0) [opts()](#t:opts/0) [Functions](#functions) ------------------------ [permit(policy, action, user, params \\ [])](#permit/4) Authorize a user's action. [permit!(policy, action, user, params \\ [], opts \\ [])](#permit!/5) The same as [`permit/4`](#permit/4), but raises [`Bodyguard.NotAuthorizedError`](Bodyguard.NotAuthorizedError.html) on authorization failure. [permit?(policy, action, user, params \\ [])](#permit?/4) The same as [`permit/4`](#permit/4), but returns a boolean. [scope(query, user, params \\ [], opts \\ [])](#scope/4) Filter a query down to user-accessible items. [Link to this section](#types) Types ===================================== [Link to this type](#t:action/0 "Link to this type") action() ======== [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard.ex#L8 "View Source") Specs ----- ``` action() :: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this type](#t:opts/0 "Link to this type") opts() ====== [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard.ex#L9 "View Source") Specs ----- ``` opts() :: [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | %{optional([atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) => [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#permit/4 "Link to this function") permit(policy, action, user, params \\ []) ========================================== [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard.ex#L24 "View Source") Specs ----- ``` permit(policy :: [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), action :: [action](#t:action/0)(), user :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), params :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: :ok | {:error, [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Authorize a user's action. Returns `:ok` on success, and `{:error, reason}` on failure. If `params` is a keyword list, it is converted to a map before passing down to the [`Bodyguard.Policy.authorize/3`](Bodyguard.Policy.html#c:authorize/3) callback. Otherwise, `params` is not changed. [Link to this function](#permit!/5 "Link to this function") permit!(policy, action, user, params \\ [], opts \\ []) ======================================================= [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard.ex#L50 "View Source") Specs ----- ``` permit!( policy :: [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), action :: [action](#t:action/0)(), user :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), params :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), opts :: [opts](#t:opts/0)() ) :: :ok | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` The same as [`permit/4`](#permit/4), but raises [`Bodyguard.NotAuthorizedError`](Bodyguard.NotAuthorizedError.html) on authorization failure. Returns `:ok` on success. If `params` is a keyword list, it is converted to a map before passing down to the [`Bodyguard.Policy.authorize/3`](Bodyguard.Policy.html#c:authorize/3) callback. Otherwise, `params` is not changed. Options ---------- * `error_message` – a string to describe the error (default "not authorized") * `error_status` – the HTTP status code to raise with the error (default 403) [Link to this function](#permit?/4 "Link to this function") permit?(policy, action, user, params \\ []) =========================================== [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard.ex#L75 "View Source") Specs ----- ``` permit?(policy :: [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), action :: [action](#t:action/0)(), user :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), params :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` The same as [`permit/4`](#permit/4), but returns a boolean. [Link to this function](#scope/4 "Link to this function") scope(query, user, params \\ [], opts \\ []) ============================================ [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard.ex#L113 "View Source") Specs ----- ``` scope(query :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), user :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), params :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), opts :: [opts](#t:opts/0)()) :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Filter a query down to user-accessible items. The `query` is introspected by Bodyguard in an attempt to automatically determine the schema type. To succeed, `query` must be an atom (schema module name), an `Ecto.Query`, or a list of structs. This function exists primarily as a helper to `import` into a context and gain access to scoping for all schemas. ``` defmodule MyApp.Blog do import Bodyguard def list\_user\_posts(user) do Blog.Post |> scope(user) # <-- defers to MyApp.Blog.Post.scope/3 |> where(draft: false) |> Repo.all end end ``` If `params` is a keyword list, it is converted to a map before passing down to the [`Bodyguard.Schema.scope/3`](Bodyguard.Schema.html#c:scope/3) callback. Otherwise, `params` is not changed. #### Options * `schema` - if the schema of the `query` cannot be determined, you must manually specify the schema here Bodyguard.Action β€” Bodyguard v2.4.2 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Bodyguard.Action (Bodyguard v2.4.2) [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/action.ex#L1 "View Source") ================================================================================================================================================= Execute authorized actions in a composable way. An Action can be built up over the course of a request, providing a means to specify authorization parameters in the steps leading up to actually executing the job. When authorization fails, there is an opportunity to handle it using a fallback function before returning the final result. Authorization is performed by deferring to a [`Bodyguard.Policy`](Bodyguard.Policy.html). #### Fields * `:context` – Context for the action * `:policy` – Implementation of [`Bodyguard.Policy`](Bodyguard.Policy.html) behaviour; defaults to the `:context` * `:user` – The user to authorize * `:name` – The name of the authorized action * `:auth_run?` – If an authorization check has been performed * `:auth_result` – Result of the authorization check * `:authorized?` – If authorization has succeeded (default `false`) * `:job` – Function to execute if authorization passes; signature `job(action)` * `:fallback` – Function to execute if authorization fails; signature `fallback(action)` * `:assigns` – Generic parameters along for the ride #### Controller Example ``` defmodule MyApp.Web.PostController do use MyApp.Web, :controller import Bodyguard.Action alias MyApp.Blog action\_fallback MyApp.FallbackController plug Bodyguard.Plug.BuildAction, context: Blog, user: &get\_current\_user/1 def index(conn, \_) do run conn.assigns.action, fn(action) -> posts = Blog.list\_posts(action.user) render(conn, "index.html", posts: posts) end end defp get\_current\_user(conn) do # ... end end ``` #### Verbose Example ``` import Bodyguard.Action alias MyApp.Blog act(Blog) |> put\_user(get\_current\_user()) |> put\_policy(Blog.SomeSpecialPolicy) |> assign(:drafts, true) |> authorize(:list\_posts) |> put\_job(fn action -> Blog.list\_posts(action.user, drafts\_only: action.assigns.drafts) end) |> put\_fallback(fn \_action -> {:error, :not\_found} end) |> run() ``` [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [assigns()](#t:assigns/0) [fallback()](#t:fallback/0) [job()](#t:job/0) [t()](#t:t/0) [Functions](#functions) ------------------------ [act(context)](#act/1) Initialize an Action. [assign(action, key, value)](#assign/3) Put a new assign. [force\_authorized(action)](#force_authorized/1) Mark the Action as authorized, regardless of previous authorization. [force\_unauthorized(action, error)](#force_unauthorized/2) Mark the Action as unauthorized, regardless of previous authorization. [permit(action, name, opts \\ [])](#permit/3) Use the policy to perform authorization. [permit!(action, name, opts \\ [])](#permit!/3) Same as `authorize/3` but raises on failure. [put\_assigns(action, assigns)](#put_assigns/2) Replace the assigns. [put\_context(action, context)](#put_context/2) Change the context. [put\_fallback(action, fallback)](#put_fallback/2) Change the fallback handler. [put\_job(action, job)](#put_job/2) Change the job to execute. [put\_policy(action, policy)](#put_policy/2) Change the policy. [put\_user(action, user)](#put_user/2) Change the user to authorize. [run(action)](#run/1) Execute the Action's job. [run(action, job)](#run/2) Execute the given job. [run(action, job, fallback)](#run/3) Execute the given job and fallback. [run!(action)](#run!/1) Execute the job, raising on failure. [run!(action, job)](#run!/2) Execute the given job, raising on failure. [Link to this section](#types) Types ===================================== [Link to this type](#t:assigns/0 "Link to this type") assigns() ========= [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/action.ex#L82 "View Source") Specs ----- ``` assigns() :: %{required([atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) => [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` [Link to this type](#t:fallback/0 "Link to this type") fallback() ========== [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/action.ex#L81 "View Source") Specs ----- ``` fallback() :: (action :: [t](#t:t/0)() -> [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) ``` [Link to this type](#t:job/0 "Link to this type") job() ===== [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/action.ex#L80 "View Source") Specs ----- ``` job() :: (action :: [t](#t:t/0)() -> [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/action.ex#L84 "View Source") Specs ----- ``` t() :: %Bodyguard.Action{ assigns: [assigns](#t:assigns/0)(), auth_result: [Bodyguard.Policy.auth\_result](Bodyguard.Policy.html#t:auth_result/0)() | nil, auth_run?: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), authorized?: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), context: [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, fallback: [fallback](#t:fallback/0)() | nil, job: [job](#t:job/0)() | nil, name: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil, policy: [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, user: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#act/1 "Link to this function") act(context) ============ [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/action.ex#L107 "View Source") Specs ----- ``` act(context :: [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [t](#t:t/0)() ``` Initialize an Action. The `context` is assumed to implement [`Bodyguard.Policy`](Bodyguard.Policy.html) callbacks. To specify a unique policy, use [`put_policy/2`](#put_policy/2). The Action is considered unauthorized by default, until authorization is run. [Link to this function](#assign/3 "Link to this function") assign(action, key, value) ========================== [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/action.ex#L166 "View Source") Specs ----- ``` assign(action :: [t](#t:t/0)(), key :: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), value :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [t](#t:t/0)() ``` Put a new assign. [Link to this function](#force_authorized/1 "Link to this function") force\_authorized(action) ========================= [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/action.ex#L174 "View Source") Specs ----- ``` force_authorized(action :: [t](#t:t/0)()) :: [t](#t:t/0)() ``` Mark the Action as authorized, regardless of previous authorization. [Link to this function](#force_unauthorized/2 "Link to this function") force\_unauthorized(action, error) ================================== [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/action.ex#L182 "View Source") Specs ----- ``` force_unauthorized(action :: [t](#t:t/0)(), error :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [t](#t:t/0)() ``` Mark the Action as unauthorized, regardless of previous authorization. [Link to this function](#permit/3 "Link to this function") permit(action, name, opts \\ []) ================================ [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/action.ex#L196 "View Source") Specs ----- ``` permit(action :: [t](#t:t/0)(), name :: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), opts :: [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [assigns](#t:assigns/0)()) :: [t](#t:t/0)() ``` Use the policy to perform authorization. The `opts` are merged in to the Action's `assigns` and passed as the `params`. See [`Bodyguard.permit/3`](Bodyguard.html#permit/3) for details. [Link to this function](#permit!/3 "Link to this function") permit!(action, name, opts \\ []) ================================= [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/action.ex#L224 "View Source") Specs ----- ``` permit!(action :: [t](#t:t/0)(), name :: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), opts :: [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [assigns](#t:assigns/0)()) :: [t](#t:t/0)() ``` Same as `authorize/3` but raises on failure. [Link to this function](#put_assigns/2 "Link to this function") put\_assigns(action, assigns) ============================= [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/action.ex#L158 "View Source") Specs ----- ``` put_assigns(action :: [t](#t:t/0)(), assigns :: [assigns](#t:assigns/0)()) :: [t](#t:t/0)() ``` Replace the assigns. [Link to this function](#put_context/2 "Link to this function") put\_context(action, context) ============================= [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/action.ex#L117 "View Source") Specs ----- ``` put_context(action :: [t](#t:t/0)(), context :: [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [t](#t:t/0)() ``` Change the context. [Link to this function](#put_fallback/2 "Link to this function") put\_fallback(action, fallback) =============================== [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/action.ex#L149 "View Source") Specs ----- ``` put_fallback(action :: [t](#t:t/0)(), fallback :: [fallback](#t:fallback/0)() | nil) :: [t](#t:t/0)() ``` Change the fallback handler. [Link to this function](#put_job/2 "Link to this function") put\_job(action, job) ===================== [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/action.ex#L141 "View Source") Specs ----- ``` put_job(action :: [t](#t:t/0)(), job :: [job](#t:job/0)() | nil) :: [t](#t:t/0)() ``` Change the job to execute. [Link to this function](#put_policy/2 "Link to this function") put\_policy(action, policy) =========================== [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/action.ex#L125 "View Source") Specs ----- ``` put_policy(action :: [t](#t:t/0)(), policy :: [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [t](#t:t/0)() ``` Change the policy. [Link to this function](#put_user/2 "Link to this function") put\_user(action, user) ======================= [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/action.ex#L133 "View Source") Specs ----- ``` put_user(action :: [t](#t:t/0)(), user :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [t](#t:t/0)() ``` Change the user to authorize. [Link to this function](#run/1 "Link to this function") run(action) =========== [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/action.ex#L255 "View Source") Specs ----- ``` run(action :: [t](#t:t/0)()) :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Execute the Action's job. The `job` must have been previously assigned using [`put_job/2`](#put_job/2). If authorized, the job is run and its value is returned. If unauthorized, and a fallback has been provided, the fallback is run and its value returned. Otherwise, the result of the authorization is returned (something like `{:error, reason}`). [Link to this function](#run/2 "Link to this function") run(action, job) ================ [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/action.ex#L287 "View Source") Specs ----- ``` run(action :: [t](#t:t/0)(), job :: [job](#t:job/0)()) :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Execute the given job. If authorized, the job is run and its value is returned. If unauthorized, and a fallback has been provided, the fallback is run and its value returned. Otherwise, the result of the authorization is returned (something like `{:error, reason}`). [Link to this function](#run/3 "Link to this function") run(action, job, fallback) ========================== [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/action.ex#L301 "View Source") Specs ----- ``` run(action :: [t](#t:t/0)(), job :: [job](#t:job/0)(), fallback :: [fallback](#t:fallback/0)()) :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Execute the given job and fallback. If authorized, the job is run and its value is returned. If unauthorized, the fallback is run and its value returned. [Link to this function](#run!/1 "Link to this function") run!(action) ============ [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/action.ex#L315 "View Source") Specs ----- ``` run!(action :: [t](#t:t/0)()) :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Execute the job, raising on failure. The `job` must have been previously assigned using [`put_job/2`](#put_job/2). [Link to this function](#run!/2 "Link to this function") run!(action, job) ================= [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/action.ex#L334 "View Source") Specs ----- ``` run!(action :: [t](#t:t/0)(), job :: [job](#t:job/0)()) :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Execute the given job, raising on failure. Bodyguard.NotAuthorizedError β€” Bodyguard v2.4.2 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Bodyguard.NotAuthorizedError exception (Bodyguard v2.4.2) [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/not_authorized_error.ex#L1 "View Source") ===================================================================================================================================================================================== Raised when authorization fails. Bodyguard.Plug β€” Bodyguard v2.4.2 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Bodyguard.Plug (Bodyguard v2.4.2) [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/plug.ex#L1 "View Source") ============================================================================================================================================= Work with Actions embedded in connections. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [put\_action(conn, action, key \\ :action)](#put_action/3) Assign an Action to the connection. [update\_action(conn, fun, key \\ :action)](#update_action/3) Modify the existing Action on the connection, in-place. [Link to this section](#functions) Functions ============================================= [Link to this function](#put_action/3 "Link to this function") put\_action(conn, action, key \\ :action) ========================================= [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/plug.ex#L16 "View Source") Specs ----- ``` put_action(conn :: [Plug.Conn.t](https://hexdocs.pm/plug/1.2.0/Plug.Conn.html#t:t/0)(), action :: [Bodyguard.Action.t](Bodyguard.Action.html#t:t/0)(), key :: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [Plug.Conn.t](https://hexdocs.pm/plug/1.2.0/Plug.Conn.html#t:t/0)() ``` Assign an Action to the connection. Inserts it into `conn.assigns.action`. [Link to this function](#update_action/3 "Link to this function") update\_action(conn, fun, key \\ :action) ========================================= [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/plug.ex#L28 "View Source") Specs ----- ``` update_action( conn :: [Plug.Conn.t](https://hexdocs.pm/plug/1.2.0/Plug.Conn.html#t:t/0)(), fun :: ([Bodyguard.Action.t](Bodyguard.Action.html#t:t/0)() -> [Bodyguard.Action.t](Bodyguard.Action.html#t:t/0)()), key :: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ) :: [Plug.Conn.t](https://hexdocs.pm/plug/1.2.0/Plug.Conn.html#t:t/0)() ``` Modify the existing Action on the connection, in-place. Bodyguard.Plug.Authorize β€” Bodyguard v2.4.2 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Bodyguard.Plug.Authorize (Bodyguard v2.4.2) [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/plug/authorize.ex#L1 "View Source") ================================================================================================================================================================= Perform authorization in a Plug pipeline. Options ---------- * `:policy` *required* - the policy (or context) module * `:action` *required* - the action, or a getter * `:user` - the user getter * `:params` - the params, or a getter, to pass to the authorization callbacks * `:fallback` - a fallback controller or plug to handle authorization failure. If specified, the plug is called and then the pipeline is `halt`ed. If not specified, then [`Bodyguard.NotAuthorizedError`](Bodyguard.NotAuthorizedError.html) raises directly to the router. ### Option Getters The options `:action`, `:user`, and `:params` can accept getter functions that are either: * an anonymous 1-arity function that accepts the `conn` and returns a value * a `{module, function_name}` tuple specifying an existing function with that same signature ### Default Plug Options You can provide default options for this plug by simply wrapping your own plug around it. For example, if you're using Phoenix with Pow for authentication, you might want to specify: ``` defmodule MyAppWeb.Authorize do def init(opts) do opts |> Keyword.put\_new(:action, {Phoenix.Controller, :action\_name}) |> Keyword.put\_new(:user, {Pow.Plug, :current\_user}) |> Bodyguard.Plug.Authorize.init() end def call(conn, opts) do Bodyguard.Plug.Authorize.call(conn, opts) end end ``` Examples ----------- ``` # Raise on failure plug Bodyguard.Plug.Authorize, policy: MyApp.Blog, action: &action\_name/1, user: {MyApp.Authentication, :current\_user} # Fallback on failure plug Bodyguard.Plug.Authorize, policy: MyApp.Blog, action: &action\_name/1, user: {MyApp.Authentication, :current\_user}, fallback: MyAppWeb.FallbackController # Params as a function plug Bodyguard.Plug.Authorize, policy: MyApp.Blog, action: &action\_name/1, user: {MyApp.Authentication, :current\_user}, params: &get\_params/1 ``` [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [call(conn, arg)](#call/2) Callback implementation for [`Plug.call/2`](https://hexdocs.pm/plug/1.2.0/Plug.html#c:call/2). [init(opts \\ [])](#init/1) Callback implementation for [`Plug.init/1`](https://hexdocs.pm/plug/1.2.0/Plug.html#c:init/1). [valid\_getter?(fun)](#valid_getter?/1) [Link to this section](#functions) Functions ============================================= [Link to this function](#call/2 "Link to this function") call(conn, arg) =============== [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/plug/authorize.ex#L115 "View Source") Callback implementation for [`Plug.call/2`](https://hexdocs.pm/plug/1.2.0/Plug.html#c:call/2). [Link to this function](#init/1 "Link to this function") init(opts \\ []) ================ [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/plug/authorize.ex#L72 "View Source") Callback implementation for [`Plug.init/1`](https://hexdocs.pm/plug/1.2.0/Plug.html#c:init/1). [Link to this function](#valid_getter?/1 "Link to this function") valid\_getter?(fun) =================== [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/plug/authorize.ex#L68 "View Source") Bodyguard.Plug.BuildAction β€” Bodyguard v2.4.2 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Bodyguard.Plug.BuildAction (Bodyguard v2.4.2) [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/plug/build_action.ex#L1 "View Source") ====================================================================================================================================================================== Construct an Action on the connection. The action is stored in `conn.assigns.action` for later access (configurable via the `:key` option). #### Options See [`Bodyguard.Action`](Bodyguard.Action.html) for descriptions of these fields. * `context` - context module * `policy` - policy module (defaults to context module) * `fallback` - fallback function * `assigns` - action assigns * `user` – can be a 1-arity function (or `{module, function_name}`) that accepts the connection and returns the user * `key` - the assign to set. Defaults to `:action` [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [call(conn, opts)](#call/2) Callback implementation for [`Plug.call/2`](https://hexdocs.pm/plug/1.2.0/Plug.html#c:call/2). [init(opts \\ [])](#init/1) Callback implementation for [`Plug.init/1`](https://hexdocs.pm/plug/1.2.0/Plug.html#c:init/1). [Link to this section](#functions) Functions ============================================= [Link to this function](#call/2 "Link to this function") call(conn, opts) ================ [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/plug/build_action.ex#L28 "View Source") Callback implementation for [`Plug.call/2`](https://hexdocs.pm/plug/1.2.0/Plug.html#c:call/2). [Link to this function](#init/1 "Link to this function") init(opts \\ []) ================ [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/plug/build_action.ex#L26 "View Source") Callback implementation for [`Plug.init/1`](https://hexdocs.pm/plug/1.2.0/Plug.html#c:init/1). Bodyguard.Policy β€” Bodyguard v2.4.2 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Bodyguard.Policy behaviour (Bodyguard v2.4.2) [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/policy.ex#L1 "View Source") =========================================================================================================================================================== Where authorization rules live. Typically the callbacks are designed to be used by [`Bodyguard.permit/4`](Bodyguard.html#permit/4) and are not called directly. The only requirement is to implement the [`authorize/3`](#c:authorize/3) callback: ``` defmodule MyApp.MyContext do @behaviour Bodyguard.Policy def authorize(action, user, params) do # Return :ok or true to permit # Return :error, {:error, reason}, or false to deny end end ``` To perform authorization checks, use [`Bodyguard.permit/4`](Bodyguard.html#permit/4) and friends: ``` with :ok <- Bodyguard.permit(MyApp.MyContext, :action\_name, user, param: :value) do # ... end if Bodyguard.permit?(MyApp.MyContext, :action\_name, user, param: :value) do # ... end Bodyguard.permit!(MyApp.MyContext, :action\_name, user, param: :value) ``` If you want to define the callbacks in another module, you can use `defdelegate`: ``` defmodule MyApp.MyContext do defdelegate authorize(action, user, params), to: Some.Other.Policy end ``` [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [action()](#t:action/0) [auth\_result()](#t:auth_result/0) [Callbacks](#callbacks) ------------------------ [authorize(action, user, params)](#c:authorize/3) Callback to authorize a user's action. [Link to this section](#types) Types ===================================== [Link to this type](#t:action/0 "Link to this type") action() ======== [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/policy.ex#L40 "View Source") Specs ----- ``` action() :: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this type](#t:auth_result/0 "Link to this type") auth\_result() ============== [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/policy.ex#L41 "View Source") Specs ----- ``` auth_result() :: :ok | :error | {:error, reason :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} | true | false ``` [Link to this section](#callbacks) Callbacks ============================================= [Link to this callback](#c:authorize/3 "Link to this callback") authorize(action, user, params) =============================== [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/policy.ex#L53 "View Source") Specs ----- ``` authorize( action :: [action](#t:action/0)(), user :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), params :: %{required([atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) => [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} | [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ) :: [auth\_result](#t:auth_result/0)() ``` Callback to authorize a user's action. To permit an action, return `:ok` or `true`. To deny, return `:error`, `{:error, reason}`, or `false`. The `action` is whatever user-specified contextual action is being authorized. It bears no intrinsic relationship to a controller action, and instead should share a name with a particular function on the context. Bodyguard.Schema β€” Bodyguard v2.4.2 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Bodyguard.Schema behaviour (Bodyguard v2.4.2) [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/schema.ex#L1 "View Source") =========================================================================================================================================================== Specify user-accessible items. The callbacks are designed to live within your schemas, hidden from the context boundaries of your application. All you have to do is implement the [`scope/3`](#c:scope/3) callback on your schema. What "access" means is up to you, and can be customized on a case-by-case basis via `params`. Typically the callbacks are designed to be used by [`Bodyguard.scope/4`](Bodyguard.html#scope/4) and are not called directly. If you want to use separate module for scoping, you can use `defdelegate`: ``` defmodule MyApp.MyModel.MySchema do defdelegate scope(query, user, params), to: Some.Other.Scope end ``` [Link to this section](#summary) Summary ========================================== [Callbacks](#callbacks) ------------------------ [scope(query, user, params)](#c:scope/3) Specify user-accessible items. [Link to this section](#callbacks) Callbacks ============================================= [Link to this callback](#c:scope/3 "Link to this callback") scope(query, user, params) ========================== [View Source](https://github.com/schrockwell/bodyguard/blob/v2.4.2/lib/bodyguard/schema.ex#L38 "View Source") Specs ----- ``` scope(query :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), user :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), params :: %{required([atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) => [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()}) :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Specify user-accessible items. This callback is expected to take a `query` of this schema and filter it down to results that are only accessible to `user`. Arbitrary `params` may also be specified. ``` defmodule MyApp.MyModel.MySchema do @behaviour Bodyguard.Schema import Ecto.Query, only: [from: 2] def scope(query, user, \_params) do from ms in query, where: ms.user\_id == ^user.id end end ``` API Reference β€” Bodyguard v2.4.2 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } API Reference Bodyguard v2.4.2 ================================ Modules ---------- [Bodyguard](Bodyguard.html) Authorize actions at the boundary of a context. [Bodyguard.Action](Bodyguard.Action.html) Execute authorized actions in a composable way. [Bodyguard.NotAuthorizedError](Bodyguard.NotAuthorizedError.html) Raised when authorization fails. [Bodyguard.Plug](Bodyguard.Plug.html) Work with Actions embedded in connections. [Bodyguard.Plug.Authorize](Bodyguard.Plug.Authorize.html) Perform authorization in a Plug pipeline. [Bodyguard.Plug.BuildAction](Bodyguard.Plug.BuildAction.html) Construct an Action on the connection. [Bodyguard.Policy](Bodyguard.Policy.html) Where authorization rules live. [Bodyguard.Schema](Bodyguard.Schema.html) Specify user-accessible items.
multiverse
hex
Multiverse – multiverse v1.1.0 try { if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; } catch (e) { } Toggle Sidebar Toggle Theme Multiverse ========== [![Deps Status](https://beta.hexfaktor.org/badge/all/github/Nebo15/multiverse.svg)](https://beta.hexfaktor.org/github/Nebo15/multiverse) [![Hex.pm Downloads](https://img.shields.io/hexpm/dw/multiverse.svg?maxAge=3600)](https://hex.pm/packages/multiverse) [![Latest Version](https://img.shields.io/hexpm/v/multiverse.svg?maxAge=3600)](https://hex.pm/packages/multiverse) [![License](https://img.shields.io/hexpm/l/multiverse.svg?maxAge=3600)](https://hex.pm/packages/multiverse) [![Build Status](https://travis-ci.org/Nebo15/multiverse.svg?branch=master)](https://travis-ci.org/Nebo15/multiverse) [![Coverage Status](https://coveralls.io/repos/github/Nebo15/multiverse/badge.svg?branch=master)](https://coveralls.io/github/Nebo15/multiverse?branch=master) [![Ebert](https://ebertapp.io/github/Nebo15/multiverse.svg)](https://ebertapp.io/github/Nebo15/multiverse) This plug helps to manage multiple API versions based on request and response gateways. This is an awesome practice to hide your backward compatibility. It allows to have your code in a latest possible version, without duplicating controllers or models. ![Compatibility Layers](http://amberonrails.com/images/posts/move-fast-dont-break-your-api/compatibility-layers.png "Compatibility Layers") Inspired by Stripe API. Read more at [MOVE FAST, DON’T BREAK YOUR API](http://amberonrails.com/move-fast-dont-break-your-api/) or [API versioning](https://stripe.com/blog/api-versioning). Goals -------- * reduce changes required to support multiple API versions; * provide a way to test and schedule API version releases; * to have minimum dependencies and low performance hit; * to be flexible enough for most of projects to adopt it. Adapters ----------- Multiverse allows you to use a custom adapter which can, for eg.: * store consumer version upon his first request and re-use it as default each time consumer is using your API, eliminating need of passing version headers for them. Change this version when consumer has explicitly set it; * use *other than ISO date* version types, eg. incremental counters (`v1`, `v2`); * handle malformed versions by responding with JSON errors. Default adapter works with ISO-8601 date from `x-api-version` header (configurable). For malformed versions it would log a warning and fallback to the current date. Also, it allows to use channel name instead of date, where: * `latest` channel would fallback to the current date; * `edge` channel would disable all changes altogether. Channels allow you to plan version releases upfront and test them without affecting users, just set future date for a change and pass it explicitly or use `edge` channel to test latest application version. Installation --------------- The package (take look at [hex.pm](https://hex.pm/packages/multiverse)) can be installed as: 1. Add `multiverse` to your list of dependencies in `mix.exs`: ``` def deps do [{:multiverse, "~> 1.1.0"}] end ``` 2. Make sure that `multiverse` is available at runtime in your production: ``` def application do [applications: [:multiverse]] end ``` How to use ------------- 1. Insert this plug into your API pipeline (in your `router.ex`): ``` pipeline :api do plug :accepts, ["json"] plug :put_secure_browser_headers plug Multiverse end ``` 2. Define module that handles change ``` defmodule AccountTypeChange do @behaviour Multiverse.Change def handle_request(%Plug.Conn{} = conn) do # Mutate your request here IO.inspect "AccountTypeChange.handle_request applied to request" conn end def handle_response(%Plug.Conn{} = conn) do # Mutate your response here IO.inspect "AccountTypeChange.handle_response applied to response" conn end end ``` 3. Enable the change: ``` pipeline :api do plug :accepts, ["json"] plug :put_secure_browser_headers plug Multiverse, gates: %{ ~D[2016-07-21] => [AccountTypeChange] } end ``` 4. Send your API requests with `X-API-Version` header with version lower or equal to `2016-07-20`. ### Overriding version header You can use any version headers by passing option to Multiverse: ``` pipeline :api do plug :accepts, ["json"] plug :put_secure_browser_headers plug Multiverse, version_header: "x-my-version-header", gates: %{ ~D[2016-07-21] => [AccountTypeChange] } end ``` ### Using custom adapters You can use your own adapter which implements [`Multiverse.Adapter`](Multiverse.Adapter.html) behaviour: ``` pipeline :api do plug :accepts, ["json"] plug :put_secure_browser_headers plug Multiverse, adapter: MyApp.SmartMultiverseAdapter, gates: %{ ~D[2016-07-21] => [AccountTypeChange] } end ``` Structuring your tests ------------------------- 1. Split your tests into versions: $ ls -l test/acceptance total 0 drwxr-xr-x 2 andrew staff 68 Aug 1 19:23 AccountTypeChange drwxr-xr-x 2 andrew staff 68 Aug 1 19:24 OlderChange 2. Avoid touching request or response in old tests. Create API gates and matching folder in acceptance tests. Other things you might want to do ------------------------------------ 1. Store Multiverse configuration in `config.ex`: ``` use Mix.Config config :multiverse, MyApp.Endpoint, gates: %{ ~D[2016-07-21] => [AccountTypeChange] } ``` ``` plug Multiverse, endpoint: __MODULE__ ``` 2. Generate API documentation from changes `@moduledoc`’s. 3. Other awesome stuff. Open an issue and tell me about it! :). License ======= See <LICENSE.md>. Multiverse – multiverse v1.1.0 try { if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; } catch (e) { } Toggle Sidebar Toggle Theme multiverse v1.1.0 Multiverse ============================== This plug helps to manage multiple API versions based on request and response gateways. This is an awesome practice to hide your backward compatibility. It allows to have your code in a latest possible version, without duplicating controllers or models. For more information see [README.md](https://github.com/Nebo15/multiverse/). [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [config()](#t:config/0) [Functions](#functions) ------------------------ [call(conn, config)](#call/2) Callback implementation for [`Plug.call/2`](https://hexdocs.pm/plug/1.4.4/Plug.html#c:call/2) [init(opts)](#init/1) Initializes Multiverse plug [Link to this section](#types) Types ====================================== [Link to this type](#t:config/0 "Link to this type") config() ``` config() :: %{ adapter: [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), version_header: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), gates: [Multiverse.Adapter.gates](Multiverse.Adapter.html#t:gates/0)() } ``` [Link to this section](#functions) Functions ============================================== [Link to this function](#call/2 "Link to this function") call(conn, config) ``` call(conn :: [Plug.Conn.t](https://hexdocs.pm/plug/1.4.4/Plug.Conn.html#t:t/0)(), config :: [config](#t:config/0)()) :: [Plug.Conn.t](https://hexdocs.pm/plug/1.4.4/Plug.Conn.html#t:t/0)() ``` Callback implementation for [`Plug.call/2`](https://hexdocs.pm/plug/1.4.4/Plug.html#c:call/2). [Link to this function](#init/1 "Link to this function") init(opts) ``` init(opts :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: [config](#t:config/0)() ``` Initializes Multiverse plug. Raises at compile time when adapter or change is not loaded. Available options: * `:endpoint` - endpoint which is used to fetch configuration from application environment; * `:adapter` - module which implements [`Multiverse.Adapter`](Multiverse.Adapter.html) behaviour; * `:version_header` - header which is used to fetch consumer version; * `:gates` - list of gates (and changes) that are available for consumers. Multiverse.Adapter – multiverse v1.1.0 try { if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; } catch (e) { } Toggle Sidebar Toggle Theme multiverse v1.1.0 Multiverse.Adapter behaviour ================================================ This module provides behaviour for Multiverse adapters. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [changes()](#t:changes/0) [gates()](#t:gates/0) [version()](#t:version/0) [Callbacks](#callbacks) ------------------------ [fetch\_default\_version(conn)](#c:fetch_default_version/1) Fetch default client version [init(adapter, opts)](#c:init/2) Initialize adapter configuration at compile time [resolve\_version\_or\_channel(conn, channel\_name\_or\_version)](#c:resolve_version_or_channel/2) Resolve version by string value from request header [version\_comparator(v1, v2)](#c:version_comparator/2) Comparator that is used to order and filter versions that should be applied to a connection [Link to this section](#types) Types ====================================== [Link to this type](#t:changes/0 "Link to this type") changes() ``` changes() :: [[module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()] ``` [Link to this type](#t:gates/0 "Link to this type") gates() ``` gates() :: [%{optional([version](#t:version/0)()) => [changes](#t:changes/0)()}] ``` [Link to this type](#t:version/0 "Link to this type") version() ``` version() :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` [Link to this section](#callbacks) Callbacks ============================================== [Link to this callback](#c:fetch_default_version/1 "Link to this callback") fetch\_default\_version(conn) ``` fetch_default_version(conn :: [Plug.Conn.t](https://hexdocs.pm/plug/1.4.4/Plug.Conn.html#t:t/0)()) :: {:ok, [version](#t:version/0)(), [Plug.Conn.t](https://hexdocs.pm/plug/1.4.4/Plug.Conn.html#t:t/0)()} ``` Fetch default client version. This callback is used when version header is not set or empty. Additionally adapters may use it to fallback to default version in case of errors or when version header value is malformed. [Link to this callback](#c:init/2 "Link to this callback") init(adapter, opts) ``` init(adapter :: [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), opts :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: {:ok, [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()} ``` Initialize adapter configuration at compile time. This callback can be used to fetch Multiverse configuration from application environment, file or other places. [Link to this callback](#c:resolve_version_or_channel/2 "Link to this callback") resolve\_version\_or\_channel(conn, channel\_name\_or\_version) ``` resolve_version_or_channel( conn :: [Plug.Conn.t](https://hexdocs.pm/plug/1.4.4/Plug.Conn.html#t:t/0)(), channel_name_or_version :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ) :: {:ok, [version](#t:version/0)(), [Plug.Conn.t](https://hexdocs.pm/plug/1.4.4/Plug.Conn.html#t:t/0)()} ``` Resolve version by string value from request header. This callback can be used to set named channels for API versions, for eg. `latest` header value could be resolved to current date and `edge` to the most recent defined version. Also, it is responsible for casting string value to adapter-specific version type and handling possible errors. You can terminate connection if you want to return error without further processing of the request. [Link to this callback](#c:version_comparator/2 "Link to this callback") version\_comparator(v1, v2) ``` version_comparator(v1 :: [version](#t:version/0)(), v2 :: [version](#t:version/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Comparator that is used to order and filter versions that should be applied to a connection. It should compare two arguments, and return true if the first argument precedes the second one or they are equal. Multiverse.Adapters.ISODate – multiverse v1.1.0 try { if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; } catch (e) { } Toggle Sidebar Toggle Theme multiverse v1.1.0 Multiverse.Adapters.ISODate =============================================== Adapter that fetches ISO-8601 date from request header and `Elixir.Date` to resolve changes that must be applied to the connection. Current date is used as fallback when: * version header is not present in request; * value of a version header is malformed (and warning is logged); * `latest` channel is used instead of date. When `edge` channel is used instead of date, no changes are applied to the connection. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [version()](#t:version/0) [Functions](#functions) ------------------------ [fetch\_default\_version(conn)](#fetch_default_version/1) Fetch default client version [init(adapter, opts)](#init/2) Initialize adapter configuration at compile time [resolve\_version\_or\_channel(conn, version)](#resolve_version_or_channel/2) Resolve version by string value from request header [version\_comparator(v1, v2)](#version_comparator/2) Comparator that is used to order and filter versions that should be applied to a connection [Link to this section](#types) Types ====================================== [Link to this type](#t:version/0 "Link to this type") version() ``` version() :: [Date.t](https://hexdocs.pm/elixir/Date.html#t:t/0)() ``` [Link to this section](#functions) Functions ============================================== [Link to this function](#fetch_default_version/1 "Link to this function") fetch\_default\_version(conn) ``` fetch_default_version(conn :: [Plug.Conn.t](https://hexdocs.pm/plug/1.4.4/Plug.Conn.html#t:t/0)()) :: {:ok, [version](#t:version/0)(), [Plug.Conn.t](https://hexdocs.pm/plug/1.4.4/Plug.Conn.html#t:t/0)()} ``` Fetch default client version. This callback is used when version header is not set or empty. Additionally adapters may use it to fallback to default version in case of errors or when version header value is malformed. Callback implementation for [`Multiverse.Adapter.fetch_default_version/1`](Multiverse.Adapter.html#c:fetch_default_version/1). [Link to this function](#init/2 "Link to this function") init(adapter, opts) Initialize adapter configuration at compile time. This callback can be used to fetch Multiverse configuration from application environment, file or other places. Callback implementation for [`Multiverse.Adapter.init/2`](Multiverse.Adapter.html#c:init/2). [Link to this function](#resolve_version_or_channel/2 "Link to this function") resolve\_version\_or\_channel(conn, version) ``` resolve_version_or_channel( conn :: [Plug.Conn.t](https://hexdocs.pm/plug/1.4.4/Plug.Conn.html#t:t/0)(), channel_name_or_version :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ) :: {:ok, [version](#t:version/0)(), [Plug.Conn.t](https://hexdocs.pm/plug/1.4.4/Plug.Conn.html#t:t/0)()} ``` Resolve version by string value from request header. This callback can be used to set named channels for API versions, for eg. `latest` header value could be resolved to current date and `edge` to the most recent defined version. Also, it is responsible for casting string value to adapter-specific version type and handling possible errors. You can terminate connection if you want to return error without further processing of the request. Callback implementation for [`Multiverse.Adapter.resolve_version_or_channel/2`](Multiverse.Adapter.html#c:resolve_version_or_channel/2). [Link to this function](#version_comparator/2 "Link to this function") version\_comparator(v1, v2) ``` version_comparator(v1 :: [version](#t:version/0)(), v2 :: [version](#t:version/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Comparator that is used to order and filter versions that should be applied to a connection. It should compare two arguments, and return true if the first argument precedes the second one or they are equal. Callback implementation for [`Multiverse.Adapter.version_comparator/2`](Multiverse.Adapter.html#c:version_comparator/2). Multiverse.Change – multiverse v1.1.0 try { if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; } catch (e) { } Toggle Sidebar Toggle Theme multiverse v1.1.0 Multiverse.Change behaviour =============================================== Provides behaviour for Multiverse API Changes. Examples ----------- ``` defmodule ChangeAccountType do @behaviour Multiverse.Change def handle_request(%Plug.Conn{} = conn) do # Mutate your request here IO.inspect "GateName.mutate_request applied to request" conn end def handle_response(%Plug.Conn{} = conn) do # Mutate your response here IO.inspect "GateName.mutate_response applied to response" conn end end ``` [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [\_\_unsing\_\_(opts)](#__unsing__/1) Macros that can be used if you want to omit either `handle_request/1` or `handle_response/1` callback in your change module [active?(arg1, change)](#active?/2) Checks if change is active on connection or version schema [Callbacks](#callbacks) ------------------------ [handle\_request(conn)](#c:handle_request/1) Defines a request mutator [handle\_response(conn)](#c:handle_response/1) Defines a response mutator [Link to this section](#functions) Functions ============================================== [Link to this macro](#__unsing__/1 "Link to this macro") \_\_unsing\_\_(opts) (macro) Macros that can be used if you want to omit either `handle_request/1` or `handle_response/1` callback in your change module. [Link to this function](#active?/2 "Link to this function") active?(arg1, change) ``` active?( conn_or_version_schema :: [Plug.Conn.t](https://hexdocs.pm/plug/1.4.4/Plug.Conn.html#t:t/0)() | [Multiverse.VersionSchema.t](Multiverse.VersionSchema.html#t:t/0)(), change :: [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Checks if change is active on connection or version schema. [Link to this section](#callbacks) Callbacks ============================================== [Link to this callback](#c:handle_request/1 "Link to this callback") handle\_request(conn) ``` handle_request(conn :: [Plug.Conn.t](https://hexdocs.pm/plug/1.4.4/Plug.Conn.html#t:t/0)()) :: [Plug.Conn.t](https://hexdocs.pm/plug/1.4.4/Plug.Conn.html#t:t/0)() ``` Defines a request mutator. This function will be called whenever Cowboy receives request. [Link to this callback](#c:handle_response/1 "Link to this callback") handle\_response(conn) ``` handle_response(conn :: [Plug.Conn.t](https://hexdocs.pm/plug/1.4.4/Plug.Conn.html#t:t/0)()) :: [Plug.Conn.t](https://hexdocs.pm/plug/1.4.4/Plug.Conn.html#t:t/0)() ``` Defines a response mutator. This function will be called before Cowboy is dispatched response to a consumer. Multiverse.VersionSchema – multiverse v1.1.0 try { if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; } catch (e) { } Toggle Sidebar Toggle Theme multiverse v1.1.0 Multiverse.VersionSchema ============================================ This module defines schema that is assigned to `conn.private[:multiverse_version_schema]` and can be used by third-party libraries to store or process API version and changes data. Available attributes ----------------------- * `adapter` - adapter which were used to handle connection; * `version` - version which is assigned for consumer connection; * `changes` - ordered list of changes that were applied to the connection. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ====================================== [Link to this type](#t:t/0 "Link to this type") t() ``` t() :: %Multiverse.VersionSchema{ adapter: [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), changes: [[module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()], version: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() } ```
membrane_rtp_format
hex
Membrane.RTCP β€” Membrane RTP format v0.7.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/membraneframework/membrane_rtp_format/blob/v0.7.0/lib/rtcp.ex#L1 "View Source") Membrane.RTCP (Membrane RTP format v0.7.0) ======================================================================================================================================================================== Description of RTCP stream. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/membraneframework/membrane_rtp_format/blob/v0.7.0/lib/rtcp.ex#L6 "View Source") ``` @type t() :: %Membrane.RTCP{} ``` Membrane.RTP β€” Membrane RTP format v0.7.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/membraneframework/membrane_rtp_format/blob/v0.7.0/lib/rtp.ex#L1 "View Source") Membrane.RTP (Membrane RTP format v0.7.0) ====================================================================================================================================================================== This module provides caps struct for RTP packet. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [clock\_rate\_t()](#t:clock_rate_t/0) Rate of the clock used for RTP timestamps in Hz [dynamic\_encoding\_name\_t()](#t:dynamic_encoding_name_t/0) Dynamically assigned encoding names for payload types >= 96 [dynamic\_payload\_type\_t()](#t:dynamic_payload_type_t/0) RTP payload type that can be dynamically mapped to encoding and clock rate. [encoding\_name\_t()](#t:encoding_name_t/0) Encoding name of RTP payload. [payload\_type\_t()](#t:payload_type_t/0) RTP payload type. [ssrc\_t()](#t:ssrc_t/0) The source of a stream of RTP packets, identified by a 32-bit numeric identifier. [static\_encoding\_name\_t()](#t:static_encoding_name_t/0) Predefined names of encoding for static payload types (< 96). [static\_payload\_type\_t()](#t:static_payload_type_t/0) RTP payload type that is statically mapped to encoding and clock rate. [t()](#t:t/0) [Functions](#functions) ------------------------ [is\_payload\_type\_dynamic(payload\_type)](#is_payload_type_dynamic/1) Determines if payload type is [`dynamic_payload_type_t/0`](#t:dynamic_payload_type_t/0). [is\_payload\_type\_static(payload\_type)](#is_payload_type_static/1) Determines if payload type is [`static_payload_type_t/0`](#t:static_payload_type_t/0). [Link to this section](#types) Types ===================================== [Link to this type](#t:clock_rate_t/0 "Link to this type") clock\_rate\_t() ================ [View Source](https://github.com/membraneframework/membrane_rtp_format/blob/v0.7.0/lib/rtp.ex#L63 "View Source") ``` @type clock_rate_t() :: [non\_neg\_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Rate of the clock used for RTP timestamps in Hz [Link to this type](#t:dynamic_encoding_name_t/0 "Link to this type") dynamic\_encoding\_name\_t() ============================ [View Source](https://github.com/membraneframework/membrane_rtp_format/blob/v0.7.0/lib/rtp.ex#L53 "View Source") ``` @type dynamic_encoding_name_t() :: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Dynamically assigned encoding names for payload types >= 96 They should be atoms matching the encoding name in SDP's attribute `rtpmap`. This is usually defined by RFC for that payload format (e.g. for H264 there's RFC 6184 defining it must be "H264", so the atom `:H264` should be used <https://tools.ietf.org/html/rfc6184#section-8.2.1>) [Link to this type](#t:dynamic_payload_type_t/0 "Link to this type") dynamic\_payload\_type\_t() =========================== [View Source](https://github.com/membraneframework/membrane_rtp_format/blob/v0.7.0/lib/rtp.ex#L14 "View Source") ``` @type dynamic_payload_type_t() :: 96..127 ``` RTP payload type that can be dynamically mapped to encoding and clock rate. [Link to this type](#t:encoding_name_t/0 "Link to this type") encoding\_name\_t() =================== [View Source](https://github.com/membraneframework/membrane_rtp_format/blob/v0.7.0/lib/rtp.ex#L58 "View Source") ``` @type encoding_name_t() :: [static\_encoding\_name\_t](#t:static_encoding_name_t/0)() | [dynamic\_encoding\_name\_t](#t:dynamic_encoding_name_t/0)() ``` Encoding name of RTP payload. [Link to this type](#t:payload_type_t/0 "Link to this type") payload\_type\_t() ================== [View Source](https://github.com/membraneframework/membrane_rtp_format/blob/v0.7.0/lib/rtp.ex#L19 "View Source") ``` @type payload_type_t() :: [static\_payload\_type\_t](#t:static_payload_type_t/0)() | [dynamic\_payload\_type\_t](#t:dynamic_payload_type_t/0)() ``` RTP payload type. [Link to this type](#t:ssrc_t/0 "Link to this type") ssrc\_t() ========= [View Source](https://github.com/membraneframework/membrane_rtp_format/blob/v0.7.0/lib/rtp.ex#L68 "View Source") ``` @type ssrc_t() :: [pos\_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` The source of a stream of RTP packets, identified by a 32-bit numeric identifier. [Link to this type](#t:static_encoding_name_t/0 "Link to this type") static\_encoding\_name\_t() =========================== [View Source](https://github.com/membraneframework/membrane_rtp_format/blob/v0.7.0/lib/rtp.ex#L24 "View Source") ``` @type static_encoding_name_t() :: :PCMU | :GSM | :G732 | :DVI4 | :LPC | :PCMA | :G722 | :L16 | :QCELP | :CN | :MPA | :G728 | :G729 | :CELB | :JPEG | :NV | :H261 | :MPV | :MP2T | :H263 ``` Predefined names of encoding for static payload types (< 96). [Link to this type](#t:static_payload_type_t/0 "Link to this type") static\_payload\_type\_t() ========================== [View Source](https://github.com/membraneframework/membrane_rtp_format/blob/v0.7.0/lib/rtp.ex#L9 "View Source") ``` @type static_payload_type_t() :: 0..95 ``` RTP payload type that is statically mapped to encoding and clock rate. [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/membraneframework/membrane_rtp_format/blob/v0.7.0/lib/rtp.ex#L70 "View Source") ``` @type t() :: %Membrane.RTP{} ``` [Link to this section](#functions) Functions ============================================= [Link to this macro](#is_payload_type_dynamic/1 "Link to this macro") is\_payload\_type\_dynamic(payload\_type) ========================================= [View Source](https://github.com/membraneframework/membrane_rtp_format/blob/v0.7.0/lib/rtp.ex#L82 "View Source") (macro) Determines if payload type is [`dynamic_payload_type_t/0`](#t:dynamic_payload_type_t/0). [Link to this macro](#is_payload_type_static/1 "Link to this macro") is\_payload\_type\_static(payload\_type) ======================================== [View Source](https://github.com/membraneframework/membrane_rtp_format/blob/v0.7.0/lib/rtp.ex#L77 "View Source") (macro) Determines if payload type is [`static_payload_type_t/0`](#t:static_payload_type_t/0). Membrane.RTP.PayloadFormat β€” Membrane RTP format v0.7.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/membraneframework/membrane_rtp_format/blob/v0.7.0/lib/rtp/payload_format.ex#L1 "View Source") Membrane.RTP.PayloadFormat (Membrane RTP format v0.7.0) =================================================================================================================================================================================================== This module contains utilities for resolving RTP default payload types, encoding names, clock rates and (de)payloaders. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [get(encoding\_name)](#get/1) Returns payload format registered for given encoding name. [get\_payload\_type\_mapping(payload\_type)](#get_payload_type_mapping/1) Returns encoding name and clock rate for given payload type, if registered. [register(payload\_format)](#register/1) Registers payload format. [register\_payload\_type\_mapping(payload\_type, encoding\_name, clock\_rate)](#register_payload_type_mapping/3) Registers default encoding name and clock rate for a dynamic payload\_type [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/membraneframework/membrane_rtp_format/blob/v0.7.0/lib/rtp/payload_format.ex#L52 "View Source") ``` @type t() :: %Membrane.RTP.PayloadFormat{ depayloader: [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, encoding_name: [Membrane.RTP.encoding\_name\_t](Membrane.RTP.html#t:encoding_name_t/0)(), frame_detector: ([binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() -> [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) | nil, keyframe_detector: ([binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() -> [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) | nil, payload_type: [Membrane.RTP.payload\_type\_t](Membrane.RTP.html#t:payload_type_t/0)() | nil, payloader: [module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#get/1 "Link to this function") get(encoding\_name) =================== [View Source](https://github.com/membraneframework/membrane_rtp_format/blob/v0.7.0/lib/rtp/payload_format.ex#L110 "View Source") ``` @spec get([Membrane.RTP.encoding\_name\_t](Membrane.RTP.html#t:encoding_name_t/0)()) :: [t](#t:t/0)() ``` Returns payload format registered for given encoding name. [Link to this function](#get_payload_type_mapping/1 "Link to this function") get\_payload\_type\_mapping(payload\_type) ========================================== [View Source](https://github.com/membraneframework/membrane_rtp_format/blob/v0.7.0/lib/rtp/payload_format.ex#L79 "View Source") ``` @spec get_payload_type_mapping([Membrane.RTP.payload\_type\_t](Membrane.RTP.html#t:payload_type_t/0)()) :: %{ optional(:encoding_name) => [Membrane.RTP.encoding\_name\_t](Membrane.RTP.html#t:encoding_name_t/0)(), optional(:clock_rate) => [Membrane.RTP.clock\_rate\_t](Membrane.RTP.html#t:clock_rate_t/0)() } ``` Returns encoding name and clock rate for given payload type, if registered. [Link to this function](#register/1 "Link to this function") register(payload\_format) ========================= [View Source](https://github.com/membraneframework/membrane_rtp_format/blob/v0.7.0/lib/rtp/payload_format.ex#L120 "View Source") ``` @spec register([t](#t:t/0)()) :: :ok | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Registers payload format. Raises if some payload format field was already registered and set to different value. [Link to this function](#register_payload_type_mapping/3 "Link to this function") register\_payload\_type\_mapping(payload\_type, encoding\_name, clock\_rate) ============================================================================ [View Source](https://github.com/membraneframework/membrane_rtp_format/blob/v0.7.0/lib/rtp/payload_format.ex#L95 "View Source") ``` @spec register_payload_type_mapping( [Membrane.RTP.dynamic\_payload\_type\_t](Membrane.RTP.html#t:dynamic_payload_type_t/0)(), [Membrane.RTP.encoding\_name\_t](Membrane.RTP.html#t:encoding_name_t/0)(), [Membrane.RTP.clock\_rate\_t](Membrane.RTP.html#t:clock_rate_t/0)() ) :: :ok | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Registers default encoding name and clock rate for a dynamic payload\_type Membrane.SRTP.KeyingMaterialEvent β€” Membrane RTP format v0.7.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/membraneframework/membrane_rtp_format/blob/v0.7.0/lib/srtp_keying_material_event.ex#L1 "View Source") Membrane.SRTP.KeyingMaterialEvent (Membrane RTP format v0.7.0) ================================================================================================================================================================================================================== Event containing keying material for SRTP encryptor and decryptor. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) Type describing [`Membrane.SRTP.KeyingMaterialEvent`](Membrane.SRTP.KeyingMaterialEvent.html#content) struct. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/membraneframework/membrane_rtp_format/blob/v0.7.0/lib/srtp_keying_material_event.ex#L20 "View Source") ``` @type t() :: %Membrane.SRTP.KeyingMaterialEvent{ local_keying_material: [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), protection_profile: [pos\_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), remote_keying_material: [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() } ``` Type describing [`Membrane.SRTP.KeyingMaterialEvent`](Membrane.SRTP.KeyingMaterialEvent.html#content) struct. Keying material consists of master key and master salt and is used by SRTP internally to generate actual keys. `local_keying_material` is used for deriving key for encryption while `remote_keying_material` is used for deriving key for decryption. For more information refer to RFC 3711 section 4.3 or RFC 5764 section 4.2. `protection_profile` is `pos_integer()` refering to cryptographic algorithm used for negotiating local and remote keying material. For more information refer to <https://www.iana.org/assignments/srtp-protection/srtp-protection.xhtml> Membrane Multimedia Framework: RTP format description β€” Membrane RTP format v0.7.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/membraneframework/membrane_rtp_format/blob/v0.7.0/README.md#L1 "View Source") Membrane Multimedia Framework: RTP format description ================================================================================================================================================================================= [![Hex.pm](https://img.shields.io/hexpm/v/membrane_rtp_format.svg)](https://hex.pm/packages/membrane_rtp_format) [![API Docs](https://img.shields.io/badge/api-docs-yellow.svg?style=flat)](https://hexdocs.pm/membrane_rtp_format/) [![CircleCI](https://circleci.com/gh/membraneframework/membrane_rtp_format.svg?style=svg)](https://circleci.com/gh/membraneframework/membrane_rtp_format) This package provides structures describing RTP/RTCP streams. They can be used to define capabilities of pads for the [Membrane](https://membraneframework.org) Elements. [installation](#installation) Installation -------------------------------------------- Unless you're developing an Membrane Element it's unlikely that you need to use this package directly in your app, as normally it is going to be fetched as a dependency of any element that operates on RTP packets. However, if you are developing an Element or need to add it due to any other reason, just add the following line to your `deps` in the `mix.exs` and run [`mix deps.get`](https://hexdocs.pm/mix/Mix.Tasks.Deps.Get.html). ``` {:membrane\_rtp\_format, "~> 0.7.0"} ``` [copyright-and-license](#copyright-and-license) Copyright and License ----------------------------------------------------------------------- Copyright 2018, [Software Mansion](https://swmansion.com/?utm_source=git&utm_medium=readme&utm_campaign=membrane_rtp_format) [![Software Mansion](https://logo.swmansion.com/logo?color=white&variant=desktop&width=200&tag=membrane-github)](https://swmansion.com/?utm_source=git&utm_medium=readme&utm_campaign=membrane_rtp_format) Licensed under the [Apache License, Version 2.0](license.html) [← Previous Page API Reference](api-reference.html) [Next Page β†’ LICENSE](license.html)
google_api_cloud_channel
hex
API Reference β€” google\_api\_cloud\_channel v0.3.3 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } Settings API Reference google\_api\_cloud\_channel v0.3.3 =============================================================
sleeplocks
hex
sleeplocks β€” sleeplocks v1.1.2 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/whitfin/sleeplocks/blob/v1.1.2/README.md#L1 "View Source") sleeplocks =================================================================================================================== [![Build Status](https://img.shields.io/github/workflow/status/whitfin/sleeplocks/CI)](https://github.com/whitfin/sleeplocks/actions) [![Hex.pm Version](https://img.shields.io/hexpm/v/sleeplocks.svg)](https://hex.pm/packages/sleeplocks) [![Documentation](https://img.shields.io/badge/docs-latest-blue.svg)](https://hexdocs.pm/sleeplocks/) This library is designed to provide simple locking mechanisms in Erlang/Elixir, similar to how spinlocks work in other languages - except using messages to communicate locking. This is useful for libraries which require lock synchronization, without having to roll your own (however simple). Locks can be held by arbitrary numbers of process, making it possible to implement various throttling mechanisms. Best of all, this library is tiny! It builds upon basic OTP principles to implement lock behaviour via simple processes and message passing. [installation](#installation) Installation -------------------------------------------- ### [rebar](#rebar) Rebar Follow the instructons found [here](https://hex.pm/docs/rebar3_usage) to configure your Rebar setup to use Hex as a dependency source, then you can grab it directly: ``` {deps,[ % pulls the latest version sleeplocks, % to pull the latest version from github {sleeplocks, {git, "git://github.com/whitfin/sleeplocks.git"}} ]}. ``` ### [mix](#mix) Mix To install it for your project, you can pull it directly from Hex. Rather than use the version shown below, you can use the latest version from Hex (shown at the top of this README). ``` def deps do [{:sleeplocks, "~> 1.0"}] end ``` [usage](#usage) Usage ----------------------- Snippets below contain sample usage in both Erlang and Elixir, and cover most of the small API space offered by `sleeplocks`. For a more complete example, scroll down! ### [erlang](#erlang) Erlang ``` % create a new single lock (with a name) 1> sleeplocks:new(1, [{name, {local, my\_lock}}]). {ok,<0.179.0>} % take ownership of the lock 2> sleeplocks:acquire(my\_lock). ok % release the current hold on a lock 3> sleeplocks:release(my\_lock). ok % attempt to acquire a lock (which will succeed) 4> sleeplocks:attempt(my\_lock). ok % now that it's taken, other attempts will fail 5> sleeplocks:attempt(my\_lock). {error,unavailable} % release the lock again 6> sleeplocks:release(my\_lock). ok % handle acquisition and locking automatically 7> sleeplocks:execute(my\_lock, fun() -> 7> 3 7> end). 3 ``` ### [elixir](#elixir) Elixir ``` # create a new single lock (with a name) iex(1)> :sleeplocks.new(1, [ name: :my\_lock ]) {:ok, #PID<0.179.0>} # take ownership of the lock iex(2)> :sleeplocks.acquire(:my\_lock) :ok # release the current hold on a lock iex(3)> :sleeplocks.release(:my\_lock) :ok # attempt to acquire a lock (which will succeed) iex(4)> :sleeplocks.attempt(:my\_lock) :ok # now that it's taken, other attempts will fail iex(5)> :sleeplocks.attempt(:my\_lock) {:error, :unavailable} # release the lock again iex(6)> :sleeplocks.release(:my\_lock) :ok # handle acquisition and locking automatically iex(7)> :sleeplocks.execute(:my\_lock, fn -> iex(7)> 3 iex(7)> end) 3 ``` [examples](#examples) Examples -------------------------------- This example is in Elixir, but it should be fairly understandable for those coming from both languages. It simply spawns 6 processes which each attempt to hold a lock for 10 seconds. As the lock is created with only 2 slots, this runs for 30 seconds and 2 of our spawned tasks can hold the lock at any given time. ``` # First create a new lock, with 2 slots only {:ok, ref} = :sleeplocks.new(2) # Then spawn 6 tasks, which each just sleep for 10 seconds # after acquiring the lock. This means that 2 processes will # acquire a lock and then release after 10 seconds. This # will repeat 3 times (6 / 2) until 30 seconds are up. for idx <- 1..6 do Task.start(fn -> :sleeplocks.execute(ref, fn -> IO.puts("Locked #{idx}") Process.sleep(10\_000) IO.puts("Releasing #{idx}") end) end) end ``` [← Previous Page API Reference](api-reference.html) [Next Page β†’ LICENSE](license.html) sleeplocks β€” sleeplocks v1.1.2 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/whitfin/sleeplocks/blob/v1.1.2/src/sleeplocks.erl#L13 "View Source") sleeplocks (sleeplocks v1.1.2) ================================================================================================================================================= BEAM friendly spinlocks for Elixir/Erlang. This module provides a very simple API for managing locks inside a BEAM instance. It's modeled on spinlocks, but works through message passing rather than loops. Locks can have multiple slots to enable arbitrary numbers of associated processes. The moment a slot is freed, the next awaiting process acquires the lock. All of this is done in a simple Erlang process so there's very little dependency, and management is extremely simple. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [name/0](#t:name/0) [start\_ret/0](#t:start_ret/0) [Functions](#functions) ------------------------ [acquire(Name)](#acquire/1) Acquires a lock for the current process. [attempt(Name)](#attempt/1) Attempts to acquire a lock for the current process. [code\_change(Vsn, Lock, Extra)](#code_change/3) [execute(Name, Exec)](#execute/2) Executes a function when a lock can be acquired. [handle\_call(\_, Caller, Lock)](#handle_call/3) [handle\_cast(Msg, Lock)](#handle_cast/2) [handle\_info(Msg, Lock)](#handle_info/2) [init(Slots)](#init/1) [new(Slots)](#new/1) Creates a new lock with a provided concurrency factor. [new(Slots, Args)](#new/2) Creates a new lock with a provided concurrency factor. [release(Name)](#release/1) Releases a lock held by the current process. [start\_link(Slots)](#start_link/1) [start\_link(Slots, Args)](#start_link/2) [terminate(Reason, Lock)](#terminate/2) [Link to this section](#types) Types ===================================== [Link to this type](#t:name/0 "Link to this type") name/0 ====== [View Source](https://github.com/whitfin/sleeplocks/blob/v1.1.2/src/sleeplocks.erl#L27 "View Source") ``` -type name() :: atom() | {local, Name :: atom()} | {global, GlobalName :: any()} | {via, Module :: atom(), ViaName :: any()}. ``` [Link to this type](#t:start_ret/0 "Link to this type") start\_ret/0 ============ [View Source](https://github.com/whitfin/sleeplocks/blob/v1.1.2/src/sleeplocks.erl#L34 "View Source") ``` -type start_ret() :: {ok, pid()} | ignore | {error, term()}. ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#acquire/1 "Link to this function") acquire(Name) ============= [View Source](https://github.com/whitfin/sleeplocks/blob/v1.1.2/src/sleeplocks.erl#L67 "View Source") ``` -spec acquire(Name :: [name](#t:name/0)()) -> ok. ``` Acquires a lock for the current process. This will block until a lock can be acquired. [Link to this function](#attempt/1 "Link to this function") attempt(Name) ============= [View Source](https://github.com/whitfin/sleeplocks/blob/v1.1.2/src/sleeplocks.erl#L76 "View Source") ``` -spec attempt(Name :: [name](#t:name/0)()) -> ok | {error, unavailable}. ``` Attempts to acquire a lock for the current process. In the case there are no slots available, an error will be returned immediately rather than waiting. [Link to this function](#code_change/3 "Link to this function") code\_change(Vsn, Lock, Extra) ============================== [View Source](https://github.com/whitfin/sleeplocks/blob/v1.1.2/src/sleeplocks.erl#L168 "View Source") [Link to this function](#execute/2 "Link to this function") execute(Name, Exec) =================== [View Source](https://github.com/whitfin/sleeplocks/blob/v1.1.2/src/sleeplocks.erl#L85 "View Source") ``` -spec execute(Name :: [name](#t:name/0)(), Exec :: fun(() -> any())) -> any(). ``` Executes a function when a lock can be acquired. The lock is automatically released after the function has completed execution; there's no need to manually release. [Link to this function](#handle_call/3 "Link to this function") handle\_call(\_, Caller, Lock) ============================== [View Source](https://github.com/whitfin/sleeplocks/blob/v1.1.2/src/sleeplocks.erl#L122 "View Source") [Link to this function](#handle_cast/2 "Link to this function") handle\_cast(Msg, Lock) ======================= [View Source](https://github.com/whitfin/sleeplocks/blob/v1.1.2/src/sleeplocks.erl#L153 "View Source") [Link to this function](#handle_info/2 "Link to this function") handle\_info(Msg, Lock) ======================= [View Source](https://github.com/whitfin/sleeplocks/blob/v1.1.2/src/sleeplocks.erl#L158 "View Source") [Link to this function](#init/1 "Link to this function") init(Slots) =========== [View Source](https://github.com/whitfin/sleeplocks/blob/v1.1.2/src/sleeplocks.erl#L117 "View Source") [Link to this function](#new/1 "Link to this function") new(Slots) ========== [View Source](https://github.com/whitfin/sleeplocks/blob/v1.1.2/src/sleeplocks.erl#L43 "View Source") ``` -spec new(Slots :: pos_integer()) -> [start\_ret](#t:start_ret/0)(). ``` Creates a new lock with a provided concurrency factor. [Link to this function](#new/2 "Link to this function") new(Slots, Args) ================ [View Source](https://github.com/whitfin/sleeplocks/blob/v1.1.2/src/sleeplocks.erl#L49 "View Source") ``` -spec new(Slots :: pos_integer(), Args :: list()) -> [start\_ret](#t:start_ret/0)(). ``` Creates a new lock with a provided concurrency factor. [Link to this function](#release/1 "Link to this function") release(Name) ============= [View Source](https://github.com/whitfin/sleeplocks/blob/v1.1.2/src/sleeplocks.erl#L96 "View Source") ``` -spec release(Name :: [name](#t:name/0)()) -> ok. ``` Releases a lock held by the current process. [Link to this function](#start_link/1 "Link to this function") start\_link(Slots) ================== [View Source](https://github.com/whitfin/sleeplocks/blob/v1.1.2/src/sleeplocks.erl#L102 "View Source") ``` -spec start_link(Slots :: pos_integer()) -> [start\_ret](#t:start_ret/0)(). ``` [Link to this function](#start_link/2 "Link to this function") start\_link(Slots, Args) ======================== [View Source](https://github.com/whitfin/sleeplocks/blob/v1.1.2/src/sleeplocks.erl#L108 "View Source") ``` -spec start_link(Slots :: pos_integer(), Args :: list()) -> [start\_ret](#t:start_ret/0)(). ``` [Link to this function](#terminate/2 "Link to this function") terminate(Reason, Lock) ======================= [View Source](https://github.com/whitfin/sleeplocks/blob/v1.1.2/src/sleeplocks.erl#L163 "View Source")
ueberauth_vk
hex
Ueberauth.Strategy.VK – Ueberauth VK Strategy v0.3.0 try { if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; } catch (e) { } Toggle Sidebar Toggle Theme Ueberauth VK Strategy v0.3.0 Ueberauth.Strategy.VK [View Source](https://github.com/sobolevn/ueberauth_vk/blob/master/lib/ueberauth/strategy/vk.ex#L1 "View Source") ========================================================================================================================================================================= VK Strategy for Überauth. ### Setup Create an VK application for you to use. Register a new application at: [VK devs](https://vk.com/dev) and get the `client_id` and `client_secret`. Include the provider in your configuration for Ueberauth ``` config :ueberauth, Ueberauth, providers: [ vk: { Ueberauth.Strategy.VK, [] } ] ``` Then include the configuration for github. ``` config :ueberauth, Ueberauth.Strategy.VK.OAuth, client_id: System.get_env("VK_CLIENT_ID"), client_secret: System.get_env("VK_CLIENT_SECRET"), ``` If you haven’t already, create a pipeline and setup routes for your callback handler ``` pipeline :auth do Ueberauth.plug "/auth" end scope "/auth" do pipe_through [:browser, :auth] get "/:provider/callback", AuthController, :callback end ``` Create an endpoint for the callback where you will handle the [`Ueberauth.Auth`](https://hexdocs.pm/ueberauth/0.5.0/Ueberauth.Auth.html) struct ``` defmodule MyApp.AuthController do use MyApp.Web, :controller def callback_phase(%{ assigns: %{ ueberauth_failure: fails } } = conn, _params) do # do things with the failure end def callback_phase(%{ assigns: %{ ueberauth_auth: auth } } = conn, params) do # do things with the auth end end ``` You can edit the behaviour of the Strategy by including some options when you register your provider. You can customize [multiple fields](https://vk.com/dev/auth_sites), such as `default_scope`, `default_display`, `default_state`, `profile_fields`, `uid_field` ``` config :ueberauth, Ueberauth, providers: [ vk: { Ueberauth.Strategy.VK, [ default_scope: "email,friends,video,offline", default_display: "popup", default_state: "secret-state-value", uid_field: :email ] } ] ``` Default is empty (β€œβ€) which β€œGrants read-only access to public information (includes public user profile info, public repository info, and gists)” [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [auth(conn)](#auth/1) [credentials(conn)](#credentials/1) Includes the credentials from the VK response [default\_options()](#default_options/0) [extra(conn)](#extra/1) Stores the raw information (including the token) obtained from the vk callback [handle\_request!(conn)](#handle_request!/1) Handles initial request for VK authentication [info(conn)](#info/1) Fetches the fields to populate the info section of the [`Ueberauth.Auth`](https://hexdocs.pm/ueberauth/0.5.0/Ueberauth.Auth.html) struct [uid(conn)](#uid/1) Fetches the uid field from the response [Link to this section](#functions) Functions ============================================== [Link to this function](#auth/1 "Link to this function") auth(conn) [View Source](https://github.com/sobolevn/ueberauth_vk/blob/master/lib/ueberauth/strategy/vk.ex#L65 "View Source") [Link to this function](#credentials/1 "Link to this function") credentials(conn) [View Source](https://github.com/sobolevn/ueberauth_vk/blob/master/lib/ueberauth/strategy/vk.ex#L148 "View Source") Includes the credentials from the VK response. [Link to this function](#default_options/0 "Link to this function") default\_options() [View Source](https://github.com/sobolevn/ueberauth_vk/blob/master/lib/ueberauth/strategy/vk.ex#L65 "View Source") [Link to this function](#extra/1 "Link to this function") extra(conn) [View Source](https://github.com/sobolevn/ueberauth_vk/blob/master/lib/ueberauth/strategy/vk.ex#L188 "View Source") Stores the raw information (including the token) obtained from the vk callback. [Link to this function](#handle_request!/1 "Link to this function") handle\_request!(conn) [View Source](https://github.com/sobolevn/ueberauth_vk/blob/master/lib/ueberauth/strategy/vk.ex#L83 "View Source") Handles initial request for VK authentication. [Link to this function](#info/1 "Link to this function") info(conn) [View Source](https://github.com/sobolevn/ueberauth_vk/blob/master/lib/ueberauth/strategy/vk.ex#L166 "View Source") Fetches the fields to populate the info section of the [`Ueberauth.Auth`](https://hexdocs.pm/ueberauth/0.5.0/Ueberauth.Auth.html) struct. [Link to this function](#uid/1 "Link to this function") uid(conn) [View Source](https://github.com/sobolevn/ueberauth_vk/blob/master/lib/ueberauth/strategy/vk.ex#L136 "View Source") Fetches the uid field from the response. Ueberauth.Strategy.VK.OAuth – Ueberauth VK Strategy v0.3.0 try { if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; } catch (e) { } Toggle Sidebar Toggle Theme Ueberauth VK Strategy v0.3.0 Ueberauth.Strategy.VK.OAuth [View Source](https://github.com/sobolevn/ueberauth_vk/blob/master/lib/ueberauth/strategy/vk/oauth.ex#L1 "View Source") ===================================================================================================================================================================================== OAuth2 for VK. Add `client_id` and `client_secret` to your configuration: ``` config :ueberauth, Ueberauth.Strategy.VK.OAuth, client_id: System.get_env("VK_APP_ID"), client_secret: System.get_env("VK_APP_SECRET") ``` [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [authorize\_url(client, params)](#authorize_url/2) [authorize\_url!(params \\ [], opts \\ [])](#authorize_url!/2) Provides the authorize url for the request phase of Ueberauth. No need to call this usually [client(opts \\ [])](#client/1) Construct a client for requests to vk.com [get\_token(client, params, headers)](#get_token/3) [get\_token!(params \\ [], opts \\ [])](#get_token!/2) [Link to this section](#functions) Functions ============================================== [Link to this function](#authorize_url/2 "Link to this function") authorize\_url(client, params) [View Source](https://github.com/sobolevn/ueberauth_vk/blob/master/lib/ueberauth/strategy/vk/oauth.ex#L60 "View Source") [Link to this function](#authorize_url!/2 "Link to this function") authorize\_url!(params \\ [], opts \\ []) [View Source](https://github.com/sobolevn/ueberauth_vk/blob/master/lib/ueberauth/strategy/vk/oauth.ex#L45 "View Source") Provides the authorize url for the request phase of Ueberauth. No need to call this usually. [Link to this function](#client/1 "Link to this function") client(opts \\ []) [View Source](https://github.com/sobolevn/ueberauth_vk/blob/master/lib/ueberauth/strategy/vk/oauth.ex#L30 "View Source") Construct a client for requests to vk.com This will be setup automatically for you in [`Ueberauth.Strategy.VK`](Ueberauth.Strategy.VK.html). These options are only useful for usage outside the normal callback phase of Ueberauth. [Link to this function](#get_token/3 "Link to this function") get\_token(client, params, headers) [View Source](https://github.com/sobolevn/ueberauth_vk/blob/master/lib/ueberauth/strategy/vk/oauth.ex#L64 "View Source") [Link to this function](#get_token!/2 "Link to this function") get\_token!(params \\ [], opts \\ []) [View Source](https://github.com/sobolevn/ueberauth_vk/blob/master/lib/ueberauth/strategy/vk/oauth.ex#L51 "View Source")
polymorphic_embed
hex
Polymorphic embeds for Ecto β€” Polymorphic Embed v3.0.3 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/mathieuprog/polymorphic_embed/blob/v3.0.3/README.md#L1 "View Source") Polymorphic embeds for Ecto =============================================================================================================================================== `polymorphic_embed` brings support for polymorphic/dynamic embedded schemas in Ecto. Ecto's `embeds_one` and `embeds_many` macros require a specific schema module to be specified. This library removes this restriction by **dynamically** determining which schema to use, based on data to be stored (from a form or API) and retrieved (from the data source). [usage](#usage) Usage ----------------------- ### [enable-polymorphism](#enable-polymorphism) Enable polymorphism Let's say we want a schema `Reminder` representing a reminder for an event, that can be sent either by email or SMS. We create the `Email` and `SMS` embedded schemas containing the fields that are specific for each of those communication channels. The `Reminder` schema can then contain a `:channel` field that will either hold an `Email` or `SMS` struct, by setting its type to the custom type [`PolymorphicEmbed`](PolymorphicEmbed.html) that this library provides. Find the schema code and explanations below. ``` defmodule MyApp.Reminder do use Ecto.Schema import Ecto.Changeset import PolymorphicEmbed schema "reminders" do field :date, :utc\_datetime field :text, :string polymorphic\_embeds\_one :channel, types: [ sms: MyApp.Channel.SMS, email: MyApp.Channel.Email ], on\_type\_not\_found: :raise, on\_replace: :update end def changeset(struct, values) do struct |> cast(values, [:date, :text]) |> cast\_polymorphic\_embed(:channel, required: true) |> validate\_required(:date) end end ``` ``` defmodule MyApp.Channel.Email do use Ecto.Schema import Ecto.Changeset @primary\_key false embedded\_schema do field :address, :string field :confirmed, :boolean end def changeset(email, params) do email |> cast(params, ~w(address confirmed)a) |> validate\_required(:address) |> validate\_length(:address, min: 4) end end ``` ``` defmodule MyApp.Channel.SMS do use Ecto.Schema @primary\_key false embedded\_schema do field :number, :string end end ``` In your migration file, you may use the type `:map` for both `polymorphic_embeds_one/2` and `polymorphic_embeds_many/2` fields. ``` add(:channel, :map) ``` [It is not recommended](https://hexdocs.pm/ecto/3.8.4/Ecto.Schema.html#embeds_many/3) to use `{:array, :map}` for a list of embeds. ### [cast\_polymorphic\_embed-3](#cast_polymorphic_embed-3) `cast_polymorphic_embed/3` `cast_polymorphic_embed/3` must be called to cast the polymorphic embed's parameters. #### Options * `:required` – if the embed is a required field. * `:with` – allows you to specify a custom changeset. Either pass an MFA or a function: ``` changeset |> cast\_polymorphic\_embed(:channel, with: [ sms: {SMS, :custom\_changeset, ["hello"]}, email: &Email.custom\_changeset/2 ] ) ``` ### [polymorphicembed-ecto-type](#polymorphicembed-ecto-type) PolymorphicEmbed Ecto type The `:types` option for the [`PolymorphicEmbed`](PolymorphicEmbed.html) custom type contains a keyword list mapping an atom representing the type (in this example `:email` and `:sms`) with the corresponding embedded schema module. There are two strategies to detect the right embedded schema to use: 1. ``` [sms: MyApp.Channel.SMS] ``` When receiving parameters to be casted (e.g. from a form), we expect a `"__type__"` (or `:__type__`) parameter containing the type of channel (`"email"` or `"sms"`). 2. ``` [email: [ module: MyApp.Channel.Email, identify\_by\_fields: [:address, :confirmed]]] ``` Here we specify how the type can be determined based on the presence of given fields. In this example, if the data contains `:address` and `:confirmed` parameters (or their string version), the type is `:email`. A `"__type__"` parameter is then no longer required. Note that you may still include a `__type__` parameter that will take precedence over this strategy (this could still be useful if you need to store incomplete data, which might not allow identifying the type). #### List of polymorphic embeds Lists of polymorphic embeds are also supported: ``` polymorphic\_embeds\_many :contexts, types: [ location: MyApp.Context.Location, age: MyApp.Context.Age, device: MyApp.Context.Device ], on\_type\_not\_found: :raise, on\_replace: :delete ``` #### Options * `:types` – discussed above. * `:type_field` – specify a custom type field. Defaults to `:__type__`. * `:on_type_not_found` – specify what to do if the embed's type cannot be inferred. Possible values are + `:raise`: raise an error + `:changeset_error`: add a changeset error + `:nilify`: replace the data by `nil`; only for single (non-list) embeds + `:ignore`: ignore the data; only for lists of embedsBy default, a changeset error "is invalid" is added. * `:on_replace` – mandatory option that can only be set to `:update` for a single embed and `:delete` for a list of embeds (we force a value as the default value of this option for `embeds_one` and `embeds_many` is `:raise`). ### [displaying-form-inputs-and-errors-in-phoenix-templates](#displaying-form-inputs-and-errors-in-phoenix-templates) Displaying form inputs and errors in Phoenix templates The library comes with a form helper in order to build form inputs for polymorphic embeds and display changeset errors. In the entrypoint defining your web interface (`lib/your_app_web.ex` file), add the following import: ``` def view do quote do # imports and stuff import PolymorphicEmbed.HTML.Form end end ``` This provides you with the `polymorphic_embed_inputs_for/3` and `polymorphic_embed_inputs_for/4` functions. Here is an example form using the imported function: ``` <%= inputs\_for f, :reminders, fn reminder\_form -> %> <%= polymorphic\_embed\_inputs\_for reminder\_form, :channel, :sms, fn sms\_form -> %> <div class="sms-inputs"> <label>Number<label> <%= text\_input sms\_form, :number %> <div class="error"> <%= error\_tag sms\_form, :number %> </div> </div> <% end %> <% end %> ``` When using `polymorphic_embed_inputs_for/4`, you have to manually specify the type. When the embed is `nil`, empty fields will be displayed. `polymorphic_embed_inputs_for/3` doesn't require the type to be specified. When the embed is `nil`, no fields are displayed. They both render a hidden input for the `"__type__"` field. ### [displaying-form-inputs-and-errors-in-liveview](#displaying-form-inputs-and-errors-in-liveview) Displaying form inputs and errors in LiveView You may use `polymorphic_embed_inputs_for/2` when working with LiveView. ``` <.form let={f} for={@changeset} id="reminder-form" phx-change="validate" phx-submit="save" > <%= for channel\_form <- polymorphic\_embed\_inputs\_for f, :channel do %> <%= hidden\_inputs\_for(channel\_form) %> <%= case get\_polymorphic\_type(channel\_form, Reminder, :channel) do %> <% :sms -> %> <%= label channel\_form, :number %> <%= text\_input channel\_form, :number %> <% :email -> %> <%= label channel\_form, :email %> <%= text\_input channel\_form, :email %> <% end %> </.form> ``` Using this function, you have to render the necessary hidden inputs manually as shown above. ### [get-the-type-of-a-polymorphic-embed](#get-the-type-of-a-polymorphic-embed) Get the type of a polymorphic embed Sometimes you need to serialize the polymorphic embed and, once in the front-end, need to distinguish them. `get_polymorphic_type/3` returns the type of the polymorphic embed: ``` PolymorphicEmbed.get\_polymorphic\_type(Reminder, :channel, SMS) == :sms ``` ### [traverse\_errors-2](#traverse_errors-2) `traverse_errors/2` The function `Ecto.changeset.traverse_errors/2` won't include the errors of polymorphic embeds. You may instead use [`PolymorphicEmbed.traverse_errors/2`](PolymorphicEmbed.html#traverse_errors/2) when working with polymorphic embeds. [features](#features) Features -------------------------------- * Detect which types to use for the data being `cast`-ed, based on fields present in the data (no need for a *type* field in the data) * Run changeset validations when a `changeset/2` function is present (when absent, the library will introspect the fields to cast) * Support for nested polymorphic embeds * Support for nested `embeds_one`/`embeds_many` embeds * Display form inputs for polymorphic embeds in Phoenix templates * Tests to ensure code quality [installation](#installation) Installation -------------------------------------------- Add `polymorphic_embed` for Elixir as a dependency in your `mix.exs` file: ``` def deps do [ {:polymorphic\_embed, "~> 3.0.3"} ] end ``` [hexdocs](#hexdocs) HexDocs ----------------------------- HexDocs documentation can be found at <https://hexdocs.pm/polymorphic_embed>. [← Previous Page API Reference](api-reference.html) PolymorphicEmbed β€” Polymorphic Embed v3.0.3 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/mathieuprog/polymorphic_embed/blob/v3.0.3/lib/polymorphic_embed.ex#L1 "View Source") PolymorphicEmbed (Polymorphic Embed v3.0.3) ============================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [cast\_polymorphic\_embed(changeset, field, cast\_options \\ [])](#cast_polymorphic_embed/3) [do\_load(data, loader, map)](#do_load/3) [get\_polymorphic\_module(schema, field, type\_or\_data)](#get_polymorphic_module/3) [get\_polymorphic\_type(schema, field, module\_or\_struct)](#get_polymorphic_type/3) [polymorphic\_embeds\_many(field\_name, opts)](#polymorphic_embeds_many/2) [polymorphic\_embeds\_one(field\_name, opts)](#polymorphic_embeds_one/2) [traverse\_errors(changeset, msg\_func)](#traverse_errors/2) [types(schema, field)](#types/2) Returns the possible types for a given schema and field [Link to this section](#functions) Functions ============================================= [Link to this function](#cast_polymorphic_embed/3 "Link to this function") cast\_polymorphic\_embed(changeset, field, cast\_options \\ []) =============================================================== [View Source](https://github.com/mathieuprog/polymorphic_embed/blob/v3.0.3/lib/polymorphic_embed.ex#L58 "View Source") [Link to this function](#do_load/3 "Link to this function") do\_load(data, loader, map) =========================== [View Source](https://github.com/mathieuprog/polymorphic_embed/blob/v3.0.3/lib/polymorphic_embed.ex#L277 "View Source") [Link to this function](#get_polymorphic_module/3 "Link to this function") get\_polymorphic\_module(schema, field, type\_or\_data) ======================================================= [View Source](https://github.com/mathieuprog/polymorphic_embed/blob/v3.0.3/lib/polymorphic_embed.ex#L318 "View Source") [Link to this function](#get_polymorphic_type/3 "Link to this function") get\_polymorphic\_type(schema, field, module\_or\_struct) ========================================================= [View Source](https://github.com/mathieuprog/polymorphic_embed/blob/v3.0.3/lib/polymorphic_embed.ex#L353 "View Source") [Link to this macro](#polymorphic_embeds_many/2 "Link to this macro") polymorphic\_embeds\_many(field\_name, opts) ============================================ [View Source](https://github.com/mathieuprog/polymorphic_embed/blob/v3.0.3/lib/polymorphic_embed.ex#L10 "View Source") (macro) [Link to this macro](#polymorphic_embeds_one/2 "Link to this macro") polymorphic\_embeds\_one(field\_name, opts) =========================================== [View Source](https://github.com/mathieuprog/polymorphic_embed/blob/v3.0.3/lib/polymorphic_embed.ex#L4 "View Source") (macro) [Link to this function](#traverse_errors/2 "Link to this function") traverse\_errors(changeset, msg\_func) ====================================== [View Source](https://github.com/mathieuprog/polymorphic_embed/blob/v3.0.3/lib/polymorphic_embed.ex#L425 "View Source") [Link to this function](#types/2 "Link to this function") types(schema, field) ==================== [View Source](https://github.com/mathieuprog/polymorphic_embed/blob/v3.0.3/lib/polymorphic_embed.ex#L373 "View Source") Returns the possible types for a given schema and field you can call [`types/2`](#types/2) like this: ``` PolymorphicEmbed.types(MySchema, :contexts) #=> [:location, :age, :device] ``` PolymorphicEmbed.HTML.Form β€” Polymorphic Embed v3.0.3 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/mathieuprog/polymorphic_embed/blob/v3.0.3/lib/polymorphic_embed/html/form.ex#L2 "View Source") PolymorphicEmbed.HTML.Form (Polymorphic Embed v3.0.3) ================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [get\_polymorphic\_type(form, schema, field)](#get_polymorphic_type/3) Returns the polymorphic type of the given field in the given form data. [polymorphic\_embed\_inputs\_for(form, field)](#polymorphic_embed_inputs_for/2) Generates a new form builder without an anonymous function. [polymorphic\_embed\_inputs\_for(form, field, fun)](#polymorphic_embed_inputs_for/3) Like [`polymorphic_embed_inputs_for/4`](#polymorphic_embed_inputs_for/4), but determines the type from the form data. [polymorphic\_embed\_inputs\_for(form, field, type, fun)](#polymorphic_embed_inputs_for/4) [to\_form(source\_changeset, form, field, type, options)](#to_form/5) [Link to this section](#functions) Functions ============================================= [Link to this function](#get_polymorphic_type/3 "Link to this function") get\_polymorphic\_type(form, schema, field) =========================================== [View Source](https://github.com/mathieuprog/polymorphic_embed/blob/v3.0.3/lib/polymorphic_embed/html/form.ex#L9 "View Source") Returns the polymorphic type of the given field in the given form data. [Link to this function](#polymorphic_embed_inputs_for/2 "Link to this function") polymorphic\_embed\_inputs\_for(form, field) ============================================ [View Source](https://github.com/mathieuprog/polymorphic_embed/blob/v3.0.3/lib/polymorphic_embed/html/form.ex#L63 "View Source") Generates a new form builder without an anonymous function. Similarly to [`Phoenix.HTML.Form.inputs_for/3`](https://hexdocs.pm/phoenix_html/3.2.0/Phoenix.HTML.Form.html#inputs_for/3), this function exists for integration with `Phoenix.LiveView`. Unlike [`polymorphic_embed_inputs_for/4`](#polymorphic_embed_inputs_for/4), this function does not generate hidden inputs. [example](#polymorphic_embed_inputs_for/2-example) Example ------------------------------------------------------------ ``` <.form let={f} for={@changeset} id="reminder-form" phx-change="validate" phx-submit="save" > <%= for channel\_form <- polymorphic\_embed\_inputs\_for f, :channel do %> <%= hidden\_inputs\_for(channel\_form) %> <%= case get\_polymorphic\_type(channel\_form, Reminder, :channel) do %> <% :sms -> %> <%= label channel\_form, :number %> <%= text\_input channel\_form, :number %> <% :email -> %> <%= label channel\_form, :email %> <%= text\_input channel\_form, :email %> <% end %> </.form> ``` [Link to this function](#polymorphic_embed_inputs_for/3 "Link to this function") polymorphic\_embed\_inputs\_for(form, field, fun) ================================================= [View Source](https://github.com/mathieuprog/polymorphic_embed/blob/v3.0.3/lib/polymorphic_embed/html/form.ex#L100 "View Source") Like [`polymorphic_embed_inputs_for/4`](#polymorphic_embed_inputs_for/4), but determines the type from the form data. [example](#polymorphic_embed_inputs_for/3-example) Example ------------------------------------------------------------ ``` <%= inputs\_for f, :reminders, fn reminder\_form -> %> <%= polymorphic\_embed\_inputs\_for reminder\_form, :channel, fn channel\_form -> %> <%= case get\_polymorphic\_type(channel\_form, Reminder, :channel) do %> <% :sms -> %> <%= label poly\_form, :number %> <%= text\_input poly\_form, :number %> <% :email -> %> <%= label poly\_form, :email %> <%= text\_input poly\_form, :email %> <% end %> <% end %> <% end %> ``` While [`polymorphic_embed_inputs_for/4`](#polymorphic_embed_inputs_for/4) renders empty fields if the data is `nil`, this function does not. Instead, you can initialize your changeset to render an empty fieldset: ``` changeset = reminder\_changeset( %Reminder{}, %{"channel" => %{"\_\_type\_\_" => "sms"}} ) ``` [Link to this function](#polymorphic_embed_inputs_for/4 "Link to this function") polymorphic\_embed\_inputs\_for(form, field, type, fun) ======================================================= [View Source](https://github.com/mathieuprog/polymorphic_embed/blob/v3.0.3/lib/polymorphic_embed/html/form.ex#L114 "View Source") [Link to this function](#to_form/5 "Link to this function") to\_form(source\_changeset, form, field, type, options) ======================================================= [View Source](https://github.com/mathieuprog/polymorphic_embed/blob/v3.0.3/lib/polymorphic_embed/html/form.ex#L126 "View Source")
gen_lsp
hex
GenLSP β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp.ex#L1 "View Source") GenLSP behaviour (gen\_lsp v0.6.0) ================================================================================================================================================ GenLSP is an OTP behaviour for building processes that implement the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/). [examples](#module-examples) Examples --------------------------------------- [Credo](https://github.com/rrrene/credo) language server. ``` defmodule Credo.Lsp do @moduledoc """ LSP implementation for Credo. """ use GenLSP alias GenLSP.Enumerations.TextDocumentSyncKind alias GenLSP.Notifications.{ Exit, Initialized, TextDocumentDidChange, TextDocumentDidClose, TextDocumentDidOpen, TextDocumentDidSave } alias GenLSP.Requests.{Initialize, Shutdown} alias GenLSP.Structures.{ InitializeParams, InitializeResult, SaveOptions, ServerCapabilities, TextDocumentSyncOptions } alias Credo.Lsp.Cache, as: Diagnostics def start_link(args) do GenLSP.start_link(__MODULE__, args, []) end @impl true def init(lsp, args) do cache = Keyword.fetch!(args, :cache) {:ok, assign(lsp, exit_code: 1, cache: cache)} end @impl true def handle_request(%Initialize{params: %InitializeParams{root_uri: root_uri}}, lsp) do {:reply, %InitializeResult{ capabilities: %ServerCapabilities{ text_document_sync: %TextDocumentSyncOptions{ open_close: true, save: %SaveOptions{include_text: true}, change: TextDocumentSyncKind.full() } }, server_info: %{name: "Credo"} }, assign(lsp, root_uri: root_uri)} end def handle_request(%Shutdown{}, lsp) do {:noreply, assign(lsp, exit_code: 0)} end @impl true def handle_notification(%Initialized{}, lsp) do GenLSP.log(lsp, :log, "[Credo] LSP Initialized!") Diagnostics.refresh(lsp.assigns.cache, lsp) Diagnostics.publish(lsp.assigns.cache, lsp) {:noreply, lsp} end def handle_notification(%TextDocumentDidSave{}, lsp) do Task.start_link(fn -> Diagnostics.clear(lsp.assigns.cache) Diagnostics.refresh(lsp.assigns.cache, lsp) Diagnostics.publish(lsp.assigns.cache, lsp) end) {:noreply, lsp} end def handle_notification(%TextDocumentDidChange{}, lsp) do Task.start_link(fn -> Diagnostics.clear(lsp.assigns.cache) Diagnostics.publish(lsp.assigns.cache, lsp) end) {:noreply, lsp} end def handle_notification(%note{}, lsp) when note in [TextDocumentDidOpen, TextDocumentDidClose] do {:noreply, lsp} end def handle_notification(%Exit{}, lsp) do System.halt(lsp.assigns.exit_code) {:noreply, lsp} end def handle_notification(_thing, lsp) do {:noreply, lsp} end end defmodule Credo.Lsp.Cache do @moduledoc """ Cache for Credo diagnostics. """ use Agent alias GenLSP.Structures.{ Diagnostic, Position, PublishDiagnosticsParams, Range } alias GenLSP.Notifications.TextDocumentPublishDiagnostics def start_link(_) do Agent.start_link(fn -> Map.new() end) end def refresh(cache, lsp) do dir = URI.new!(lsp.assigns.root_uri).path issues = Credo.Execution.get_issues(Credo.run(["--strict", "--all", "#{dir}/**/*.ex"])) GenLSP.log(lsp, :info, "[Credo] Found #{Enum.count(issues)} issues") for issue <- issues do diagnostic = %Diagnostic{ range: %Range{ start: %Position{line: issue.line_no - 1, character: issue.column || 0}, end: %Position{line: issue.line_no, character: 0} }, severity: category_to_severity(issue.category), message: """ #{issue.message} ## Explanation #{issue.check.explanations()[:check]} """ } put(cache, Path.absname(issue.filename), diagnostic) end end def get(cache) do Agent.get(cache, & &1) end def put(cache, filename, diagnostic) do Agent.update(cache, fn cache -> Map.update(cache, Path.absname(filename), [diagnostic], fn v -> [diagnostic | v] end) end) end def clear(cache) do Agent.update(cache, fn cache -> for {k, _} <- cache, into: Map.new() do {k, []} end end) end def publish(cache, lsp) do for {file, diagnostics} <- get(cache) do GenLSP.notify(lsp, %TextDocumentPublishDiagnostics{ params: %PublishDiagnosticsParams{ uri: "file://#{file}", diagnostics: diagnostics } }) end end def category_to_severity(:refactor), do: 1 def category_to_severity(:warning), do: 2 def category_to_severity(:design), do: 3 def category_to_severity(:consistency), do: 4 def category_to_severity(:readability), do: 4 end ``` [Link to this section](#summary) Summary ========================================== [Callbacks](#callbacks) ------------------------ [handle\_info(message, state)](#c:handle_info/2) The callback responsible for handling normal messages. [handle\_notification(notification, state)](#c:handle_notification/2) The callback responsible for handling notifications from the client. [handle\_request(request, state)](#c:handle_request/2) The callback responsible for handling requests from the client. [init(lsp, init\_arg)](#c:init/2) The callback responsible for initializing the process. [Functions](#functions) ------------------------ [error(lsp, message)](#error/2) Send a `window/logMessage` error notification to the client. [info(lsp, message)](#info/2) Send a `window/logMessage` info notification to the client. [log(lsp, message)](#log/2) Send a `window/logMessage` log notification to the client. [notify(map, notification)](#notify/2) Sends a notification to the client from the LSP process. [notify\_server(pid, notification)](#notify_server/2) Sends a notification from the client to the LSP process. [request(map, request)](#request/2) Sends a request to the client from the LSP process. [request\_server(pid, request)](#request_server/2) Sends a request from the client to the LSP process. [start\_link(module, init\_args, opts)](#start_link/3) Starts a [`GenLSP`](GenLSP.html#content) process that is linked to the current process. [warning(lsp, message)](#warning/2) Send a `window/logMessage` error notification to the client. [Link to this section](#callbacks) Callbacks ============================================= [Link to this callback](#c:handle_info/2 "Link to this callback") handle\_info(message, state) ============================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp.ex#L118 "View Source") ``` @callback handle_info(message :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), state) :: {:noreply, state} when state: [GenLSP.LSP.t](GenLSP.LSP.html#t:t/0)() ``` The callback responsible for handling normal messages. Receives the message as the first argument and the LSP token [`GenLSP.LSP.t/0`](GenLSP.LSP.html#t:t/0) as the second. [usage](#c:handle_info/2-usage) Usage --------------------------------------- ``` @impl true def handle\_info(message, lsp) do # handle the message {:noreply, lsp} end ``` [Link to this callback](#c:handle_notification/2 "Link to this callback") handle\_notification(notification, state) ========================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp.ex#L100 "View Source") ``` @callback handle_notification(notification :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), state) :: {:noreply, state} when state: [GenLSP.LSP.t](GenLSP.LSP.html#t:t/0)() ``` The callback responsible for handling notifications from the client. Receives the notification struct as the first argument and the LSP token [`GenLSP.LSP.t/0`](GenLSP.LSP.html#t:t/0) as the second. [usage](#c:handle_notification/2-usage) Usage ----------------------------------------------- ``` @impl true def handle\_notification(%Initialized{}, lsp) do # handle the notification {:noreply, lsp} end ``` [Link to this callback](#c:handle_request/2 "Link to this callback") handle\_request(request, state) =============================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp.ex#L81 "View Source") ``` @callback handle_request(request :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), state) :: {:reply, reply :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), state} | {:noreply, state} when state: [GenLSP.LSP.t](GenLSP.LSP.html#t:t/0)() ``` The callback responsible for handling requests from the client. Receives the request struct as the first argument and the LSP token [`GenLSP.LSP.t/0`](GenLSP.LSP.html#t:t/0) as the second. [usage](#c:handle_request/2-usage) Usage ------------------------------------------ ``` @impl true def handle\_request(%Initialize{params: %InitializeParams{root\_uri: root\_uri}}, lsp) do {:reply, %InitializeResult{ capabilities: %ServerCapabilities{ text\_document\_sync: %TextDocumentSyncOptions{ open\_close: true, save: %SaveOptions{include\_text: true}, change: TextDocumentSyncKind.full() } }, server\_info: %{name: "MyLSP"} }, assign(lsp, root\_uri: root\_uri)} end ``` [Link to this callback](#c:init/2 "Link to this callback") init(lsp, init\_arg) ==================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp.ex#L56 "View Source") ``` @callback init(lsp :: [GenLSP.LSP.t](GenLSP.LSP.html#t:t/0)(), init_arg :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: {:ok, [GenLSP.LSP.t](GenLSP.LSP.html#t:t/0)()} ``` The callback responsible for initializing the process. Receives the [`GenLSP.LSP.t/0`](GenLSP.LSP.html#t:t/0) token as the first argument and the arguments that were passed to [`GenLSP.start_link/3`](#start_link/3) as the second. [usage](#c:init/2-usage) Usage -------------------------------- ``` @impl true def init(lsp, args) do some\_arg = Keyword.fetch!(args, :some\_arg) {:ok, assign(lsp, static\_assign: :some\_assign, some\_arg: some\_arg)} end ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#error/2 "Link to this function") error(lsp, message) =================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp.ex#L365 "View Source") ``` @spec error([GenLSP.LSP.t](GenLSP.LSP.html#t:t/0)(), [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) :: :ok ``` Send a `window/logMessage` error notification to the client. See [`GenLSP.Enumerations.MessageType.error/0`](GenLSP.Enumerations.MessageType.html#error/0). [usage](#error/2-usage) Usage ------------------------------- ``` GenLSP.error(lsp, "Failed to compiled!") ``` [Link to this function](#info/2 "Link to this function") info(lsp, message) ================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp.ex#L397 "View Source") ``` @spec info([GenLSP.LSP.t](GenLSP.LSP.html#t:t/0)(), [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) :: :ok ``` Send a `window/logMessage` info notification to the client. See [`GenLSP.Enumerations.MessageType.info/0`](GenLSP.Enumerations.MessageType.html#info/0). [usage](#info/2-usage) Usage ------------------------------ ``` GenLSP.info(lsp, "Compilation complete!") ``` [Link to this function](#log/2 "Link to this function") log(lsp, message) ================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp.ex#L413 "View Source") ``` @spec log([GenLSP.LSP.t](GenLSP.LSP.html#t:t/0)(), [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) :: :ok ``` Send a `window/logMessage` log notification to the client. See [`GenLSP.Enumerations.MessageType.log/0`](GenLSP.Enumerations.MessageType.html#log/0). [usage](#log/2-usage) Usage ----------------------------- ``` GenLSP.log(lsp, "Starting compilation.") ``` [Link to this function](#notify/2 "Link to this function") notify(map, notification) ========================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp.ex#L207 "View Source") ``` @spec notify([GenLSP.LSP.t](GenLSP.LSP.html#t:t/0)(), notification :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: :ok ``` Sends a notification to the client from the LSP process. [usage](#notify/2-usage) Usage -------------------------------- ``` GenLSP.notify(lsp, %TextDocumentPublishDiagnostics{ params: %PublishDiagnosticsParams{ uri: "file://#{file}", diagnostics: diagnostics } }) ``` [Link to this function](#notify_server/2 "Link to this function") notify\_server(pid, notification) ================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp.ex#L187 "View Source") ``` @spec notify_server([pid](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), message) :: message when message: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Sends a notification from the client to the LSP process. Generally used by the [`GenLSP.Communication.Adapter`](GenLSP.Communication.Adapter.html) implementation to forward messages from the buffer to the LSP process. You shouldn't need to use this to implement a language server. [Link to this function](#request/2 "Link to this function") request(map, request) ===================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp.ex#L224 "View Source") ``` @spec request([GenLSP.LSP.t](GenLSP.LSP.html#t:t/0)(), request :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Sends a request to the client from the LSP process. [usage](#request/2-usage) Usage --------------------------------- ``` GenLSP.request(lsp, %ClientRegisterCapability{ id: System.unique\_integer([:positive]), params: params }) ``` [Link to this function](#request_server/2 "Link to this function") request\_server(pid, request) ============================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp.ex#L173 "View Source") ``` @spec request_server([pid](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), message) :: message when message: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Sends a request from the client to the LSP process. Generally used by the [`GenLSP.Communication.Adapter`](GenLSP.Communication.Adapter.html) implementation to forward messages from the buffer to the LSP process. You shouldn't need to use this to implement a language server. [Link to this function](#start_link/3 "Link to this function") start\_link(module, init\_args, opts) ===================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp.ex#L139 "View Source") Starts a [`GenLSP`](GenLSP.html#content) process that is linked to the current process. [options](#start_link/3-options) Options ------------------------------------------ * `:buffer` - The [`pid/0`](https://hexdocs.pm/elixir/typespecs.html#basic-types) or name of the [`GenLSP.Buffer`](GenLSP.Buffer.html) process. * `:name` ([`atom/0`](https://hexdocs.pm/elixir/typespecs.html#basic-types)) - Used for name registration as described in the "Name registration" section in the documentation for [`GenServer`](https://hexdocs.pm/elixir/GenServer.html). [Link to this function](#warning/2 "Link to this function") warning(lsp, message) ===================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp.ex#L381 "View Source") ``` @spec warning([GenLSP.LSP.t](GenLSP.LSP.html#t:t/0)(), [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) :: :ok ``` Send a `window/logMessage` error notification to the client. See [`GenLSP.Enumerations.MessageType.warning/0`](GenLSP.Enumerations.MessageType.html#warning/0). [usage](#warning/2-usage) Usage --------------------------------- ``` GenLSP.warning(lsp, "Variable `foo` is unused.") ``` GenLSP.BaseTypes β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/base_types.ex#L2 "View Source") GenLSP.BaseTypes (gen\_lsp v0.6.0) ==================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [document\_uri()](#t:document_uri/0) [null()](#t:null/0) [uinteger()](#t:uinteger/0) [uri()](#t:uri/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:document_uri/0 "Link to this type") document\_uri() =============== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/base_types.ex#L4 "View Source") ``` @type document_uri() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this type](#t:null/0 "Link to this type") null() ====== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/base_types.ex#L6 "View Source") ``` @type null() :: nil ``` [Link to this type](#t:uinteger/0 "Link to this type") uinteger() ========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/base_types.ex#L5 "View Source") ``` @type uinteger() :: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` [Link to this type](#t:uri/0 "Link to this type") uri() ===== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/base_types.ex#L3 "View Source") ``` @type uri() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` GenLSP.Buffer β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/buffer.ex#L1 "View Source") GenLSP.Buffer (gen\_lsp v0.6.0) ==================================================================================================================================================== The data buffer between the LSP process and the communication channel. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [child\_spec(init\_arg)](#child_spec/1) Returns a specification to start this module under a supervisor. [start\_link(opts)](#start_link/1) Starts a [`GenLSP.Buffer`](GenLSP.Buffer.html#content) process that is linked to the current process. [Link to this section](#functions) Functions ============================================= [Link to this function](#child_spec/1 "Link to this function") child\_spec(init\_arg) ====================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/buffer.ex#L5 "View Source") Returns a specification to start this module under a supervisor. See [`Supervisor`](https://hexdocs.pm/elixir/Supervisor.html). [Link to this function](#start_link/1 "Link to this function") start\_link(opts) ================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/buffer.ex#L30 "View Source") Starts a [`GenLSP.Buffer`](GenLSP.Buffer.html#content) process that is linked to the current process. [options](#start_link/1-options) Options ------------------------------------------ * `:communication` - A `{module, args}` tuple, where `module` implements the [`GenLSP.Communication.Adapter`](GenLSP.Communication.Adapter.html) behaviour. The default value is `{GenLSP.Communication.Stdio, []}`. * `:name` ([`atom/0`](https://hexdocs.pm/elixir/typespecs.html#basic-types)) - Used for name registration as described in the "Name registration" section in the documentation for [`GenServer`](https://hexdocs.pm/elixir/GenServer.html). GenLSP.Communication.Adapter β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/communication/adapter.ex#L1 "View Source") GenLSP.Communication.Adapter behaviour (gen\_lsp v0.6.0) ============================================================================================================================================================================================ Behaviour for implementing communication adapters for the [`GenLSP.Buffer`](GenLSP.Buffer.html) module to use. Existing implementations: * [`GenLSP.Communication.Stdio`](GenLSP.Communication.Stdio.html) * [`GenLSP.Communication.TCP`](GenLSP.Communication.TCP.html) [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [state()](#t:state/0) [Callbacks](#callbacks) ------------------------ [init(args)](#c:init/1) Initialize the adapter. [listen(state)](#c:listen/1) Tells the adapter to begin listening for data. [read(state, t)](#c:read/2) Read from the client. [write(body, state)](#c:write/2) Write data to the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:state/0 "Link to this type") state() ======= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/communication/adapter.ex#L10 "View Source") ``` @type state() :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` [Link to this section](#callbacks) Callbacks ============================================= [Link to this callback](#c:init/1 "Link to this callback") init(args) ========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/communication/adapter.ex#L17 "View Source") ``` @callback init(args :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: {:ok, [state](#t:state/0)()} ``` Initialize the adapter. Here you should return any state that should be passed into the other callbacks. [Link to this callback](#c:listen/1 "Link to this callback") listen(state) ============= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/communication/adapter.ex#L34 "View Source") ``` @callback listen([state](#t:state/0)()) :: {:ok, [state](#t:state/0)()} ``` Tells the adapter to begin listening for data. [Link to this callback](#c:read/2 "Link to this callback") read(state, t) ============== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/communication/adapter.ex#L25 "View Source") ``` @callback read([state](#t:state/0)(), [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) :: {:ok, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | :eof | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` Read from the client. This callback should read a packet of data from the client and return it as the second element in the tuple. The third element can be used to return any data that as already been read from the client but still needs to be parsed into a packet. [Link to this callback](#c:write/2 "Link to this callback") write(body, state) ================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/communication/adapter.ex#L29 "View Source") ``` @callback write(body :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), [state](#t:state/0)()) :: :ok | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` Write data to the client. GenLSP.Communication.Stdio β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/communication/stdio.ex#L1 "View Source") GenLSP.Communication.Stdio (gen\_lsp v0.6.0) ============================================================================================================================================================================== The Standard IO adapter. This is the default adapter, and is the communication channel that most LSP clients expect to be able to use. GenLSP.Communication.TCP β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/communication/tcp.ex#L1 "View Source") GenLSP.Communication.TCP (gen\_lsp v0.6.0) ========================================================================================================================================================================== The TCP adapter. This adapter can be used to launch the LSP with a given port and can be connected to by multiple clients. This adapter is also used during test by [`GenLSP.Test`](GenLSP.Test.html). GenLSP.Enumerations.CodeActionKind β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/code_action_kind.ex#L2 "View Source") GenLSP.Enumerations.CodeActionKind (gen\_lsp v0.6.0) ========================================================================================================================================================================================================= A set of predefined code action kinds [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [empty()](#empty/0) Empty kind. [quick\_fix()](#quick_fix/0) Base kind for quickfix actions: 'quickfix' [refactor()](#refactor/0) Base kind for refactoring actions: 'refactor' [refactor\_extract()](#refactor_extract/0) Base kind for refactoring extraction actions: 'refactor.extract' [refactor\_inline()](#refactor_inline/0) Base kind for refactoring inline actions: 'refactor.inline' [refactor\_rewrite()](#refactor_rewrite/0) Base kind for refactoring rewrite actions: 'refactor.rewrite' [source()](#source/0) Base kind for source actions: `source` [source\_fix\_all()](#source_fix_all/0) Base kind for auto-fix source actions: `source.fixAll`. [source\_organize\_imports()](#source_organize_imports/0) Base kind for an organize imports source action: `source.organizeImports` [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/code_action_kind.ex#L7 "View Source") ``` @type t() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#empty/0 "Link to this function") empty() ======= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/code_action_kind.ex#L15 "View Source") ``` @spec empty() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Empty kind. [Link to this function](#quick_fix/0 "Link to this function") quick\_fix() ============ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/code_action_kind.ex#L21 "View Source") ``` @spec quick_fix() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Base kind for quickfix actions: 'quickfix' [Link to this function](#refactor/0 "Link to this function") refactor() ========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/code_action_kind.ex#L27 "View Source") ``` @spec refactor() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Base kind for refactoring actions: 'refactor' [Link to this function](#refactor_extract/0 "Link to this function") refactor\_extract() =================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/code_action_kind.ex#L41 "View Source") ``` @spec refactor_extract() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Base kind for refactoring extraction actions: 'refactor.extract' Example extract actions: * Extract method * Extract function * Extract variable * Extract interface from class * ... [Link to this function](#refactor_inline/0 "Link to this function") refactor\_inline() ================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/code_action_kind.ex#L54 "View Source") ``` @spec refactor_inline() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Base kind for refactoring inline actions: 'refactor.inline' Example inline actions: * Inline function * Inline variable * Inline constant * ... [Link to this function](#refactor_rewrite/0 "Link to this function") refactor\_rewrite() =================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/code_action_kind.ex#L69 "View Source") ``` @spec refactor_rewrite() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Base kind for refactoring rewrite actions: 'refactor.rewrite' Example rewrite actions: * Convert JavaScript function to class * Add or remove parameter * Encapsulate field * Make method static * Move method to base class * ... [Link to this function](#source/0 "Link to this function") source() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/code_action_kind.ex#L77 "View Source") ``` @spec source() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Base kind for source actions: `source` Source code actions apply to the entire file. [Link to this function](#source_fix_all/0 "Link to this function") source\_fix\_all() ================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/code_action_kind.ex#L94 "View Source") ``` @spec source_fix_all() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Base kind for auto-fix source actions: `source.fixAll`. Fix all actions automatically fix errors that have a clear fix that do not require user input. They should not suppress errors or perform unsafe fixes such as generating new types or classes. @since 3.15.0 [Link to this function](#source_organize_imports/0 "Link to this function") source\_organize\_imports() =========================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/code_action_kind.ex#L83 "View Source") ``` @spec source_organize_imports() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Base kind for an organize imports source action: `source.organizeImports` GenLSP.Enumerations.CodeActionTriggerKind β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/code_action_trigger_kind.ex#L2 "View Source") GenLSP.Enumerations.CodeActionTriggerKind (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================== The reason why code actions were requested. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [automatic()](#automatic/0) Code actions were requested automatically. [invoked()](#invoked/0) Code actions were explicitly requested by the user or by an extension. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/code_action_trigger_kind.ex#L9 "View Source") ``` @type t() :: 1 | 2 ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#automatic/0 "Link to this function") automatic() =========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/code_action_trigger_kind.ex#L26 "View Source") ``` @spec automatic() :: 2 ``` Code actions were requested automatically. This typically happens when current selection in a file changes, but can also be triggered when file content changes. [Link to this function](#invoked/0 "Link to this function") invoked() ========= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/code_action_trigger_kind.ex#L17 "View Source") ``` @spec invoked() :: 1 ``` Code actions were explicitly requested by the user or by an extension. GenLSP.Enumerations.CompletionItemKind β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L2 "View Source") GenLSP.Enumerations.CompletionItemKind (gen\_lsp v0.6.0) ================================================================================================================================================================================================================= The kind of a completion entry. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [class()](#class/0) [color()](#color/0) [constant()](#constant/0) [constructor()](#constructor/0) [enum()](#enum/0) [enum\_member()](#enum_member/0) [event()](#event/0) [field()](#field/0) [file()](#file/0) [folder()](#folder/0) [function()](#function/0) [interface()](#interface/0) [keyword()](#keyword/0) [method()](#method/0) [module()](#module/0) [operator()](#operator/0) [property()](#property/0) [reference()](#reference/0) [snippet()](#snippet/0) [struct()](#struct/0) [text()](#text/0) [type\_parameter()](#type_parameter/0) [unit()](#unit/0) [value()](#value/0) [variable()](#variable/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L7 "View Source") ``` @type t() :: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#class/0 "Link to this function") class() ======= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L55 "View Source") ``` @spec class() :: 7 ``` [Link to this function](#color/0 "Link to this function") color() ======= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L82 "View Source") ``` @spec color() :: 16 ``` [Link to this function](#constant/0 "Link to this function") constant() ========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L97 "View Source") ``` @spec constant() :: 21 ``` [Link to this function](#constructor/0 "Link to this function") constructor() ============= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L46 "View Source") ``` @spec constructor() :: 4 ``` [Link to this function](#enum/0 "Link to this function") enum() ====== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L73 "View Source") ``` @spec enum() :: 13 ``` [Link to this function](#enum_member/0 "Link to this function") enum\_member() ============== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L94 "View Source") ``` @spec enum_member() :: 20 ``` [Link to this function](#event/0 "Link to this function") event() ======= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L103 "View Source") ``` @spec event() :: 23 ``` [Link to this function](#field/0 "Link to this function") field() ======= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L49 "View Source") ``` @spec field() :: 5 ``` [Link to this function](#file/0 "Link to this function") file() ====== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L85 "View Source") ``` @spec file() :: 17 ``` [Link to this function](#folder/0 "Link to this function") folder() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L91 "View Source") ``` @spec folder() :: 19 ``` [Link to this function](#function/0 "Link to this function") function() ========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L43 "View Source") ``` @spec function() :: 3 ``` [Link to this function](#interface/0 "Link to this function") interface() =========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L58 "View Source") ``` @spec interface() :: 8 ``` [Link to this function](#keyword/0 "Link to this function") keyword() ========= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L76 "View Source") ``` @spec keyword() :: 14 ``` [Link to this function](#method/0 "Link to this function") method() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L40 "View Source") ``` @spec method() :: 2 ``` [Link to this function](#module/0 "Link to this function") module() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L61 "View Source") ``` @spec module() :: 9 ``` [Link to this function](#operator/0 "Link to this function") operator() ========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L106 "View Source") ``` @spec operator() :: 24 ``` [Link to this function](#property/0 "Link to this function") property() ========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L64 "View Source") ``` @spec property() :: 10 ``` [Link to this function](#reference/0 "Link to this function") reference() =========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L88 "View Source") ``` @spec reference() :: 18 ``` [Link to this function](#snippet/0 "Link to this function") snippet() ========= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L79 "View Source") ``` @spec snippet() :: 15 ``` [Link to this function](#struct/0 "Link to this function") struct() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L100 "View Source") ``` @spec struct() :: 22 ``` [Link to this function](#text/0 "Link to this function") text() ====== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L37 "View Source") ``` @spec text() :: 1 ``` [Link to this function](#type_parameter/0 "Link to this function") type\_parameter() ================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L109 "View Source") ``` @spec type_parameter() :: 25 ``` [Link to this function](#unit/0 "Link to this function") unit() ====== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L67 "View Source") ``` @spec unit() :: 11 ``` [Link to this function](#value/0 "Link to this function") value() ======= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L70 "View Source") ``` @spec value() :: 12 ``` [Link to this function](#variable/0 "Link to this function") variable() ========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_kind.ex#L52 "View Source") ``` @spec variable() :: 6 ``` GenLSP.Enumerations.CompletionItemTag β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_tag.ex#L2 "View Source") GenLSP.Enumerations.CompletionItemTag (gen\_lsp v0.6.0) =============================================================================================================================================================================================================== Completion item tags are extra annotations that tweak the rendering of a completion item. @since 3.15.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [deprecated()](#deprecated/0) Render a completion as obsolete, usually using a strike-out. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_tag.ex#L10 "View Source") ``` @type t() :: 1 ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#deprecated/0 "Link to this function") deprecated() ============ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_item_tag.ex#L18 "View Source") ``` @spec deprecated() :: 1 ``` Render a completion as obsolete, usually using a strike-out. GenLSP.Enumerations.CompletionTriggerKind β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_trigger_kind.ex#L2 "View Source") GenLSP.Enumerations.CompletionTriggerKind (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================= How a completion was triggered [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [invoked()](#invoked/0) Completion was triggered by typing an identifier (24x7 code complete), manual invocation (e.g Ctrl+Space) or via API. [trigger\_character()](#trigger_character/0) Completion was triggered by a trigger character specified by the `triggerCharacters` properties of the `CompletionRegistrationOptions`. [trigger\_for\_incomplete\_completions()](#trigger_for_incomplete_completions/0) Completion was re-triggered as current completion list is incomplete [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_trigger_kind.ex#L7 "View Source") ``` @type t() :: 1 | 2 | 3 ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#invoked/0 "Link to this function") invoked() ========= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_trigger_kind.ex#L16 "View Source") ``` @spec invoked() :: 1 ``` Completion was triggered by typing an identifier (24x7 code complete), manual invocation (e.g Ctrl+Space) or via API. [Link to this function](#trigger_character/0 "Link to this function") trigger\_character() ==================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_trigger_kind.ex#L23 "View Source") ``` @spec trigger_character() :: 2 ``` Completion was triggered by a trigger character specified by the `triggerCharacters` properties of the `CompletionRegistrationOptions`. [Link to this function](#trigger_for_incomplete_completions/0 "Link to this function") trigger\_for\_incomplete\_completions() ======================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/completion_trigger_kind.ex#L29 "View Source") ``` @spec trigger_for_incomplete_completions() :: 3 ``` Completion was re-triggered as current completion list is incomplete GenLSP.Enumerations.DiagnosticSeverity β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/diagnostic_severity.ex#L2 "View Source") GenLSP.Enumerations.DiagnosticSeverity (gen\_lsp v0.6.0) ================================================================================================================================================================================================================ The diagnostic's severity. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [error()](#error/0) Reports an error. [hint()](#hint/0) Reports a hint. [information()](#information/0) Reports an information. [warning()](#warning/0) Reports a warning. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/diagnostic_severity.ex#L7 "View Source") ``` @type t() :: 1 | 2 | 3 | 4 ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#error/0 "Link to this function") error() ======= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/diagnostic_severity.ex#L15 "View Source") ``` @spec error() :: 1 ``` Reports an error. [Link to this function](#hint/0 "Link to this function") hint() ====== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/diagnostic_severity.ex#L33 "View Source") ``` @spec hint() :: 4 ``` Reports a hint. [Link to this function](#information/0 "Link to this function") information() ============= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/diagnostic_severity.ex#L27 "View Source") ``` @spec information() :: 3 ``` Reports an information. [Link to this function](#warning/0 "Link to this function") warning() ========= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/diagnostic_severity.ex#L21 "View Source") ``` @spec warning() :: 2 ``` Reports a warning. GenLSP.Enumerations.DiagnosticTag β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/diagnostic_tag.ex#L2 "View Source") GenLSP.Enumerations.DiagnosticTag (gen\_lsp v0.6.0) ====================================================================================================================================================================================================== The diagnostic tags. @since 3.15.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [deprecated()](#deprecated/0) Deprecated or obsolete code. [unnecessary()](#unnecessary/0) Unused or unnecessary code. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/diagnostic_tag.ex#L9 "View Source") ``` @type t() :: 1 | 2 ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#deprecated/0 "Link to this function") deprecated() ============ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/diagnostic_tag.ex#L28 "View Source") ``` @spec deprecated() :: 2 ``` Deprecated or obsolete code. Clients are allowed to rendered diagnostics with this tag strike through. [Link to this function](#unnecessary/0 "Link to this function") unnecessary() ============= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/diagnostic_tag.ex#L20 "View Source") ``` @spec unnecessary() :: 1 ``` Unused or unnecessary code. Clients are allowed to render diagnostics with this tag faded out instead of having an error squiggle. GenLSP.Enumerations.DocumentDiagnosticReportKind β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/document_diagnostic_report_kind.ex#L2 "View Source") GenLSP.Enumerations.DocumentDiagnosticReportKind (gen\_lsp v0.6.0) ====================================================================================================================================================================================================================================== The document diagnostic report kinds. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [full()](#full/0) A diagnostic report with a full set of problems. [unchanged()](#unchanged/0) A report indicating that the last returned report is still accurate. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/document_diagnostic_report_kind.ex#L9 "View Source") ``` @type t() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#full/0 "Link to this function") full() ====== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/document_diagnostic_report_kind.ex#L18 "View Source") ``` @spec full() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` A diagnostic report with a full set of problems. [Link to this function](#unchanged/0 "Link to this function") unchanged() =========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/document_diagnostic_report_kind.ex#L25 "View Source") ``` @spec unchanged() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` A report indicating that the last returned report is still accurate. GenLSP.Enumerations.DocumentHighlightKind β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/document_highlight_kind.ex#L2 "View Source") GenLSP.Enumerations.DocumentHighlightKind (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================= A document highlight kind. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [read()](#read/0) Read-access of a symbol, like reading a variable. [text()](#text/0) A textual occurrence. [write()](#write/0) Write-access of a symbol, like writing to a variable. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/document_highlight_kind.ex#L7 "View Source") ``` @type t() :: 1 | 2 | 3 ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#read/0 "Link to this function") read() ====== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/document_highlight_kind.ex#L21 "View Source") ``` @spec read() :: 2 ``` Read-access of a symbol, like reading a variable. [Link to this function](#text/0 "Link to this function") text() ====== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/document_highlight_kind.ex#L15 "View Source") ``` @spec text() :: 1 ``` A textual occurrence. [Link to this function](#write/0 "Link to this function") write() ======= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/document_highlight_kind.ex#L27 "View Source") ``` @spec write() :: 3 ``` Write-access of a symbol, like writing to a variable. GenLSP.Enumerations.ErrorCodes β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/error_codes.ex#L2 "View Source") GenLSP.Enumerations.ErrorCodes (gen\_lsp v0.6.0) ================================================================================================================================================================================================ Predefined error codes. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [internal\_error()](#internal_error/0) [invalid\_params()](#invalid_params/0) [invalid\_request()](#invalid_request/0) [method\_not\_found()](#method_not_found/0) [parse\_error()](#parse_error/0) [server\_not\_initialized()](#server_not_initialized/0) Error code indicating that a server received a notification or request before the server has received the `initialize` request. [unknown\_error\_code()](#unknown_error_code/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/error_codes.ex#L7 "View Source") ``` @type t() :: -32700 | -32600 | -32601 | -32602 | -32603 | -32002 | -32001 ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#internal_error/0 "Link to this function") internal\_error() ================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/error_codes.ex#L24 "View Source") ``` @spec internal_error() :: -32603 ``` [Link to this function](#invalid_params/0 "Link to this function") invalid\_params() ================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/error_codes.ex#L21 "View Source") ``` @spec invalid_params() :: -32602 ``` [Link to this function](#invalid_request/0 "Link to this function") invalid\_request() ================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/error_codes.ex#L15 "View Source") ``` @spec invalid_request() :: -32600 ``` [Link to this function](#method_not_found/0 "Link to this function") method\_not\_found() ==================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/error_codes.ex#L18 "View Source") ``` @spec method_not_found() :: -32601 ``` [Link to this function](#parse_error/0 "Link to this function") parse\_error() ============== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/error_codes.ex#L12 "View Source") ``` @spec parse_error() :: -32700 ``` [Link to this function](#server_not_initialized/0 "Link to this function") server\_not\_initialized() ========================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/error_codes.ex#L31 "View Source") ``` @spec server_not_initialized() :: -32002 ``` Error code indicating that a server received a notification or request before the server has received the `initialize` request. [Link to this function](#unknown_error_code/0 "Link to this function") unknown\_error\_code() ====================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/error_codes.ex#L34 "View Source") ``` @spec unknown_error_code() :: -32001 ``` GenLSP.Enumerations.FailureHandlingKind β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/failure_handling_kind.ex#L2 "View Source") GenLSP.Enumerations.FailureHandlingKind (gen\_lsp v0.6.0) =================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [abort()](#abort/0) Applying the workspace change is simply aborted if one of the changes provided fails. All operations executed before the failing operation stay executed. [text\_only\_transactional()](#text_only_transactional/0) If the workspace edit contains only textual file changes they are executed transactional. If resource changes (create, rename or delete file) are part of the change the failure handling strategy is abort. [transactional()](#transactional/0) All operations are executed transactional. That means they either all succeed or no changes at all are applied to the workspace. [undo()](#undo/0) The client tries to undo the operations already executed. But there is no guarantee that this is succeeding. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/failure_handling_kind.ex#L3 "View Source") ``` @type t() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#abort/0 "Link to this function") abort() ======= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/failure_handling_kind.ex#L12 "View Source") ``` @spec abort() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Applying the workspace change is simply aborted if one of the changes provided fails. All operations executed before the failing operation stay executed. [Link to this function](#text_only_transactional/0 "Link to this function") text\_only\_transactional() =========================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/failure_handling_kind.ex#L27 "View Source") ``` @spec text_only_transactional() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` If the workspace edit contains only textual file changes they are executed transactional. If resource changes (create, rename or delete file) are part of the change the failure handling strategy is abort. [Link to this function](#transactional/0 "Link to this function") transactional() =============== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/failure_handling_kind.ex#L19 "View Source") ``` @spec transactional() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` All operations are executed transactional. That means they either all succeed or no changes at all are applied to the workspace. [Link to this function](#undo/0 "Link to this function") undo() ====== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/failure_handling_kind.ex#L34 "View Source") ``` @spec undo() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` The client tries to undo the operations already executed. But there is no guarantee that this is succeeding. GenLSP.Enumerations.FileChangeType β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/file_change_type.ex#L2 "View Source") GenLSP.Enumerations.FileChangeType (gen\_lsp v0.6.0) ========================================================================================================================================================================================================= The file event type [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [changed()](#changed/0) The file got changed. [created()](#created/0) The file got created. [deleted()](#deleted/0) The file got deleted. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/file_change_type.ex#L7 "View Source") ``` @type t() :: 1 | 2 | 3 ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#changed/0 "Link to this function") changed() ========= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/file_change_type.ex#L21 "View Source") ``` @spec changed() :: 2 ``` The file got changed. [Link to this function](#created/0 "Link to this function") created() ========= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/file_change_type.ex#L15 "View Source") ``` @spec created() :: 1 ``` The file got created. [Link to this function](#deleted/0 "Link to this function") deleted() ========= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/file_change_type.ex#L27 "View Source") ``` @spec deleted() :: 3 ``` The file got deleted. GenLSP.Enumerations.FileOperationPatternKind β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/file_operation_pattern_kind.ex#L2 "View Source") GenLSP.Enumerations.FileOperationPatternKind (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================== A pattern kind describing if a glob pattern matches a file a folder or both. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [file()](#file/0) The pattern matches a file only. [folder()](#folder/0) The pattern matches a folder only. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/file_operation_pattern_kind.ex#L10 "View Source") ``` @type t() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#file/0 "Link to this function") file() ====== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/file_operation_pattern_kind.ex#L18 "View Source") ``` @spec file() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` The pattern matches a file only. [Link to this function](#folder/0 "Link to this function") folder() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/file_operation_pattern_kind.ex#L24 "View Source") ``` @spec folder() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` The pattern matches a folder only. GenLSP.Enumerations.FoldingRangeKind β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/folding_range_kind.ex#L2 "View Source") GenLSP.Enumerations.FoldingRangeKind (gen\_lsp v0.6.0) ============================================================================================================================================================================================================= A set of predefined range kinds. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [comment()](#comment/0) Folding range for a comment [imports()](#imports/0) Folding range for an import or include [region()](#region/0) Folding range for a region (e.g. `#region`) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/folding_range_kind.ex#L7 "View Source") ``` @type t() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#comment/0 "Link to this function") comment() ========= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/folding_range_kind.ex#L15 "View Source") ``` @spec comment() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Folding range for a comment [Link to this function](#imports/0 "Link to this function") imports() ========= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/folding_range_kind.ex#L21 "View Source") ``` @spec imports() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Folding range for an import or include [Link to this function](#region/0 "Link to this function") region() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/folding_range_kind.ex#L27 "View Source") ``` @spec region() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Folding range for a region (e.g. `#region`) GenLSP.Enumerations.InlayHintKind β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/inlay_hint_kind.ex#L2 "View Source") GenLSP.Enumerations.InlayHintKind (gen\_lsp v0.6.0) ======================================================================================================================================================================================================= Inlay hint kinds. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [parameter()](#parameter/0) An inlay hint that is for a parameter. [type()](#type/0) An inlay hint that for a type annotation. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/inlay_hint_kind.ex#L9 "View Source") ``` @type t() :: 1 | 2 ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#parameter/0 "Link to this function") parameter() =========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/inlay_hint_kind.ex#L23 "View Source") ``` @spec parameter() :: 2 ``` An inlay hint that is for a parameter. [Link to this function](#type/0 "Link to this function") type() ====== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/inlay_hint_kind.ex#L17 "View Source") ``` @spec type() :: 1 ``` An inlay hint that for a type annotation. GenLSP.Enumerations.InsertTextFormat β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/insert_text_format.ex#L2 "View Source") GenLSP.Enumerations.InsertTextFormat (gen\_lsp v0.6.0) ============================================================================================================================================================================================================= Defines whether the insert text in a completion item should be interpreted as plain text or a snippet. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [plain\_text()](#plain_text/0) The primary text to be inserted is treated as a plain string. [snippet()](#snippet/0) The primary text to be inserted is treated as a snippet. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/insert_text_format.ex#L8 "View Source") ``` @type t() :: 1 | 2 ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#plain_text/0 "Link to this function") plain\_text() ============= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/insert_text_format.ex#L16 "View Source") ``` @spec plain_text() :: 1 ``` The primary text to be inserted is treated as a plain string. [Link to this function](#snippet/0 "Link to this function") snippet() ========= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/insert_text_format.ex#L29 "View Source") ``` @spec snippet() :: 2 ``` The primary text to be inserted is treated as a snippet. A snippet can define tab stops and placeholders with `$1`, `$2` and `${3:foo}`. `$0` defines the final tab stop, it defaults to the end of the snippet. Placeholders with equal identifiers are linked, that is typing in one will update others too. See also: <https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax> GenLSP.Enumerations.InsertTextMode β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/insert_text_mode.ex#L2 "View Source") GenLSP.Enumerations.InsertTextMode (gen\_lsp v0.6.0) ========================================================================================================================================================================================================= How whitespace and indentation is handled during completion item insertion. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [adjust\_indentation()](#adjust_indentation/0) The editor adjusts leading whitespace of new lines so that they match the indentation up to the cursor of the line for which the item is accepted. [as\_is()](#as_is/0) The insertion or replace strings is taken as it is. If the value is multi line the lines below the cursor will be inserted using the indentation defined in the string value. The client will not apply any kind of adjustments to the string. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/insert_text_mode.ex#L10 "View Source") ``` @type t() :: 1 | 2 ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#adjust_indentation/0 "Link to this function") adjust\_indentation() ===================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/insert_text_mode.ex#L34 "View Source") ``` @spec adjust_indentation() :: 2 ``` The editor adjusts leading whitespace of new lines so that they match the indentation up to the cursor of the line for which the item is accepted. Consider a line like this: <2tabs><cursor><3tabs>foo. Accepting a multi line completion item is indented using 2 tabs and all following lines inserted will be indented using 2 tabs as well. [Link to this function](#as_is/0 "Link to this function") as\_is() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/insert_text_mode.ex#L22 "View Source") ``` @spec as_is() :: 1 ``` The insertion or replace strings is taken as it is. If the value is multi line the lines below the cursor will be inserted using the indentation defined in the string value. The client will not apply any kind of adjustments to the string. GenLSP.Enumerations.LSPErrorCodes β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/lsp_error_codes.ex#L2 "View Source") GenLSP.Enumerations.LSPErrorCodes (gen\_lsp v0.6.0) ======================================================================================================================================================================================================= [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [content\_modified()](#content_modified/0) The server detected that the content of a document got modified outside normal conditions. A server should NOT send this error code if it detects a content change in it unprocessed messages. The result even computed on an older state might still be useful for the client. [request\_cancelled()](#request_cancelled/0) The client has canceled a request and a server as detected the cancel. [request\_failed()](#request_failed/0) A request failed but it was syntactically correct, e.g the method name was known and the parameters were valid. The error message should contain human readable information about why the request failed. [server\_cancelled()](#server_cancelled/0) The server cancelled the request. This error code should only be used for requests that explicitly support being server cancellable. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/lsp_error_codes.ex#L3 "View Source") ``` @type t() :: -32803 | -32802 | -32801 | -32800 ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#content_modified/0 "Link to this function") content\_modified() =================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/lsp_error_codes.ex#L39 "View Source") ``` @spec content_modified() :: -32801 ``` The server detected that the content of a document got modified outside normal conditions. A server should NOT send this error code if it detects a content change in it unprocessed messages. The result even computed on an older state might still be useful for the client. If a client decides that a result is not of any use anymore the client should cancel the request. [Link to this function](#request_cancelled/0 "Link to this function") request\_cancelled() ==================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/lsp_error_codes.ex#L46 "View Source") ``` @spec request_cancelled() :: -32800 ``` The client has canceled a request and a server as detected the cancel. [Link to this function](#request_failed/0 "Link to this function") request\_failed() ================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/lsp_error_codes.ex#L16 "View Source") ``` @spec request_failed() :: -32803 ``` A request failed but it was syntactically correct, e.g the method name was known and the parameters were valid. The error message should contain human readable information about why the request failed. @since 3.17.0 [Link to this function](#server_cancelled/0 "Link to this function") server\_cancelled() =================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/lsp_error_codes.ex#L26 "View Source") ``` @spec server_cancelled() :: -32802 ``` The server cancelled the request. This error code should only be used for requests that explicitly support being server cancellable. @since 3.17.0 GenLSP.Enumerations.MarkupKind β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/markup_kind.ex#L2 "View Source") GenLSP.Enumerations.MarkupKind (gen\_lsp v0.6.0) ================================================================================================================================================================================================ Describes the content type that a client supports in various result literals like `Hover`, `ParameterInfo` or `CompletionItem`. Please note that `MarkupKinds` must not start with a `$`. This kinds are reserved for internal usage. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [markdown()](#markdown/0) Markdown is supported as a content format [plain\_text()](#plain_text/0) Plain text is supported as a content format [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/markup_kind.ex#L11 "View Source") ``` @type t() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#markdown/0 "Link to this function") markdown() ========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/markup_kind.ex#L25 "View Source") ``` @spec markdown() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Markdown is supported as a content format [Link to this function](#plain_text/0 "Link to this function") plain\_text() ============= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/markup_kind.ex#L19 "View Source") ``` @spec plain_text() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Plain text is supported as a content format GenLSP.Enumerations.MessageType β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/message_type.ex#L2 "View Source") GenLSP.Enumerations.MessageType (gen\_lsp v0.6.0) ================================================================================================================================================================================================== The message type [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [error()](#error/0) An error message. [info()](#info/0) An information message. [log()](#log/0) A log message. [warning()](#warning/0) A warning message. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/message_type.ex#L7 "View Source") ``` @type t() :: 1 | 2 | 3 | 4 ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#error/0 "Link to this function") error() ======= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/message_type.ex#L15 "View Source") ``` @spec error() :: 1 ``` An error message. [Link to this function](#info/0 "Link to this function") info() ====== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/message_type.ex#L27 "View Source") ``` @spec info() :: 3 ``` An information message. [Link to this function](#log/0 "Link to this function") log() ===== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/message_type.ex#L33 "View Source") ``` @spec log() :: 4 ``` A log message. [Link to this function](#warning/0 "Link to this function") warning() ========= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/message_type.ex#L21 "View Source") ``` @spec warning() :: 2 ``` A warning message. GenLSP.Enumerations.MonikerKind β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/moniker_kind.ex#L2 "View Source") GenLSP.Enumerations.MonikerKind (gen\_lsp v0.6.0) ================================================================================================================================================================================================== The moniker kind. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [export()](#export/0) The moniker represents a symbol that is exported from a project [import()](#import/0) The moniker represent a symbol that is imported into a project [local()](#local/0) The moniker represents a symbol that is local to a project (e.g. a local variable of a function, a class not visible outside the project, ...) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/moniker_kind.ex#L9 "View Source") ``` @type t() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#export/0 "Link to this function") export() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/moniker_kind.ex#L23 "View Source") ``` @spec export() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` The moniker represents a symbol that is exported from a project [Link to this function](#import/0 "Link to this function") import() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/moniker_kind.ex#L17 "View Source") ``` @spec import() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` The moniker represent a symbol that is imported into a project [Link to this function](#local/0 "Link to this function") local() ======= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/moniker_kind.ex#L30 "View Source") ``` @spec local() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` The moniker represents a symbol that is local to a project (e.g. a local variable of a function, a class not visible outside the project, ...) GenLSP.Enumerations.NotebookCellKind β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/notebook_cell_kind.ex#L2 "View Source") GenLSP.Enumerations.NotebookCellKind (gen\_lsp v0.6.0) ============================================================================================================================================================================================================= A notebook cell kind. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [code()](#code/0) A code-cell is source code. [markup()](#markup/0) A markup-cell is formatted source that is used for display. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/notebook_cell_kind.ex#L9 "View Source") ``` @type t() :: 1 | 2 ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#code/0 "Link to this function") code() ====== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/notebook_cell_kind.ex#L23 "View Source") ``` @spec code() :: 2 ``` A code-cell is source code. [Link to this function](#markup/0 "Link to this function") markup() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/notebook_cell_kind.ex#L17 "View Source") ``` @spec markup() :: 1 ``` A markup-cell is formatted source that is used for display. GenLSP.Enumerations.PositionEncodingKind β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/position_encoding_kind.ex#L2 "View Source") GenLSP.Enumerations.PositionEncodingKind (gen\_lsp v0.6.0) ===================================================================================================================================================================================================================== A set of predefined position encoding kinds. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [utf8()](#utf8/0) Character offsets count UTF-8 code units. [utf16()](#utf16/0) Character offsets count UTF-16 code units. [utf32()](#utf32/0) Character offsets count UTF-32 code units. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/position_encoding_kind.ex#L9 "View Source") ``` @type t() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#utf8/0 "Link to this function") utf8() ====== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/position_encoding_kind.ex#L17 "View Source") ``` @spec utf8() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Character offsets count UTF-8 code units. [Link to this function](#utf16/0 "Link to this function") utf16() ======= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/position_encoding_kind.ex#L26 "View Source") ``` @spec utf16() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Character offsets count UTF-16 code units. This is the default and must always be supported by servers [Link to this function](#utf32/0 "Link to this function") utf32() ======= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/position_encoding_kind.ex#L36 "View Source") ``` @spec utf32() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Character offsets count UTF-32 code units. Implementation note: these are the same as Unicode code points, so this `PositionEncodingKind` may also be used for an encoding-agnostic representation of character offsets. GenLSP.Enumerations.PrepareSupportDefaultBehavior β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/prepare_support_default_behavior.ex#L2 "View Source") GenLSP.Enumerations.PrepareSupportDefaultBehavior (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [identifier()](#identifier/0) The client's default behavior is to select the identifier according the to language's syntax rule. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/prepare_support_default_behavior.ex#L3 "View Source") ``` @type t() :: 1 ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#identifier/0 "Link to this function") identifier() ============ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/prepare_support_default_behavior.ex#L12 "View Source") ``` @spec identifier() :: 1 ``` The client's default behavior is to select the identifier according the to language's syntax rule. GenLSP.Enumerations.ResourceOperationKind β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/resource_operation_kind.ex#L2 "View Source") GenLSP.Enumerations.ResourceOperationKind (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================= [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [create()](#create/0) Supports creating new files and folders. [delete()](#delete/0) Supports deleting existing files and folders. [rename()](#rename/0) Supports renaming existing files and folders. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/resource_operation_kind.ex#L3 "View Source") ``` @type t() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#create/0 "Link to this function") create() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/resource_operation_kind.ex#L11 "View Source") ``` @spec create() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Supports creating new files and folders. [Link to this function](#delete/0 "Link to this function") delete() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/resource_operation_kind.ex#L23 "View Source") ``` @spec delete() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Supports deleting existing files and folders. [Link to this function](#rename/0 "Link to this function") rename() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/resource_operation_kind.ex#L17 "View Source") ``` @spec rename() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Supports renaming existing files and folders. GenLSP.Enumerations.SemanticTokenModifiers β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_modifiers.ex#L2 "View Source") GenLSP.Enumerations.SemanticTokenModifiers (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================= A set of predefined token modifiers. This set is not fixed an clients can specify additional token types via the corresponding client capabilities. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [abstract()](#abstract/0) [async()](#async/0) [declaration()](#declaration/0) [default\_library()](#default_library/0) [definition()](#definition/0) [deprecated()](#deprecated/0) [documentation()](#documentation/0) [modification()](#modification/0) [readonly()](#readonly/0) [static()](#static/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_modifiers.ex#L11 "View Source") ``` @type t() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#abstract/0 "Link to this function") abstract() ========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_modifiers.ex#L31 "View Source") ``` @spec abstract() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#async/0 "Link to this function") async() ======= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_modifiers.ex#L34 "View Source") ``` @spec async() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#declaration/0 "Link to this function") declaration() ============= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_modifiers.ex#L16 "View Source") ``` @spec declaration() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#default_library/0 "Link to this function") default\_library() ================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_modifiers.ex#L43 "View Source") ``` @spec default_library() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#definition/0 "Link to this function") definition() ============ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_modifiers.ex#L19 "View Source") ``` @spec definition() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#deprecated/0 "Link to this function") deprecated() ============ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_modifiers.ex#L28 "View Source") ``` @spec deprecated() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#documentation/0 "Link to this function") documentation() =============== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_modifiers.ex#L40 "View Source") ``` @spec documentation() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#modification/0 "Link to this function") modification() ============== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_modifiers.ex#L37 "View Source") ``` @spec modification() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#readonly/0 "Link to this function") readonly() ========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_modifiers.ex#L22 "View Source") ``` @spec readonly() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#static/0 "Link to this function") static() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_modifiers.ex#L25 "View Source") ``` @spec static() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` GenLSP.Enumerations.SemanticTokenTypes β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_types.ex#L2 "View Source") GenLSP.Enumerations.SemanticTokenTypes (gen\_lsp v0.6.0) ================================================================================================================================================================================================================= A set of predefined token types. This set is not fixed an clients can specify additional token types via the corresponding client capabilities. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [class()](#class/0) [comment()](#comment/0) [decorator()](#decorator/0) @since 3.17.0 [enum()](#enum/0) [enum\_member()](#enum_member/0) [event()](#event/0) [function()](#function/0) [interface()](#interface/0) [keyword()](#keyword/0) [macro()](#macro/0) [method()](#method/0) [modifier()](#modifier/0) [namespace()](#namespace/0) [number()](#number/0) [operator()](#operator/0) [parameter()](#parameter/0) [property()](#property/0) [regexp()](#regexp/0) [string()](#string/0) [struct()](#struct/0) [type()](#type/0) Represents a generic type. Acts as a fallback for types which can't be mapped to a specific type like class or enum. [type\_parameter()](#type_parameter/0) [variable()](#variable/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_types.ex#L11 "View Source") ``` @type t() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#class/0 "Link to this function") class() ======= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_types.ex#L26 "View Source") ``` @spec class() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#comment/0 "Link to this function") comment() ========= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_types.ex#L71 "View Source") ``` @spec comment() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#decorator/0 "Link to this function") decorator() =========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_types.ex#L89 "View Source") ``` @spec decorator() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` @since 3.17.0 [Link to this function](#enum/0 "Link to this function") enum() ====== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_types.ex#L29 "View Source") ``` @spec enum() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#enum_member/0 "Link to this function") enum\_member() ============== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_types.ex#L50 "View Source") ``` @spec enum_member() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#event/0 "Link to this function") event() ======= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_types.ex#L53 "View Source") ``` @spec event() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#function/0 "Link to this function") function() ========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_types.ex#L56 "View Source") ``` @spec function() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#interface/0 "Link to this function") interface() =========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_types.ex#L32 "View Source") ``` @spec interface() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#keyword/0 "Link to this function") keyword() ========= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_types.ex#L65 "View Source") ``` @spec keyword() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#macro/0 "Link to this function") macro() ======= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_types.ex#L62 "View Source") ``` @spec macro() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#method/0 "Link to this function") method() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_types.ex#L59 "View Source") ``` @spec method() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#modifier/0 "Link to this function") modifier() ========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_types.ex#L68 "View Source") ``` @spec modifier() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#namespace/0 "Link to this function") namespace() =========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_types.ex#L16 "View Source") ``` @spec namespace() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#number/0 "Link to this function") number() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_types.ex#L77 "View Source") ``` @spec number() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#operator/0 "Link to this function") operator() ========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_types.ex#L83 "View Source") ``` @spec operator() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#parameter/0 "Link to this function") parameter() =========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_types.ex#L41 "View Source") ``` @spec parameter() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#property/0 "Link to this function") property() ========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_types.ex#L47 "View Source") ``` @spec property() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#regexp/0 "Link to this function") regexp() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_types.ex#L80 "View Source") ``` @spec regexp() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#string/0 "Link to this function") string() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_types.ex#L74 "View Source") ``` @spec string() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#struct/0 "Link to this function") struct() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_types.ex#L35 "View Source") ``` @spec struct() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#type/0 "Link to this function") type() ====== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_types.ex#L23 "View Source") ``` @spec type() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Represents a generic type. Acts as a fallback for types which can't be mapped to a specific type like class or enum. [Link to this function](#type_parameter/0 "Link to this function") type\_parameter() ================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_types.ex#L38 "View Source") ``` @spec type_parameter() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#variable/0 "Link to this function") variable() ========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/semantic_token_types.ex#L44 "View Source") ``` @spec variable() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` GenLSP.Enumerations.SignatureHelpTriggerKind β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/signature_help_trigger_kind.ex#L2 "View Source") GenLSP.Enumerations.SignatureHelpTriggerKind (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================== How a signature help was triggered. @since 3.15.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [content\_change()](#content_change/0) Signature help was triggered by the cursor moving or by the document content changing. [invoked()](#invoked/0) Signature help was invoked manually by the user or by a command. [trigger\_character()](#trigger_character/0) Signature help was triggered by a trigger character. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/signature_help_trigger_kind.ex#L9 "View Source") ``` @type t() :: 1 | 2 | 3 ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#content_change/0 "Link to this function") content\_change() ================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/signature_help_trigger_kind.ex#L29 "View Source") ``` @spec content_change() :: 3 ``` Signature help was triggered by the cursor moving or by the document content changing. [Link to this function](#invoked/0 "Link to this function") invoked() ========= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/signature_help_trigger_kind.ex#L17 "View Source") ``` @spec invoked() :: 1 ``` Signature help was invoked manually by the user or by a command. [Link to this function](#trigger_character/0 "Link to this function") trigger\_character() ==================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/signature_help_trigger_kind.ex#L23 "View Source") ``` @spec trigger_character() :: 2 ``` Signature help was triggered by a trigger character. GenLSP.Enumerations.SymbolKind β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L2 "View Source") GenLSP.Enumerations.SymbolKind (gen\_lsp v0.6.0) ================================================================================================================================================================================================ A symbol kind. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [array()](#array/0) [boolean()](#boolean/0) [class()](#class/0) [constant()](#constant/0) [constructor()](#constructor/0) [enum()](#enum/0) [enum\_member()](#enum_member/0) [event()](#event/0) [field()](#field/0) [file()](#file/0) [function()](#function/0) [interface()](#interface/0) [key()](#key/0) [method()](#method/0) [module()](#module/0) [namespace()](#namespace/0) [null()](#null/0) [number()](#number/0) [object()](#object/0) [operator()](#operator/0) [package()](#package/0) [property()](#property/0) [string()](#string/0) [struct()](#struct/0) [type\_parameter()](#type_parameter/0) [variable()](#variable/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L7 "View Source") ``` @type t() :: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#array/0 "Link to this function") array() ======= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L89 "View Source") ``` @spec array() :: 18 ``` [Link to this function](#boolean/0 "Link to this function") boolean() ========= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L86 "View Source") ``` @spec boolean() :: 17 ``` [Link to this function](#class/0 "Link to this function") class() ======= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L50 "View Source") ``` @spec class() :: 5 ``` [Link to this function](#constant/0 "Link to this function") constant() ========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L77 "View Source") ``` @spec constant() :: 14 ``` [Link to this function](#constructor/0 "Link to this function") constructor() ============= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L62 "View Source") ``` @spec constructor() :: 9 ``` [Link to this function](#enum/0 "Link to this function") enum() ====== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L65 "View Source") ``` @spec enum() :: 10 ``` [Link to this function](#enum_member/0 "Link to this function") enum\_member() ============== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L101 "View Source") ``` @spec enum_member() :: 22 ``` [Link to this function](#event/0 "Link to this function") event() ======= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L107 "View Source") ``` @spec event() :: 24 ``` [Link to this function](#field/0 "Link to this function") field() ======= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L59 "View Source") ``` @spec field() :: 8 ``` [Link to this function](#file/0 "Link to this function") file() ====== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L38 "View Source") ``` @spec file() :: 1 ``` [Link to this function](#function/0 "Link to this function") function() ========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L71 "View Source") ``` @spec function() :: 12 ``` [Link to this function](#interface/0 "Link to this function") interface() =========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L68 "View Source") ``` @spec interface() :: 11 ``` [Link to this function](#key/0 "Link to this function") key() ===== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L95 "View Source") ``` @spec key() :: 20 ``` [Link to this function](#method/0 "Link to this function") method() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L53 "View Source") ``` @spec method() :: 6 ``` [Link to this function](#module/0 "Link to this function") module() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L41 "View Source") ``` @spec module() :: 2 ``` [Link to this function](#namespace/0 "Link to this function") namespace() =========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L44 "View Source") ``` @spec namespace() :: 3 ``` [Link to this function](#null/0 "Link to this function") null() ====== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L98 "View Source") ``` @spec null() :: 21 ``` [Link to this function](#number/0 "Link to this function") number() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L83 "View Source") ``` @spec number() :: 16 ``` [Link to this function](#object/0 "Link to this function") object() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L92 "View Source") ``` @spec object() :: 19 ``` [Link to this function](#operator/0 "Link to this function") operator() ========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L110 "View Source") ``` @spec operator() :: 25 ``` [Link to this function](#package/0 "Link to this function") package() ========= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L47 "View Source") ``` @spec package() :: 4 ``` [Link to this function](#property/0 "Link to this function") property() ========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L56 "View Source") ``` @spec property() :: 7 ``` [Link to this function](#string/0 "Link to this function") string() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L80 "View Source") ``` @spec string() :: 15 ``` [Link to this function](#struct/0 "Link to this function") struct() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L104 "View Source") ``` @spec struct() :: 23 ``` [Link to this function](#type_parameter/0 "Link to this function") type\_parameter() ================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L113 "View Source") ``` @spec type_parameter() :: 26 ``` [Link to this function](#variable/0 "Link to this function") variable() ========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_kind.ex#L74 "View Source") ``` @spec variable() :: 13 ``` GenLSP.Enumerations.SymbolTag β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_tag.ex#L2 "View Source") GenLSP.Enumerations.SymbolTag (gen\_lsp v0.6.0) ============================================================================================================================================================================================== Symbol tags are extra annotations that tweak the rendering of a symbol. @since 3.16 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [deprecated()](#deprecated/0) Render a symbol as obsolete, usually using a strike-out. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_tag.ex#L9 "View Source") ``` @type t() :: 1 ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#deprecated/0 "Link to this function") deprecated() ============ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/symbol_tag.ex#L17 "View Source") ``` @spec deprecated() :: 1 ``` Render a symbol as obsolete, usually using a strike-out. GenLSP.Enumerations.TextDocumentSaveReason β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/text_document_save_reason.ex#L2 "View Source") GenLSP.Enumerations.TextDocumentSaveReason (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================== Represents reasons why a text document is saved. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [after\_delay()](#after_delay/0) Automatic after a delay. [focus\_out()](#focus_out/0) When the editor lost focus. [manual()](#manual/0) Manually triggered, e.g. by the user pressing save, by starting debugging, or by an API call. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/text_document_save_reason.ex#L7 "View Source") ``` @type t() :: 1 | 2 | 3 ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#after_delay/0 "Link to this function") after\_delay() ============== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/text_document_save_reason.ex#L22 "View Source") ``` @spec after_delay() :: 2 ``` Automatic after a delay. [Link to this function](#focus_out/0 "Link to this function") focus\_out() ============ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/text_document_save_reason.ex#L28 "View Source") ``` @spec focus_out() :: 3 ``` When the editor lost focus. [Link to this function](#manual/0 "Link to this function") manual() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/text_document_save_reason.ex#L16 "View Source") ``` @spec manual() :: 1 ``` Manually triggered, e.g. by the user pressing save, by starting debugging, or by an API call. GenLSP.Enumerations.TextDocumentSyncKind β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/text_document_sync_kind.ex#L2 "View Source") GenLSP.Enumerations.TextDocumentSyncKind (gen\_lsp v0.6.0) ====================================================================================================================================================================================================================== Defines how the host (editor) should sync document changes to the language server. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [full()](#full/0) Documents are synced by always sending the full content of the document. [incremental()](#incremental/0) Documents are synced by sending the full content on open. After that only incremental updates to the document are send. [none()](#none/0) Documents should not be synced at all. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/text_document_sync_kind.ex#L8 "View Source") ``` @type t() :: 0 | 1 | 2 ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#full/0 "Link to this function") full() ====== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/text_document_sync_kind.ex#L23 "View Source") ``` @spec full() :: 1 ``` Documents are synced by always sending the full content of the document. [Link to this function](#incremental/0 "Link to this function") incremental() ============= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/text_document_sync_kind.ex#L31 "View Source") ``` @spec incremental() :: 2 ``` Documents are synced by sending the full content on open. After that only incremental updates to the document are send. [Link to this function](#none/0 "Link to this function") none() ====== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/text_document_sync_kind.ex#L16 "View Source") ``` @spec none() :: 0 ``` Documents should not be synced at all. GenLSP.Enumerations.TokenFormat β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/token_format.ex#L2 "View Source") GenLSP.Enumerations.TokenFormat (gen\_lsp v0.6.0) ================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [relative()](#relative/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/token_format.ex#L3 "View Source") ``` @type t() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#relative/0 "Link to this function") relative() ========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/token_format.ex#L8 "View Source") ``` @spec relative() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` GenLSP.Enumerations.TraceValues β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/trace_values.ex#L2 "View Source") GenLSP.Enumerations.TraceValues (gen\_lsp v0.6.0) ================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [messages()](#messages/0) Trace messages only. [off()](#off/0) Turn tracing off. [verbose()](#verbose/0) Verbose message tracing. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/trace_values.ex#L3 "View Source") ``` @type t() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#messages/0 "Link to this function") messages() ========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/trace_values.ex#L17 "View Source") ``` @spec messages() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Trace messages only. [Link to this function](#off/0 "Link to this function") off() ===== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/trace_values.ex#L11 "View Source") ``` @spec off() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Turn tracing off. [Link to this function](#verbose/0 "Link to this function") verbose() ========= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/trace_values.ex#L23 "View Source") ``` @spec verbose() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Verbose message tracing. GenLSP.Enumerations.UniquenessLevel β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/uniqueness_level.ex#L2 "View Source") GenLSP.Enumerations.UniquenessLevel (gen\_lsp v0.6.0) ========================================================================================================================================================================================================== Moniker uniqueness level to define scope of the moniker. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [document()](#document/0) The moniker is only unique inside a document [global()](#global/0) The moniker is globally unique [group()](#group/0) The moniker is unique inside the group to which a project belongs [project()](#project/0) The moniker is unique inside a project for which a dump got created [scheme()](#scheme/0) The moniker is unique inside the moniker scheme. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/uniqueness_level.ex#L9 "View Source") ``` @type t() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#document/0 "Link to this function") document() ========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/uniqueness_level.ex#L17 "View Source") ``` @spec document() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` The moniker is only unique inside a document [Link to this function](#global/0 "Link to this function") global() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/uniqueness_level.ex#L41 "View Source") ``` @spec global() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` The moniker is globally unique [Link to this function](#group/0 "Link to this function") group() ======= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/uniqueness_level.ex#L29 "View Source") ``` @spec group() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` The moniker is unique inside the group to which a project belongs [Link to this function](#project/0 "Link to this function") project() ========= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/uniqueness_level.ex#L23 "View Source") ``` @spec project() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` The moniker is unique inside a project for which a dump got created [Link to this function](#scheme/0 "Link to this function") scheme() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/uniqueness_level.ex#L35 "View Source") ``` @spec scheme() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` The moniker is unique inside the moniker scheme. GenLSP.Enumerations.WatchKind β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/watch_kind.ex#L2 "View Source") GenLSP.Enumerations.WatchKind (gen\_lsp v0.6.0) ============================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [change()](#change/0) Interested in change events [create()](#create/0) Interested in create events. [delete()](#delete/0) Interested in delete events [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/watch_kind.ex#L3 "View Source") ``` @type t() :: 1 | 2 | 4 ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#change/0 "Link to this function") change() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/watch_kind.ex#L17 "View Source") ``` @spec change() :: 2 ``` Interested in change events [Link to this function](#create/0 "Link to this function") create() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/watch_kind.ex#L11 "View Source") ``` @spec create() :: 1 ``` Interested in create events. [Link to this function](#delete/0 "Link to this function") delete() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/enumerations/watch_kind.ex#L23 "View Source") ``` @spec delete() :: 4 ``` Interested in delete events GenLSP.ErrorResponse β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/error_response.ex#L2 "View Source") GenLSP.ErrorResponse (gen\_lsp v0.6.0) ============================================================================================================================================================================ A Response Message sent as a result of a request. If a request doesn’t provide a result value the receiver of a request still needs to return a response message to conform to the JSON-RPC specification. The result property of the ResponseMessage should be set to null in this case to signal a successful request. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [schematic()](#schematic/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/error_response.ex#L14 "View Source") ``` @type t() :: %GenLSP.ErrorResponse{ code: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), data: ([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | [number](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [list](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil) | nil, message: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#schematic/0 "Link to this function") schematic() =========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/error_response.ex#L21 "View Source") ``` @spec schematic() :: [Schematic.t](https://hexdocs.pm/schematic/0.2.1/Schematic.html#t:t/0)() ``` GenLSP.LSP β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/lsp.ex#L1 "View Source") GenLSP.LSP (gen\_lsp v0.6.0) ============================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.LSP{}](#__struct__/0) The LSP data structure. [assign(lsp, new\_assigns)](#assign/2) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/lsp.ex#L7 "View Source") ``` @type t() :: %GenLSP.LSP{ assigns: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), buffer: ([atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [pid](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) | nil, mod: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), pid: [pid](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.LSP{} ============= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/lsp.ex#L7 "View Source") (struct) The LSP data structure. [Link to this function](#assign/2 "Link to this function") assign(lsp, new\_assigns) ========================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/lsp.ex#L15 "View Source") ``` @spec assign([t](#t:t/0)(), [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: [t](#t:t/0)() ``` GenLSP.Notifications β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications.ex#L2 "View Source") GenLSP.Notifications (gen\_lsp v0.6.0) =========================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [new(notification)](#new/1) [Link to this section](#functions) Functions ============================================= [Link to this function](#new/1 "Link to this function") new(notification) ================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications.ex#L5 "View Source") GenLSP.Notifications.DollarCancelRequest β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/dollar_cancel_request.ex#L2 "View Source") GenLSP.Notifications.DollarCancelRequest (gen\_lsp v0.6.0) ===================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/dollar_cancel_request.ex#L8 "View Source") ``` @type t() :: %GenLSP.Notifications.DollarCancelRequest{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.CancelParams.t](GenLSP.Structures.CancelParams.html#t:t/0)() | nil } ``` GenLSP.Notifications.DollarLogTrace β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/dollar_log_trace.ex#L2 "View Source") GenLSP.Notifications.DollarLogTrace (gen\_lsp v0.6.0) =========================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/dollar_log_trace.ex#L8 "View Source") ``` @type t() :: %GenLSP.Notifications.DollarLogTrace{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.LogTraceParams.t](GenLSP.Structures.LogTraceParams.html#t:t/0)() | nil } ``` GenLSP.Notifications.DollarProgress β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/dollar_progress.ex#L2 "View Source") GenLSP.Notifications.DollarProgress (gen\_lsp v0.6.0) ========================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/dollar_progress.ex#L8 "View Source") ``` @type t() :: %GenLSP.Notifications.DollarProgress{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.ProgressParams.t](GenLSP.Structures.ProgressParams.html#t:t/0)() | nil } ``` GenLSP.Notifications.DollarSetTrace β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/dollar_set_trace.ex#L2 "View Source") GenLSP.Notifications.DollarSetTrace (gen\_lsp v0.6.0) =========================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/dollar_set_trace.ex#L8 "View Source") ``` @type t() :: %GenLSP.Notifications.DollarSetTrace{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.SetTraceParams.t](GenLSP.Structures.SetTraceParams.html#t:t/0)() | nil } ``` GenLSP.Notifications.Exit β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/exit.ex#L2 "View Source") GenLSP.Notifications.Exit (gen\_lsp v0.6.0) ===================================================================================================================================================================================== The exit event is sent from the client to the server to ask the server to exit its process. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/exit.ex#L15 "View Source") ``` @type t() :: %GenLSP.Notifications.Exit{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: nil | nil } ``` GenLSP.Notifications.Initialized β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/initialized.ex#L2 "View Source") GenLSP.Notifications.Initialized (gen\_lsp v0.6.0) =================================================================================================================================================================================================== The initialized notification is sent from the client to the server after the client is fully initialized and the server is allowed to send requests from the server to the client. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/initialized.ex#L16 "View Source") ``` @type t() :: %GenLSP.Notifications.Initialized{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.InitializedParams.t](GenLSP.Structures.InitializedParams.html#t:t/0)() | nil } ``` GenLSP.Notifications.NotebookDocumentDidChange β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/notebook_document_did_change.ex#L2 "View Source") GenLSP.Notifications.NotebookDocumentDidChange (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/notebook_document_did_change.ex#L8 "View Source") ``` @type t() :: %GenLSP.Notifications.NotebookDocumentDidChange{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.DidChangeNotebookDocumentParams.t](GenLSP.Structures.DidChangeNotebookDocumentParams.html#t:t/0)() | nil } ``` GenLSP.Notifications.NotebookDocumentDidClose β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/notebook_document_did_close.ex#L2 "View Source") GenLSP.Notifications.NotebookDocumentDidClose (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================ A notification sent when a notebook closes. @since 3.17.0 Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/notebook_document_did_close.ex#L16 "View Source") ``` @type t() :: %GenLSP.Notifications.NotebookDocumentDidClose{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.DidCloseNotebookDocumentParams.t](GenLSP.Structures.DidCloseNotebookDocumentParams.html#t:t/0)() | nil } ``` GenLSP.Notifications.NotebookDocumentDidOpen β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/notebook_document_did_open.ex#L2 "View Source") GenLSP.Notifications.NotebookDocumentDidOpen (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================== A notification sent when a notebook opens. @since 3.17.0 Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/notebook_document_did_open.ex#L16 "View Source") ``` @type t() :: %GenLSP.Notifications.NotebookDocumentDidOpen{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.DidOpenNotebookDocumentParams.t](GenLSP.Structures.DidOpenNotebookDocumentParams.html#t:t/0)() | nil } ``` GenLSP.Notifications.NotebookDocumentDidSave β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/notebook_document_did_save.ex#L2 "View Source") GenLSP.Notifications.NotebookDocumentDidSave (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================== A notification sent when a notebook document is saved. @since 3.17.0 Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/notebook_document_did_save.ex#L16 "View Source") ``` @type t() :: %GenLSP.Notifications.NotebookDocumentDidSave{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.DidSaveNotebookDocumentParams.t](GenLSP.Structures.DidSaveNotebookDocumentParams.html#t:t/0)() | nil } ``` GenLSP.Notifications.TelemetryEvent β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/telemetry_event.ex#L2 "View Source") GenLSP.Notifications.TelemetryEvent (gen\_lsp v0.6.0) ========================================================================================================================================================================================================== The telemetry event notification is sent from the server to the client to ask the client to log telemetry data. Message Direction: serverToClient [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/telemetry_event.ex#L15 "View Source") ``` @type t() :: %GenLSP.Notifications.TelemetryEvent{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.TypeAlias.LSPAny.t](GenLSP.TypeAlias.LSPAny.html#t:t/0)() | nil } ``` GenLSP.Notifications.TextDocumentDidChange β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/text_document_did_change.ex#L2 "View Source") GenLSP.Notifications.TextDocumentDidChange (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================== The document change notification is sent from the client to the server to signal changes to a text document. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/text_document_did_change.ex#L15 "View Source") ``` @type t() :: %GenLSP.Notifications.TextDocumentDidChange{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.DidChangeTextDocumentParams.t](GenLSP.Structures.DidChangeTextDocumentParams.html#t:t/0)() | nil } ``` GenLSP.Notifications.TextDocumentDidClose β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/text_document_did_close.ex#L2 "View Source") GenLSP.Notifications.TextDocumentDidClose (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================== The document close notification is sent from the client to the server when the document got closed in the client. The document's truth now exists where the document's uri points to (e.g. if the document's uri is a file uri the truth now exists on disk). As with the open notification the close notification is about managing the document's content. Receiving a close notification doesn't mean that the document was open in an editor before. A close notification requires a previous open notification to be sent. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/text_document_did_close.ex#L20 "View Source") ``` @type t() :: %GenLSP.Notifications.TextDocumentDidClose{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.DidCloseTextDocumentParams.t](GenLSP.Structures.DidCloseTextDocumentParams.html#t:t/0)() | nil } ``` GenLSP.Notifications.TextDocumentDidOpen β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/text_document_did_open.ex#L2 "View Source") GenLSP.Notifications.TextDocumentDidOpen (gen\_lsp v0.6.0) ====================================================================================================================================================================================================================== The document open notification is sent from the client to the server to signal newly opened text documents. The document's truth is now managed by the client and the server must not try to read the document's truth using the document's uri. Open in this sense means it is managed by the client. It doesn't necessarily mean that its content is presented in an editor. An open notification must not be sent more than once without a corresponding close notification send before. This means open and close notification must be balanced and the max open count is one. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/text_document_did_open.ex#L21 "View Source") ``` @type t() :: %GenLSP.Notifications.TextDocumentDidOpen{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.DidOpenTextDocumentParams.t](GenLSP.Structures.DidOpenTextDocumentParams.html#t:t/0)() | nil } ``` GenLSP.Notifications.TextDocumentDidSave β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/text_document_did_save.ex#L2 "View Source") GenLSP.Notifications.TextDocumentDidSave (gen\_lsp v0.6.0) ====================================================================================================================================================================================================================== The document save notification is sent from the client to the server when the document got saved in the client. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/text_document_did_save.ex#L15 "View Source") ``` @type t() :: %GenLSP.Notifications.TextDocumentDidSave{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.DidSaveTextDocumentParams.t](GenLSP.Structures.DidSaveTextDocumentParams.html#t:t/0)() | nil } ``` GenLSP.Notifications.TextDocumentPublishDiagnostics β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/text_document_publish_diagnostics.ex#L2 "View Source") GenLSP.Notifications.TextDocumentPublishDiagnostics (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================================ Diagnostics notification are sent from the server to the client to signal results of validation runs. Message Direction: serverToClient [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/text_document_publish_diagnostics.ex#L15 "View Source") ``` @type t() :: %GenLSP.Notifications.TextDocumentPublishDiagnostics{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.PublishDiagnosticsParams.t](GenLSP.Structures.PublishDiagnosticsParams.html#t:t/0)() | nil } ``` GenLSP.Notifications.TextDocumentWillSave β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/text_document_will_save.ex#L2 "View Source") GenLSP.Notifications.TextDocumentWillSave (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================== A document will save notification is sent from the client to the server before the document is actually saved. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/text_document_will_save.ex#L15 "View Source") ``` @type t() :: %GenLSP.Notifications.TextDocumentWillSave{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.WillSaveTextDocumentParams.t](GenLSP.Structures.WillSaveTextDocumentParams.html#t:t/0)() | nil } ``` GenLSP.Notifications.WindowLogMessage β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/window_log_message.ex#L2 "View Source") GenLSP.Notifications.WindowLogMessage (gen\_lsp v0.6.0) =============================================================================================================================================================================================================== The log message notification is sent from the server to the client to ask the client to log a particular message. Message Direction: serverToClient [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/window_log_message.ex#L15 "View Source") ``` @type t() :: %GenLSP.Notifications.WindowLogMessage{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.LogMessageParams.t](GenLSP.Structures.LogMessageParams.html#t:t/0)() | nil } ``` GenLSP.Notifications.WindowShowMessage β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/window_show_message.ex#L2 "View Source") GenLSP.Notifications.WindowShowMessage (gen\_lsp v0.6.0) ================================================================================================================================================================================================================= The show message notification is sent from a server to a client to ask the client to display a particular message in the user interface. Message Direction: serverToClient [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/window_show_message.ex#L15 "View Source") ``` @type t() :: %GenLSP.Notifications.WindowShowMessage{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.ShowMessageParams.t](GenLSP.Structures.ShowMessageParams.html#t:t/0)() | nil } ``` GenLSP.Notifications.WindowWorkDoneProgressCancel β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/window_work_done_progress_cancel.ex#L2 "View Source") GenLSP.Notifications.WindowWorkDoneProgressCancel (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================================= The `window/workDoneProgress/cancel` notification is sent from the client to the server to cancel a progress initiated on the server side. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/window_work_done_progress_cancel.ex#L15 "View Source") ``` @type t() :: %GenLSP.Notifications.WindowWorkDoneProgressCancel{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.WorkDoneProgressCancelParams.t](GenLSP.Structures.WorkDoneProgressCancelParams.html#t:t/0)() | nil } ``` GenLSP.Notifications.WorkspaceDidChangeConfiguration β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/workspace_did_change_configuration.ex#L2 "View Source") GenLSP.Notifications.WorkspaceDidChangeConfiguration (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================================== The configuration change notification is sent from the client to the server when the client's configuration has changed. The notification contains the changed configuration as defined by the language client. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/workspace_did_change_configuration.ex#L16 "View Source") ``` @type t() :: %GenLSP.Notifications.WorkspaceDidChangeConfiguration{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.DidChangeConfigurationParams.t](GenLSP.Structures.DidChangeConfigurationParams.html#t:t/0)() | nil } ``` GenLSP.Notifications.WorkspaceDidChangeWatchedFiles β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/workspace_did_change_watched_files.ex#L2 "View Source") GenLSP.Notifications.WorkspaceDidChangeWatchedFiles (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================================= The watched files notification is sent from the client to the server when the client detects changes to file watched by the language client. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/workspace_did_change_watched_files.ex#L15 "View Source") ``` @type t() :: %GenLSP.Notifications.WorkspaceDidChangeWatchedFiles{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.DidChangeWatchedFilesParams.t](GenLSP.Structures.DidChangeWatchedFilesParams.html#t:t/0)() | nil } ``` GenLSP.Notifications.WorkspaceDidChangeWorkspaceFolders β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/workspace_did_change_workspace_folders.ex#L2 "View Source") GenLSP.Notifications.WorkspaceDidChangeWorkspaceFolders (gen\_lsp v0.6.0) ===================================================================================================================================================================================================================================================== The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace folder configuration changes. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/workspace_did_change_workspace_folders.ex#L15 "View Source") ``` @type t() :: %GenLSP.Notifications.WorkspaceDidChangeWorkspaceFolders{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.DidChangeWorkspaceFoldersParams.t](GenLSP.Structures.DidChangeWorkspaceFoldersParams.html#t:t/0)() | nil } ``` GenLSP.Notifications.WorkspaceDidCreateFiles β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/workspace_did_create_files.ex#L2 "View Source") GenLSP.Notifications.WorkspaceDidCreateFiles (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================== The did create files notification is sent from the client to the server when files were created from within the client. @since 3.16.0 Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/workspace_did_create_files.ex#L17 "View Source") ``` @type t() :: %GenLSP.Notifications.WorkspaceDidCreateFiles{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.CreateFilesParams.t](GenLSP.Structures.CreateFilesParams.html#t:t/0)() | nil } ``` GenLSP.Notifications.WorkspaceDidDeleteFiles β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/workspace_did_delete_files.ex#L2 "View Source") GenLSP.Notifications.WorkspaceDidDeleteFiles (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================== The will delete files request is sent from the client to the server before files are actually deleted as long as the deletion is triggered from within the client. @since 3.16.0 Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/workspace_did_delete_files.ex#L17 "View Source") ``` @type t() :: %GenLSP.Notifications.WorkspaceDidDeleteFiles{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.DeleteFilesParams.t](GenLSP.Structures.DeleteFilesParams.html#t:t/0)() | nil } ``` GenLSP.Notifications.WorkspaceDidRenameFiles β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/workspace_did_rename_files.ex#L2 "View Source") GenLSP.Notifications.WorkspaceDidRenameFiles (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================== The did rename files notification is sent from the client to the server when files were renamed from within the client. @since 3.16.0 Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/notifications/workspace_did_rename_files.ex#L17 "View Source") ``` @type t() :: %GenLSP.Notifications.WorkspaceDidRenameFiles{ jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.RenameFilesParams.t](GenLSP.Structures.RenameFilesParams.html#t:t/0)() | nil } ``` GenLSP.Requests β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests.ex#L2 "View Source") GenLSP.Requests (gen\_lsp v0.6.0) ================================================================================================================================================================= [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [new(request)](#new/1) [Link to this section](#functions) Functions ============================================= [Link to this function](#new/1 "Link to this function") new(request) ============ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests.ex#L5 "View Source") GenLSP.Requests.CallHierarchyIncomingCalls β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/call_hierarchy_incoming_calls.ex#L2 "View Source") GenLSP.Requests.CallHierarchyIncomingCalls (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================== A request to resolve the incoming calls for a given `CallHierarchyItem`. @since 3.16.0 Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/call_hierarchy_incoming_calls.ex#L23 "View Source") ``` @type result() :: [[GenLSP.Structures.CallHierarchyIncomingCall.t](GenLSP.Structures.CallHierarchyIncomingCall.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/call_hierarchy_incoming_calls.ex#L16 "View Source") ``` @type t() :: %GenLSP.Requests.CallHierarchyIncomingCalls{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.CallHierarchyIncomingCallsParams.t](GenLSP.Structures.CallHierarchyIncomingCallsParams.html#t:t/0)() | nil } ``` GenLSP.Requests.CallHierarchyOutgoingCalls β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/call_hierarchy_outgoing_calls.ex#L2 "View Source") GenLSP.Requests.CallHierarchyOutgoingCalls (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================== A request to resolve the outgoing calls for a given `CallHierarchyItem`. @since 3.16.0 Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/call_hierarchy_outgoing_calls.ex#L23 "View Source") ``` @type result() :: [[GenLSP.Structures.CallHierarchyOutgoingCall.t](GenLSP.Structures.CallHierarchyOutgoingCall.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/call_hierarchy_outgoing_calls.ex#L16 "View Source") ``` @type t() :: %GenLSP.Requests.CallHierarchyOutgoingCalls{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.CallHierarchyOutgoingCallsParams.t](GenLSP.Structures.CallHierarchyOutgoingCallsParams.html#t:t/0)() | nil } ``` GenLSP.Requests.ClientRegisterCapability β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/client_register_capability.ex#L2 "View Source") GenLSP.Requests.ClientRegisterCapability (gen\_lsp v0.6.0) ===================================================================================================================================================================================================================== The `client/registerCapability` request is sent from the server to the client to register a new capability handler on the client side. Message Direction: serverToClient [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/client_register_capability.ex#L22 "View Source") ``` @type result() :: nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/client_register_capability.ex#L15 "View Source") ``` @type t() :: %GenLSP.Requests.ClientRegisterCapability{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.RegistrationParams.t](GenLSP.Structures.RegistrationParams.html#t:t/0)() | nil } ``` GenLSP.Requests.ClientUnregisterCapability β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/client_unregister_capability.ex#L2 "View Source") GenLSP.Requests.ClientUnregisterCapability (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================= The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability handler on the client side. Message Direction: serverToClient [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/client_unregister_capability.ex#L22 "View Source") ``` @type result() :: nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/client_unregister_capability.ex#L15 "View Source") ``` @type t() :: %GenLSP.Requests.ClientUnregisterCapability{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.UnregistrationParams.t](GenLSP.Structures.UnregistrationParams.html#t:t/0)() | nil } ``` GenLSP.Requests.CodeActionResolve β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/code_action_resolve.ex#L2 "View Source") GenLSP.Requests.CodeActionResolve (gen\_lsp v0.6.0) ======================================================================================================================================================================================================= Request to resolve additional information for a given code action.The request's parameter is of type {@link CodeAction} the response is of type {@link CodeAction} or a Thenable that resolves to such. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/code_action_resolve.ex#L23 "View Source") ``` @type result() :: [GenLSP.Structures.CodeAction.t](GenLSP.Structures.CodeAction.html#t:t/0)() ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/code_action_resolve.ex#L16 "View Source") ``` @type t() :: %GenLSP.Requests.CodeActionResolve{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.CodeAction.t](GenLSP.Structures.CodeAction.html#t:t/0)() | nil } ``` GenLSP.Requests.CodeLensResolve β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/code_lens_resolve.ex#L2 "View Source") GenLSP.Requests.CodeLensResolve (gen\_lsp v0.6.0) =================================================================================================================================================================================================== A request to resolve a command for a given code lens. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/code_lens_resolve.ex#L21 "View Source") ``` @type result() :: [GenLSP.Structures.CodeLens.t](GenLSP.Structures.CodeLens.html#t:t/0)() ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/code_lens_resolve.ex#L14 "View Source") ``` @type t() :: %GenLSP.Requests.CodeLensResolve{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.CodeLens.t](GenLSP.Structures.CodeLens.html#t:t/0)() | nil } ``` GenLSP.Requests.CompletionItemResolve β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/completion_item_resolve.ex#L2 "View Source") GenLSP.Requests.CompletionItemResolve (gen\_lsp v0.6.0) =============================================================================================================================================================================================================== Request to resolve additional information for a given completion item.The request's parameter is of type {@link CompletionItem} the response is of type {@link CompletionItem} or a Thenable that resolves to such. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/completion_item_resolve.ex#L23 "View Source") ``` @type result() :: [GenLSP.Structures.CompletionItem.t](GenLSP.Structures.CompletionItem.html#t:t/0)() ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/completion_item_resolve.ex#L16 "View Source") ``` @type t() :: %GenLSP.Requests.CompletionItemResolve{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.CompletionItem.t](GenLSP.Structures.CompletionItem.html#t:t/0)() | nil } ``` GenLSP.Requests.DocumentLinkResolve β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/document_link_resolve.ex#L2 "View Source") GenLSP.Requests.DocumentLinkResolve (gen\_lsp v0.6.0) =========================================================================================================================================================================================================== Request to resolve additional information for a given document link. The request's parameter is of type {@link DocumentLink} the response is of type {@link DocumentLink} or a Thenable that resolves to such. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/document_link_resolve.ex#L23 "View Source") ``` @type result() :: [GenLSP.Structures.DocumentLink.t](GenLSP.Structures.DocumentLink.html#t:t/0)() ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/document_link_resolve.ex#L16 "View Source") ``` @type t() :: %GenLSP.Requests.DocumentLinkResolve{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.DocumentLink.t](GenLSP.Structures.DocumentLink.html#t:t/0)() | nil } ``` GenLSP.Requests.Initialize β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/initialize.ex#L2 "View Source") GenLSP.Requests.Initialize (gen\_lsp v0.6.0) ======================================================================================================================================================================================= The initialize request is sent from the client to the server. It is sent once as the request after starting up the server. The requests parameter is of type {@link InitializeParams} the response if of type {@link InitializeResult} of a Thenable that resolves to such. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/initialize.ex#L25 "View Source") ``` @type result() :: [GenLSP.Structures.InitializeResult.t](GenLSP.Structures.InitializeResult.html#t:t/0)() ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/initialize.ex#L18 "View Source") ``` @type t() :: %GenLSP.Requests.Initialize{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.InitializeParams.t](GenLSP.Structures.InitializeParams.html#t:t/0)() | nil } ``` GenLSP.Requests.InlayHintResolve β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/inlay_hint_resolve.ex#L2 "View Source") GenLSP.Requests.InlayHintResolve (gen\_lsp v0.6.0) ===================================================================================================================================================================================================== A request to resolve additional properties for an inlay hint. The request's parameter is of type {@link InlayHint}, the response is of type {@link InlayHint} or a Thenable that resolves to such. @since 3.17.0 Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/inlay_hint_resolve.ex#L25 "View Source") ``` @type result() :: [GenLSP.Structures.InlayHint.t](GenLSP.Structures.InlayHint.html#t:t/0)() ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/inlay_hint_resolve.ex#L18 "View Source") ``` @type t() :: %GenLSP.Requests.InlayHintResolve{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.InlayHint.t](GenLSP.Structures.InlayHint.html#t:t/0)() | nil } ``` GenLSP.Requests.Shutdown β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/shutdown.ex#L2 "View Source") GenLSP.Requests.Shutdown (gen\_lsp v0.6.0) =================================================================================================================================================================================== A shutdown request is sent from the client to the server. It is sent once when the client decides to shutdown the server. The only notification that is sent after a shutdown request is the exit event. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/shutdown.ex#L23 "View Source") ``` @type result() :: nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/shutdown.ex#L17 "View Source") ``` @type t() :: %GenLSP.Requests.Shutdown{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() } ``` GenLSP.Requests.TextDocumentCodeAction β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_code_action.ex#L2 "View Source") GenLSP.Requests.TextDocumentCodeAction (gen\_lsp v0.6.0) ================================================================================================================================================================================================================== A request to provide commands for the given text document and range. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_code_action.ex#L21 "View Source") ``` @type result() :: [[GenLSP.Structures.Command.t](GenLSP.Structures.Command.html#t:t/0)() | [GenLSP.Structures.CodeAction.t](GenLSP.Structures.CodeAction.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_code_action.ex#L14 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentCodeAction{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.CodeActionParams.t](GenLSP.Structures.CodeActionParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentCodeLens β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_code_lens.ex#L2 "View Source") GenLSP.Requests.TextDocumentCodeLens (gen\_lsp v0.6.0) ============================================================================================================================================================================================================== A request to provide code lens for the given text document. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_code_lens.ex#L21 "View Source") ``` @type result() :: [[GenLSP.Structures.CodeLens.t](GenLSP.Structures.CodeLens.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_code_lens.ex#L14 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentCodeLens{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.CodeLensParams.t](GenLSP.Structures.CodeLensParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentColorPresentation β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_color_presentation.ex#L2 "View Source") GenLSP.Requests.TextDocumentColorPresentation (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================ A request to list all presentation for a color. The request's parameter is of type {@link ColorPresentationParams} the response is of type {@link ColorInformation ColorInformation[]} or a Thenable that resolves to such. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_color_presentation.ex#L24 "View Source") ``` @type result() :: [[GenLSP.Structures.ColorPresentation.t](GenLSP.Structures.ColorPresentation.html#t:t/0)()] ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_color_presentation.ex#L17 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentColorPresentation{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.ColorPresentationParams.t](GenLSP.Structures.ColorPresentationParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentCompletion β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_completion.ex#L2 "View Source") GenLSP.Requests.TextDocumentCompletion (gen\_lsp v0.6.0) ================================================================================================================================================================================================================= Request to request completion at a given text document position. The request's parameter is of type {@link TextDocumentPosition} the response is of type {@link CompletionItem CompletionItem[]} or {@link CompletionList} or a Thenable that resolves to such. The request can delay the computation of the {@link CompletionItem.detail `detail`} and {@link CompletionItem.documentation `documentation`} properties to the `completionItem/resolve` request. However, properties that are needed for the initial sorting and filtering, like `sortText`, `filterText`, `insertText`, and `textEdit`, must not be changed during resolve. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_completion.ex#L29 "View Source") ``` @type result() :: [[GenLSP.Structures.CompletionItem.t](GenLSP.Structures.CompletionItem.html#t:t/0)()] | [GenLSP.Structures.CompletionList.t](GenLSP.Structures.CompletionList.html#t:t/0)() | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_completion.ex#L22 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentCompletion{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.CompletionParams.t](GenLSP.Structures.CompletionParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentDeclaration β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_declaration.ex#L2 "View Source") GenLSP.Requests.TextDocumentDeclaration (gen\_lsp v0.6.0) =================================================================================================================================================================================================================== A request to resolve the type definition locations of a symbol at a given text document position. The request's parameter is of type [TextDocumentPositionParams] (#TextDocumentPositionParams) the response is of type {@link Declaration} or a typed array of {@link DeclarationLink} or a Thenable that resolves to such. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_declaration.ex#L25 "View Source") ``` @type result() :: [GenLSP.TypeAlias.Declaration.t](GenLSP.TypeAlias.Declaration.html#t:t/0)() | [[GenLSP.TypeAlias.DeclarationLink.t](GenLSP.TypeAlias.DeclarationLink.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_declaration.ex#L18 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentDeclaration{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.DeclarationParams.t](GenLSP.Structures.DeclarationParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentDefinition β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_definition.ex#L2 "View Source") GenLSP.Requests.TextDocumentDefinition (gen\_lsp v0.6.0) ================================================================================================================================================================================================================= A request to resolve the definition location of a symbol at a given text document position. The request's parameter is of type [TextDocumentPosition] (#TextDocumentPosition) the response is of either type {@link Definition} or a typed array of {@link DefinitionLink} or a Thenable that resolves to such. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_definition.ex#L25 "View Source") ``` @type result() :: [GenLSP.TypeAlias.Definition.t](GenLSP.TypeAlias.Definition.html#t:t/0)() | [[GenLSP.TypeAlias.DefinitionLink.t](GenLSP.TypeAlias.DefinitionLink.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_definition.ex#L18 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentDefinition{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.DefinitionParams.t](GenLSP.Structures.DefinitionParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentDiagnostic β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_diagnostic.ex#L2 "View Source") GenLSP.Requests.TextDocumentDiagnostic (gen\_lsp v0.6.0) ================================================================================================================================================================================================================= The document diagnostic request definition. @since 3.17.0 Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_diagnostic.ex#L23 "View Source") ``` @type result() :: [GenLSP.TypeAlias.DocumentDiagnosticReport.t](GenLSP.TypeAlias.DocumentDiagnosticReport.html#t:t/0)() ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_diagnostic.ex#L16 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentDiagnostic{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.DocumentDiagnosticParams.t](GenLSP.Structures.DocumentDiagnosticParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentDocumentColor β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_document_color.ex#L2 "View Source") GenLSP.Requests.TextDocumentDocumentColor (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================== A request to list all color symbols found in a given text document. The request's parameter is of type {@link DocumentColorParams} the response is of type {@link ColorInformation ColorInformation[]} or a Thenable that resolves to such. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_document_color.ex#L24 "View Source") ``` @type result() :: [[GenLSP.Structures.ColorInformation.t](GenLSP.Structures.ColorInformation.html#t:t/0)()] ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_document_color.ex#L17 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentDocumentColor{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.DocumentColorParams.t](GenLSP.Structures.DocumentColorParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentDocumentHighlight β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_document_highlight.ex#L2 "View Source") GenLSP.Requests.TextDocumentDocumentHighlight (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================ Request to resolve a {@link DocumentHighlight} for a given text document position. The request's parameter is of type [TextDocumentPosition] (#TextDocumentPosition) the request response is of type [DocumentHighlight[]] (#DocumentHighlight) or a Thenable that resolves to such. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_document_highlight.ex#L24 "View Source") ``` @type result() :: [[GenLSP.Structures.DocumentHighlight.t](GenLSP.Structures.DocumentHighlight.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_document_highlight.ex#L17 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentDocumentHighlight{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.DocumentHighlightParams.t](GenLSP.Structures.DocumentHighlightParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentDocumentLink β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_document_link.ex#L2 "View Source") GenLSP.Requests.TextDocumentDocumentLink (gen\_lsp v0.6.0) ====================================================================================================================================================================================================================== A request to provide document links Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_document_link.ex#L21 "View Source") ``` @type result() :: [[GenLSP.Structures.DocumentLink.t](GenLSP.Structures.DocumentLink.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_document_link.ex#L14 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentDocumentLink{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.DocumentLinkParams.t](GenLSP.Structures.DocumentLinkParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentDocumentSymbol β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_document_symbol.ex#L2 "View Source") GenLSP.Requests.TextDocumentDocumentSymbol (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================== A request to list all symbols found in a given text document. The request's parameter is of type {@link TextDocumentIdentifier} the response is of type {@link SymbolInformation SymbolInformation[]} or a Thenable that resolves to such. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_document_symbol.ex#L24 "View Source") ``` @type result() :: [[GenLSP.Structures.SymbolInformation.t](GenLSP.Structures.SymbolInformation.html#t:t/0)()] | [[GenLSP.Structures.DocumentSymbol.t](GenLSP.Structures.DocumentSymbol.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_document_symbol.ex#L17 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentDocumentSymbol{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.DocumentSymbolParams.t](GenLSP.Structures.DocumentSymbolParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentFoldingRange β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_folding_range.ex#L2 "View Source") GenLSP.Requests.TextDocumentFoldingRange (gen\_lsp v0.6.0) ====================================================================================================================================================================================================================== A request to provide folding ranges in a document. The request's parameter is of type {@link FoldingRangeParams}, the response is of type {@link FoldingRangeList} or a Thenable that resolves to such. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_folding_range.ex#L24 "View Source") ``` @type result() :: [[GenLSP.Structures.FoldingRange.t](GenLSP.Structures.FoldingRange.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_folding_range.ex#L17 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentFoldingRange{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.FoldingRangeParams.t](GenLSP.Structures.FoldingRangeParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentFormatting β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_formatting.ex#L2 "View Source") GenLSP.Requests.TextDocumentFormatting (gen\_lsp v0.6.0) ================================================================================================================================================================================================================= A request to format a whole document. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_formatting.ex#L21 "View Source") ``` @type result() :: [[GenLSP.Structures.TextEdit.t](GenLSP.Structures.TextEdit.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_formatting.ex#L14 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentFormatting{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.DocumentFormattingParams.t](GenLSP.Structures.DocumentFormattingParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentHover β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_hover.ex#L2 "View Source") GenLSP.Requests.TextDocumentHover (gen\_lsp v0.6.0) ======================================================================================================================================================================================================= Request to request hover information at a given text document position. The request's parameter is of type {@link TextDocumentPosition} the response is of type {@link Hover} or a Thenable that resolves to such. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_hover.ex#L23 "View Source") ``` @type result() :: [GenLSP.Structures.Hover.t](GenLSP.Structures.Hover.html#t:t/0)() | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_hover.ex#L16 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentHover{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.HoverParams.t](GenLSP.Structures.HoverParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentImplementation β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_implementation.ex#L2 "View Source") GenLSP.Requests.TextDocumentImplementation (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================= A request to resolve the implementation locations of a symbol at a given text document position. The request's parameter is of type [TextDocumentPositionParams] (#TextDocumentPositionParams) the response is of type {@link Definition} or a Thenable that resolves to such. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_implementation.ex#L24 "View Source") ``` @type result() :: [GenLSP.TypeAlias.Definition.t](GenLSP.TypeAlias.Definition.html#t:t/0)() | [[GenLSP.TypeAlias.DefinitionLink.t](GenLSP.TypeAlias.DefinitionLink.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_implementation.ex#L17 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentImplementation{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.ImplementationParams.t](GenLSP.Structures.ImplementationParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentInlayHint β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_inlay_hint.ex#L2 "View Source") GenLSP.Requests.TextDocumentInlayHint (gen\_lsp v0.6.0) ================================================================================================================================================================================================================ A request to provide inlay hints in a document. The request's parameter is of type {@link InlayHintsParams}, the response is of type {@link InlayHint InlayHint[]} or a Thenable that resolves to such. @since 3.17.0 Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_inlay_hint.ex#L25 "View Source") ``` @type result() :: [[GenLSP.Structures.InlayHint.t](GenLSP.Structures.InlayHint.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_inlay_hint.ex#L18 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentInlayHint{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.InlayHintParams.t](GenLSP.Structures.InlayHintParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentInlineValue β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_inline_value.ex#L2 "View Source") GenLSP.Requests.TextDocumentInlineValue (gen\_lsp v0.6.0) ==================================================================================================================================================================================================================== A request to provide inline values in a document. The request's parameter is of type {@link InlineValueParams}, the response is of type {@link InlineValue InlineValue[]} or a Thenable that resolves to such. @since 3.17.0 Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_inline_value.ex#L25 "View Source") ``` @type result() :: [[GenLSP.TypeAlias.InlineValue.t](GenLSP.TypeAlias.InlineValue.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_inline_value.ex#L18 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentInlineValue{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.InlineValueParams.t](GenLSP.Structures.InlineValueParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentLinkedEditingRange β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_linked_editing_range.ex#L2 "View Source") GenLSP.Requests.TextDocumentLinkedEditingRange (gen\_lsp v0.6.0) =================================================================================================================================================================================================================================== A request to provide ranges that can be edited together. @since 3.16.0 Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_linked_editing_range.ex#L23 "View Source") ``` @type result() :: [GenLSP.Structures.LinkedEditingRanges.t](GenLSP.Structures.LinkedEditingRanges.html#t:t/0)() | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_linked_editing_range.ex#L16 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentLinkedEditingRange{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.LinkedEditingRangeParams.t](GenLSP.Structures.LinkedEditingRangeParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentMoniker β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_moniker.ex#L2 "View Source") GenLSP.Requests.TextDocumentMoniker (gen\_lsp v0.6.0) =========================================================================================================================================================================================================== A request to get the moniker of a symbol at a given text document position. The request parameter is of type {@link TextDocumentPositionParams}. The response is of type {@link Moniker Moniker[]} or `null`. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_moniker.ex#L23 "View Source") ``` @type result() :: [[GenLSP.Structures.Moniker.t](GenLSP.Structures.Moniker.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_moniker.ex#L16 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentMoniker{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.MonikerParams.t](GenLSP.Structures.MonikerParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentOnTypeFormatting β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_on_type_formatting.ex#L2 "View Source") GenLSP.Requests.TextDocumentOnTypeFormatting (gen\_lsp v0.6.0) =============================================================================================================================================================================================================================== A request to format a document on type. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_on_type_formatting.ex#L21 "View Source") ``` @type result() :: [[GenLSP.Structures.TextEdit.t](GenLSP.Structures.TextEdit.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_on_type_formatting.ex#L14 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentOnTypeFormatting{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.DocumentOnTypeFormattingParams.t](GenLSP.Structures.DocumentOnTypeFormattingParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentPrepareCallHierarchy β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_prepare_call_hierarchy.ex#L2 "View Source") GenLSP.Requests.TextDocumentPrepareCallHierarchy (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================================= A request to result a `CallHierarchyItem` in a document at a given position. Can be used as an input to an incoming or outgoing call hierarchy. @since 3.16.0 Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_prepare_call_hierarchy.ex#L24 "View Source") ``` @type result() :: [[GenLSP.Structures.CallHierarchyItem.t](GenLSP.Structures.CallHierarchyItem.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_prepare_call_hierarchy.ex#L17 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentPrepareCallHierarchy{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.CallHierarchyPrepareParams.t](GenLSP.Structures.CallHierarchyPrepareParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentPrepareRename β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_prepare_rename.ex#L2 "View Source") GenLSP.Requests.TextDocumentPrepareRename (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================== A request to test and perform the setup necessary for a rename. @since 3.16 - support for default behavior Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_prepare_rename.ex#L23 "View Source") ``` @type result() :: [GenLSP.TypeAlias.PrepareRenameResult.t](GenLSP.TypeAlias.PrepareRenameResult.html#t:t/0)() | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_prepare_rename.ex#L16 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentPrepareRename{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.PrepareRenameParams.t](GenLSP.Structures.PrepareRenameParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentPrepareTypeHierarchy β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_prepare_type_hierarchy.ex#L2 "View Source") GenLSP.Requests.TextDocumentPrepareTypeHierarchy (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================================= A request to result a `TypeHierarchyItem` in a document at a given position. Can be used as an input to a subtypes or supertypes type hierarchy. @since 3.17.0 Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_prepare_type_hierarchy.ex#L24 "View Source") ``` @type result() :: [[GenLSP.Structures.TypeHierarchyItem.t](GenLSP.Structures.TypeHierarchyItem.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_prepare_type_hierarchy.ex#L17 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentPrepareTypeHierarchy{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.TypeHierarchyPrepareParams.t](GenLSP.Structures.TypeHierarchyPrepareParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentRangeFormatting β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_range_formatting.ex#L2 "View Source") GenLSP.Requests.TextDocumentRangeFormatting (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================ A request to format a range in a document. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_range_formatting.ex#L21 "View Source") ``` @type result() :: [[GenLSP.Structures.TextEdit.t](GenLSP.Structures.TextEdit.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_range_formatting.ex#L14 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentRangeFormatting{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.DocumentRangeFormattingParams.t](GenLSP.Structures.DocumentRangeFormattingParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentReferences β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_references.ex#L2 "View Source") GenLSP.Requests.TextDocumentReferences (gen\_lsp v0.6.0) ================================================================================================================================================================================================================= A request to resolve project-wide references for the symbol denoted by the given text document position. The request's parameter is of type {@link ReferenceParams} the response is of type {@link Location Location[]} or a Thenable that resolves to such. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_references.ex#L24 "View Source") ``` @type result() :: [[GenLSP.Structures.Location.t](GenLSP.Structures.Location.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_references.ex#L17 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentReferences{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.ReferenceParams.t](GenLSP.Structures.ReferenceParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentRename β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_rename.ex#L2 "View Source") GenLSP.Requests.TextDocumentRename (gen\_lsp v0.6.0) ========================================================================================================================================================================================================= A request to rename a symbol. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_rename.ex#L21 "View Source") ``` @type result() :: [GenLSP.Structures.WorkspaceEdit.t](GenLSP.Structures.WorkspaceEdit.html#t:t/0)() | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_rename.ex#L14 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentRename{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.RenameParams.t](GenLSP.Structures.RenameParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentSelectionRange β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_selection_range.ex#L2 "View Source") GenLSP.Requests.TextDocumentSelectionRange (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================== A request to provide selection ranges in a document. The request's parameter is of type {@link SelectionRangeParams}, the response is of type {@link SelectionRange SelectionRange[]} or a Thenable that resolves to such. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_selection_range.ex#L24 "View Source") ``` @type result() :: [[GenLSP.Structures.SelectionRange.t](GenLSP.Structures.SelectionRange.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_selection_range.ex#L17 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentSelectionRange{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.SelectionRangeParams.t](GenLSP.Structures.SelectionRangeParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentSemanticTokensFull β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_semantic_tokens_full.ex#L2 "View Source") GenLSP.Requests.TextDocumentSemanticTokensFull (gen\_lsp v0.6.0) =================================================================================================================================================================================================================================== @since 3.16.0 Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_semantic_tokens_full.ex#L21 "View Source") ``` @type result() :: [GenLSP.Structures.SemanticTokens.t](GenLSP.Structures.SemanticTokens.html#t:t/0)() | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_semantic_tokens_full.ex#L14 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentSemanticTokensFull{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.SemanticTokensParams.t](GenLSP.Structures.SemanticTokensParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentSemanticTokensFullDelta β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_semantic_tokens_full_delta.ex#L2 "View Source") GenLSP.Requests.TextDocumentSemanticTokensFullDelta (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================================== @since 3.16.0 Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_semantic_tokens_full_delta.ex#L21 "View Source") ``` @type result() :: [GenLSP.Structures.SemanticTokens.t](GenLSP.Structures.SemanticTokens.html#t:t/0)() | [GenLSP.Structures.SemanticTokensDelta.t](GenLSP.Structures.SemanticTokensDelta.html#t:t/0)() | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_semantic_tokens_full_delta.ex#L14 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentSemanticTokensFullDelta{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.SemanticTokensDeltaParams.t](GenLSP.Structures.SemanticTokensDeltaParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentSemanticTokensRange β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_semantic_tokens_range.ex#L2 "View Source") GenLSP.Requests.TextDocumentSemanticTokensRange (gen\_lsp v0.6.0) ===================================================================================================================================================================================================================================== @since 3.16.0 Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_semantic_tokens_range.ex#L21 "View Source") ``` @type result() :: [GenLSP.Structures.SemanticTokens.t](GenLSP.Structures.SemanticTokens.html#t:t/0)() | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_semantic_tokens_range.ex#L14 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentSemanticTokensRange{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.SemanticTokensRangeParams.t](GenLSP.Structures.SemanticTokensRangeParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentSignatureHelp β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_signature_help.ex#L2 "View Source") GenLSP.Requests.TextDocumentSignatureHelp (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_signature_help.ex#L15 "View Source") ``` @type result() :: [GenLSP.Structures.SignatureHelp.t](GenLSP.Structures.SignatureHelp.html#t:t/0)() | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_signature_help.ex#L8 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentSignatureHelp{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.SignatureHelpParams.t](GenLSP.Structures.SignatureHelpParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentTypeDefinition β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_type_definition.ex#L2 "View Source") GenLSP.Requests.TextDocumentTypeDefinition (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================== A request to resolve the type definition locations of a symbol at a given text document position. The request's parameter is of type [TextDocumentPositionParams] (#TextDocumentPositionParams) the response is of type {@link Definition} or a Thenable that resolves to such. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_type_definition.ex#L24 "View Source") ``` @type result() :: [GenLSP.TypeAlias.Definition.t](GenLSP.TypeAlias.Definition.html#t:t/0)() | [[GenLSP.TypeAlias.DefinitionLink.t](GenLSP.TypeAlias.DefinitionLink.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_type_definition.ex#L17 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentTypeDefinition{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.TypeDefinitionParams.t](GenLSP.Structures.TypeDefinitionParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TextDocumentWillSaveWaitUntil β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_will_save_wait_until.ex#L2 "View Source") GenLSP.Requests.TextDocumentWillSaveWaitUntil (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================== A document will save request is sent from the client to the server before the document is actually saved. The request can return an array of TextEdits which will be applied to the text document before it is saved. Please note that clients might drop results if computing the text edits took too long or if a server constantly fails on this request. This is done to keep the save fast and reliable. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_will_save_wait_until.ex#L26 "View Source") ``` @type result() :: [[GenLSP.Structures.TextEdit.t](GenLSP.Structures.TextEdit.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/text_document_will_save_wait_until.ex#L19 "View Source") ``` @type t() :: %GenLSP.Requests.TextDocumentWillSaveWaitUntil{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.WillSaveTextDocumentParams.t](GenLSP.Structures.WillSaveTextDocumentParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TypeHierarchySubtypes β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/type_hierarchy_subtypes.ex#L2 "View Source") GenLSP.Requests.TypeHierarchySubtypes (gen\_lsp v0.6.0) =============================================================================================================================================================================================================== A request to resolve the subtypes for a given `TypeHierarchyItem`. @since 3.17.0 Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/type_hierarchy_subtypes.ex#L23 "View Source") ``` @type result() :: [[GenLSP.Structures.TypeHierarchyItem.t](GenLSP.Structures.TypeHierarchyItem.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/type_hierarchy_subtypes.ex#L16 "View Source") ``` @type t() :: %GenLSP.Requests.TypeHierarchySubtypes{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.TypeHierarchySubtypesParams.t](GenLSP.Structures.TypeHierarchySubtypesParams.html#t:t/0)() | nil } ``` GenLSP.Requests.TypeHierarchySupertypes β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/type_hierarchy_supertypes.ex#L2 "View Source") GenLSP.Requests.TypeHierarchySupertypes (gen\_lsp v0.6.0) =================================================================================================================================================================================================================== A request to resolve the supertypes for a given `TypeHierarchyItem`. @since 3.17.0 Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/type_hierarchy_supertypes.ex#L23 "View Source") ``` @type result() :: [[GenLSP.Structures.TypeHierarchyItem.t](GenLSP.Structures.TypeHierarchyItem.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/type_hierarchy_supertypes.ex#L16 "View Source") ``` @type t() :: %GenLSP.Requests.TypeHierarchySupertypes{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.TypeHierarchySupertypesParams.t](GenLSP.Structures.TypeHierarchySupertypesParams.html#t:t/0)() | nil } ``` GenLSP.Requests.WindowShowDocument β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/window_show_document.ex#L2 "View Source") GenLSP.Requests.WindowShowDocument (gen\_lsp v0.6.0) ========================================================================================================================================================================================================= A request to show a document. This request might open an external program depending on the value of the URI to open. For example a request to open `https://code.visualstudio.com/` will very likely open the URI in a WEB browser. @since 3.16.0 Message Direction: serverToClient [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/window_show_document.ex#L26 "View Source") ``` @type result() :: [GenLSP.Structures.ShowDocumentResult.t](GenLSP.Structures.ShowDocumentResult.html#t:t/0)() ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/window_show_document.ex#L19 "View Source") ``` @type t() :: %GenLSP.Requests.WindowShowDocument{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.ShowDocumentParams.t](GenLSP.Structures.ShowDocumentParams.html#t:t/0)() | nil } ``` GenLSP.Requests.WindowShowMessageRequest β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/window_show_message_request.ex#L2 "View Source") GenLSP.Requests.WindowShowMessageRequest (gen\_lsp v0.6.0) ====================================================================================================================================================================================================================== The show message request is sent from the server to the client to show a message and a set of options actions to the user. Message Direction: serverToClient [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/window_show_message_request.ex#L22 "View Source") ``` @type result() :: [GenLSP.Structures.MessageActionItem.t](GenLSP.Structures.MessageActionItem.html#t:t/0)() | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/window_show_message_request.ex#L15 "View Source") ``` @type t() :: %GenLSP.Requests.WindowShowMessageRequest{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.ShowMessageRequestParams.t](GenLSP.Structures.ShowMessageRequestParams.html#t:t/0)() | nil } ``` GenLSP.Requests.WindowWorkDoneProgressCreate β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/window_work_done_progress_create.ex#L2 "View Source") GenLSP.Requests.WindowWorkDoneProgressCreate (gen\_lsp v0.6.0) =============================================================================================================================================================================================================================== The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress reporting from the server. Message Direction: serverToClient [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/window_work_done_progress_create.ex#L22 "View Source") ``` @type result() :: nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/window_work_done_progress_create.ex#L15 "View Source") ``` @type t() :: %GenLSP.Requests.WindowWorkDoneProgressCreate{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.WorkDoneProgressCreateParams.t](GenLSP.Structures.WorkDoneProgressCreateParams.html#t:t/0)() | nil } ``` GenLSP.Requests.WorkspaceApplyEdit β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_apply_edit.ex#L2 "View Source") GenLSP.Requests.WorkspaceApplyEdit (gen\_lsp v0.6.0) ========================================================================================================================================================================================================= A request sent from the server to the client to modified certain resources. Message Direction: serverToClient [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_apply_edit.ex#L21 "View Source") ``` @type result() :: [GenLSP.Structures.ApplyWorkspaceEditResult.t](GenLSP.Structures.ApplyWorkspaceEditResult.html#t:t/0)() ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_apply_edit.ex#L14 "View Source") ``` @type t() :: %GenLSP.Requests.WorkspaceApplyEdit{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.ApplyWorkspaceEditParams.t](GenLSP.Structures.ApplyWorkspaceEditParams.html#t:t/0)() | nil } ``` GenLSP.Requests.WorkspaceCodeLensRefresh β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_code_lens_refresh.ex#L2 "View Source") GenLSP.Requests.WorkspaceCodeLensRefresh (gen\_lsp v0.6.0) ====================================================================================================================================================================================================================== A request to refresh all code actions @since 3.16.0 Message Direction: serverToClient [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_code_lens_refresh.ex#L22 "View Source") ``` @type result() :: nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_code_lens_refresh.ex#L16 "View Source") ``` @type t() :: %GenLSP.Requests.WorkspaceCodeLensRefresh{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() } ``` GenLSP.Requests.WorkspaceConfiguration β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_configuration.ex#L2 "View Source") GenLSP.Requests.WorkspaceConfiguration (gen\_lsp v0.6.0) ================================================================================================================================================================================================================ The 'workspace/configuration' request is sent from the server to the client to fetch a certain configuration setting. This pull model replaces the old push model were the client signaled configuration change via an event. If the server still needs to react to configuration changes (since the server caches the result of `workspace/configuration` requests) the server should register for an empty configuration change event and empty the cache if such an event is received. Message Direction: serverToClient [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_configuration.ex#L27 "View Source") ``` @type result() :: [[GenLSP.TypeAlias.LSPAny.t](GenLSP.TypeAlias.LSPAny.html#t:t/0)()] ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_configuration.ex#L20 "View Source") ``` @type t() :: %GenLSP.Requests.WorkspaceConfiguration{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.ConfigurationParams.t](GenLSP.Structures.ConfigurationParams.html#t:t/0)() | nil } ``` GenLSP.Requests.WorkspaceDiagnostic β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_diagnostic.ex#L2 "View Source") GenLSP.Requests.WorkspaceDiagnostic (gen\_lsp v0.6.0) ========================================================================================================================================================================================================== The workspace diagnostic request definition. @since 3.17.0 Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_diagnostic.ex#L23 "View Source") ``` @type result() :: [GenLSP.Structures.WorkspaceDiagnosticReport.t](GenLSP.Structures.WorkspaceDiagnosticReport.html#t:t/0)() ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_diagnostic.ex#L16 "View Source") ``` @type t() :: %GenLSP.Requests.WorkspaceDiagnostic{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.WorkspaceDiagnosticParams.t](GenLSP.Structures.WorkspaceDiagnosticParams.html#t:t/0)() | nil } ``` GenLSP.Requests.WorkspaceDiagnosticRefresh β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_diagnostic_refresh.ex#L2 "View Source") GenLSP.Requests.WorkspaceDiagnosticRefresh (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================= The diagnostic refresh request definition. @since 3.17.0 Message Direction: serverToClient [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_diagnostic_refresh.ex#L22 "View Source") ``` @type result() :: nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_diagnostic_refresh.ex#L16 "View Source") ``` @type t() :: %GenLSP.Requests.WorkspaceDiagnosticRefresh{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() } ``` GenLSP.Requests.WorkspaceExecuteCommand β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_execute_command.ex#L2 "View Source") GenLSP.Requests.WorkspaceExecuteCommand (gen\_lsp v0.6.0) =================================================================================================================================================================================================================== A request send from the client to the server to execute a command. The request might return a workspace edit which the client will apply to the workspace. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_execute_command.ex#L22 "View Source") ``` @type result() :: [GenLSP.TypeAlias.LSPAny.t](GenLSP.TypeAlias.LSPAny.html#t:t/0)() | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_execute_command.ex#L15 "View Source") ``` @type t() :: %GenLSP.Requests.WorkspaceExecuteCommand{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.ExecuteCommandParams.t](GenLSP.Structures.ExecuteCommandParams.html#t:t/0)() | nil } ``` GenLSP.Requests.WorkspaceInlayHintRefresh β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_inlay_hint_refresh.ex#L2 "View Source") GenLSP.Requests.WorkspaceInlayHintRefresh (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================== @since 3.17.0 Message Direction: serverToClient [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_inlay_hint_refresh.ex#L20 "View Source") ``` @type result() :: nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_inlay_hint_refresh.ex#L14 "View Source") ``` @type t() :: %GenLSP.Requests.WorkspaceInlayHintRefresh{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() } ``` GenLSP.Requests.WorkspaceInlineValueRefresh β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_inline_value_refresh.ex#L2 "View Source") GenLSP.Requests.WorkspaceInlineValueRefresh (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================ @since 3.17.0 Message Direction: serverToClient [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_inline_value_refresh.ex#L20 "View Source") ``` @type result() :: nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_inline_value_refresh.ex#L14 "View Source") ``` @type t() :: %GenLSP.Requests.WorkspaceInlineValueRefresh{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() } ``` GenLSP.Requests.WorkspaceSemanticTokensRefresh β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_semantic_tokens_refresh.ex#L2 "View Source") GenLSP.Requests.WorkspaceSemanticTokensRefresh (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================== @since 3.16.0 Message Direction: serverToClient [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_semantic_tokens_refresh.ex#L20 "View Source") ``` @type result() :: nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_semantic_tokens_refresh.ex#L14 "View Source") ``` @type t() :: %GenLSP.Requests.WorkspaceSemanticTokensRefresh{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() } ``` GenLSP.Requests.WorkspaceSymbol β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_symbol.ex#L2 "View Source") GenLSP.Requests.WorkspaceSymbol (gen\_lsp v0.6.0) ================================================================================================================================================================================================== A request to list project-wide symbols matching the query string given by the {@link WorkspaceSymbolParams}. The response is of type {@link SymbolInformation SymbolInformation[]} or a Thenable that resolves to such. @since 3.17.0 - support for WorkspaceSymbol in the returned data. Clients need to advertise support for WorkspaceSymbols via the client capability `workspace.symbol.resolveSupport`. Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_symbol.ex#L29 "View Source") ``` @type result() :: [[GenLSP.Structures.SymbolInformation.t](GenLSP.Structures.SymbolInformation.html#t:t/0)()] | [[GenLSP.Structures.WorkspaceSymbol.t](GenLSP.Structures.WorkspaceSymbol.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_symbol.ex#L22 "View Source") ``` @type t() :: %GenLSP.Requests.WorkspaceSymbol{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.WorkspaceSymbolParams.t](GenLSP.Structures.WorkspaceSymbolParams.html#t:t/0)() | nil } ``` GenLSP.Requests.WorkspaceSymbolResolve β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_symbol_resolve.ex#L2 "View Source") GenLSP.Requests.WorkspaceSymbolResolve (gen\_lsp v0.6.0) ================================================================================================================================================================================================================= A request to resolve the range inside the workspace symbol's location. @since 3.17.0 Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_symbol_resolve.ex#L24 "View Source") ``` @type result() :: [GenLSP.Structures.WorkspaceSymbol.t](GenLSP.Structures.WorkspaceSymbol.html#t:t/0)() ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_symbol_resolve.ex#L17 "View Source") ``` @type t() :: %GenLSP.Requests.WorkspaceSymbolResolve{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.WorkspaceSymbol.t](GenLSP.Structures.WorkspaceSymbol.html#t:t/0)() | nil } ``` GenLSP.Requests.WorkspaceWillCreateFiles β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_will_create_files.ex#L2 "View Source") GenLSP.Requests.WorkspaceWillCreateFiles (gen\_lsp v0.6.0) ====================================================================================================================================================================================================================== The will create files request is sent from the client to the server before files are actually created as long as the creation is triggered from within the client. @since 3.16.0 Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_will_create_files.ex#L24 "View Source") ``` @type result() :: [GenLSP.Structures.WorkspaceEdit.t](GenLSP.Structures.WorkspaceEdit.html#t:t/0)() | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_will_create_files.ex#L17 "View Source") ``` @type t() :: %GenLSP.Requests.WorkspaceWillCreateFiles{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.CreateFilesParams.t](GenLSP.Structures.CreateFilesParams.html#t:t/0)() | nil } ``` GenLSP.Requests.WorkspaceWillDeleteFiles β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_will_delete_files.ex#L2 "View Source") GenLSP.Requests.WorkspaceWillDeleteFiles (gen\_lsp v0.6.0) ====================================================================================================================================================================================================================== The did delete files notification is sent from the client to the server when files were deleted from within the client. @since 3.16.0 Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_will_delete_files.ex#L24 "View Source") ``` @type result() :: [GenLSP.Structures.WorkspaceEdit.t](GenLSP.Structures.WorkspaceEdit.html#t:t/0)() | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_will_delete_files.ex#L17 "View Source") ``` @type t() :: %GenLSP.Requests.WorkspaceWillDeleteFiles{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.DeleteFilesParams.t](GenLSP.Structures.DeleteFilesParams.html#t:t/0)() | nil } ``` GenLSP.Requests.WorkspaceWillRenameFiles β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_will_rename_files.ex#L2 "View Source") GenLSP.Requests.WorkspaceWillRenameFiles (gen\_lsp v0.6.0) ====================================================================================================================================================================================================================== The will rename files request is sent from the client to the server before files are actually renamed as long as the rename is triggered from within the client. @since 3.16.0 Message Direction: clientToServer [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_will_rename_files.ex#L24 "View Source") ``` @type result() :: [GenLSP.Structures.WorkspaceEdit.t](GenLSP.Structures.WorkspaceEdit.html#t:t/0)() | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_will_rename_files.ex#L17 "View Source") ``` @type t() :: %GenLSP.Requests.WorkspaceWillRenameFiles{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), params: [GenLSP.Structures.RenameFilesParams.t](GenLSP.Structures.RenameFilesParams.html#t:t/0)() | nil } ``` GenLSP.Requests.WorkspaceWorkspaceFolders β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_workspace_folders.ex#L2 "View Source") GenLSP.Requests.WorkspaceWorkspaceFolders (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================= The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders. Message Direction: serverToClient [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [result()](#t:result/0) [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:result/0 "Link to this type") result() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_workspace_folders.ex#L20 "View Source") ``` @type result() :: [[GenLSP.Structures.WorkspaceFolder.t](GenLSP.Structures.WorkspaceFolder.html#t:t/0)()] | nil ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/requests/workspace_workspace_folders.ex#L14 "View Source") ``` @type t() :: %GenLSP.Requests.WorkspaceWorkspaceFolders{ id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), jsonrpc: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() } ``` GenLSP.Structures.AnnotatedTextEdit β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/annotated_text_edit.ex#L2 "View Source") GenLSP.Structures.AnnotatedTextEdit (gen\_lsp v0.6.0) =========================================================================================================================================================================================================== A special text edit with an additional change annotation. @since 3.16.0. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.AnnotatedTextEdit{}](#__struct__/0) Fields ------ * annotation\_id: The actual identifier of the change annotation * range: The range of the text document to be manipulated. To insert text into a document create a range where start === end. * new\_text: The string to be inserted. For delete operations use an empty string. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/annotated_text_edit.ex#L23 "View Source") ``` @type t() :: %GenLSP.Structures.AnnotatedTextEdit{ annotation_id: [GenLSP.TypeAlias.ChangeAnnotationIdentifier.t](GenLSP.TypeAlias.ChangeAnnotationIdentifier.html#t:t/0)(), new_text: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.AnnotatedTextEdit{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/annotated_text_edit.ex#L23 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * annotation\_id: The actual identifier of the change annotation * range: The range of the text document to be manipulated. To insert text into a document create a range where start === end. * new\_text: The string to be inserted. For delete operations use an empty string. GenLSP.Structures.ApplyWorkspaceEditParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/apply_workspace_edit_params.ex#L2 "View Source") GenLSP.Structures.ApplyWorkspaceEditParams (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================== The parameters passed via an apply workspace edit request. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ApplyWorkspaceEditParams{}](#__struct__/0) Fields ------ * label: An optional label of the workspace edit. This label is presented in the user interface for example on an undo stack to undo the workspace edit. * edit: The edits to apply. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/apply_workspace_edit_params.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.ApplyWorkspaceEditParams{ edit: [GenLSP.Structures.WorkspaceEdit.t](GenLSP.Structures.WorkspaceEdit.html#t:t/0)(), label: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ApplyWorkspaceEditParams{} ============================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/apply_workspace_edit_params.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * label: An optional label of the workspace edit. This label is presented in the user interface for example on an undo stack to undo the workspace edit. * edit: The edits to apply. GenLSP.Structures.ApplyWorkspaceEditResult β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/apply_workspace_edit_result.ex#L2 "View Source") GenLSP.Structures.ApplyWorkspaceEditResult (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================== The result returned from the apply workspace edit request. @since 3.17 renamed from ApplyWorkspaceEditResponse [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ApplyWorkspaceEditResult{}](#__struct__/0) Fields ------ * applied: Indicates whether the edit was applied or not. * failure\_reason: An optional textual description for why the edit was not applied. This may be used by the server for diagnostic logging or to provide a suitable error for a request that triggered the edit. * failed\_change: Depending on the client's failure handling strategy `failedChange` might contain the index of the change that failed. This property is only available if the client signals a `failureHandlingStrategy` in its client capabilities. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/apply_workspace_edit_result.ex#L25 "View Source") ``` @type t() :: %GenLSP.Structures.ApplyWorkspaceEditResult{ applied: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), failed_change: [GenLSP.BaseTypes.uinteger](GenLSP.BaseTypes.html#t:uinteger/0)() | nil, failure_reason: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ApplyWorkspaceEditResult{} ============================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/apply_workspace_edit_result.ex#L25 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * applied: Indicates whether the edit was applied or not. * failure\_reason: An optional textual description for why the edit was not applied. This may be used by the server for diagnostic logging or to provide a suitable error for a request that triggered the edit. * failed\_change: Depending on the client's failure handling strategy `failedChange` might contain the index of the change that failed. This property is only available if the client signals a `failureHandlingStrategy` in its client capabilities. GenLSP.Structures.BaseSymbolInformation β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/base_symbol_information.ex#L2 "View Source") GenLSP.Structures.BaseSymbolInformation (gen\_lsp v0.6.0) =================================================================================================================================================================================================================== A base for all symbol information. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.BaseSymbolInformation{}](#__struct__/0) Fields ------ * name: The name of this symbol. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/base_symbol_information.ex#L25 "View Source") ``` @type t() :: %GenLSP.Structures.BaseSymbolInformation{ container_name: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, kind: [GenLSP.Enumerations.SymbolKind.t](GenLSP.Enumerations.SymbolKind.html#t:t/0)(), name: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), tags: [[GenLSP.Enumerations.SymbolTag.t](GenLSP.Enumerations.SymbolTag.html#t:t/0)()] | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.BaseSymbolInformation{} ========================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/base_symbol_information.ex#L25 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * name: The name of this symbol. * kind: The kind of this symbol. * tags: Tags for this symbol. @since 3.16.0 * container\_name: The name of the symbol containing this symbol. This information is for user interface purposes (e.g. to render a qualifier in the user interface if necessary). It can't be used to re-infer a hierarchy for the document symbols. GenLSP.Structures.CallHierarchyClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_client_capabilities.ex#L2 "View Source") GenLSP.Structures.CallHierarchyClientCapabilities (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================================== @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CallHierarchyClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether implementation supports dynamic registration. If this is set to `true` the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` return value for the corresponding server capability as well. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_client_capabilities.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.CallHierarchyClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CallHierarchyClientCapabilities{} ==================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_client_capabilities.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether implementation supports dynamic registration. If this is set to `true` the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` return value for the corresponding server capability as well. GenLSP.Structures.CallHierarchyIncomingCall β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_incoming_call.ex#L2 "View Source") GenLSP.Structures.CallHierarchyIncomingCall (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================ Represents an incoming call, e.g. a caller of a method or constructor. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CallHierarchyIncomingCall{}](#__struct__/0) Fields ------ * from: The item that makes the call. * from\_ranges: The ranges at which the calls appear. This is relative to the caller denoted by {@link CallHierarchyIncomingCall.from `this.from`}. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_incoming_call.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.CallHierarchyIncomingCall{ from: [GenLSP.Structures.CallHierarchyItem.t](GenLSP.Structures.CallHierarchyItem.html#t:t/0)(), from_ranges: [[GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)()] } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CallHierarchyIncomingCall{} ============================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_incoming_call.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * from: The item that makes the call. * from\_ranges: The ranges at which the calls appear. This is relative to the caller denoted by {@link CallHierarchyIncomingCall.from `this.from`}. GenLSP.Structures.CallHierarchyIncomingCallsParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_incoming_calls_params.ex#L2 "View Source") GenLSP.Structures.CallHierarchyIncomingCallsParams (gen\_lsp v0.6.0) =========================================================================================================================================================================================================================================== The parameter of a `callHierarchy/incomingCalls` request. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CallHierarchyIncomingCallsParams{}](#__struct__/0) Fields ------ * item * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_incoming_calls_params.ex#L22 "View Source") ``` @type t() :: %GenLSP.Structures.CallHierarchyIncomingCallsParams{ item: [GenLSP.Structures.CallHierarchyItem.t](GenLSP.Structures.CallHierarchyItem.html#t:t/0)(), partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CallHierarchyIncomingCallsParams{} ===================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_incoming_calls_params.ex#L22 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * item * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. GenLSP.Structures.CallHierarchyItem β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_item.ex#L2 "View Source") GenLSP.Structures.CallHierarchyItem (gen\_lsp v0.6.0) =========================================================================================================================================================================================================== Represents programming constructs like functions or constructors in the context of call hierarchy. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CallHierarchyItem{}](#__struct__/0) Fields ------ * name: The name of this item. * kind: The kind of this item. * tags: Tags for this item. * detail: More detail for this item, e.g. the signature of a function. * uri: The resource identifier of this item. * range: The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code. * selection\_range: The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function. Must be contained by the {@link CallHierarchyItem.range `range`}. * data: A data entry field that is preserved between a call hierarchy prepare and incoming calls or outgoing calls requests. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_item.ex#L29 "View Source") ``` @type t() :: %GenLSP.Structures.CallHierarchyItem{ data: [GenLSP.TypeAlias.LSPAny.t](GenLSP.TypeAlias.LSPAny.html#t:t/0)() | nil, detail: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, kind: [GenLSP.Enumerations.SymbolKind.t](GenLSP.Enumerations.SymbolKind.html#t:t/0)(), name: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)(), selection_range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)(), tags: [[GenLSP.Enumerations.SymbolTag.t](GenLSP.Enumerations.SymbolTag.html#t:t/0)()] | nil, uri: [GenLSP.BaseTypes.document\_uri](GenLSP.BaseTypes.html#t:document_uri/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CallHierarchyItem{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_item.ex#L29 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * name: The name of this item. * kind: The kind of this item. * tags: Tags for this item. * detail: More detail for this item, e.g. the signature of a function. * uri: The resource identifier of this item. * range: The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code. * selection\_range: The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function. Must be contained by the {@link CallHierarchyItem.range `range`}. * data: A data entry field that is preserved between a call hierarchy prepare and incoming calls or outgoing calls requests. GenLSP.Structures.CallHierarchyOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_options.ex#L2 "View Source") GenLSP.Structures.CallHierarchyOptions (gen\_lsp v0.6.0) ================================================================================================================================================================================================================= Call hierarchy options used during static registration. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CallHierarchyOptions{}](#__struct__/0) Fields ------ * work\_done\_progress [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_options.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.CallHierarchyOptions{ work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CallHierarchyOptions{} ========================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_options.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_progress GenLSP.Structures.CallHierarchyOutgoingCall β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_outgoing_call.ex#L2 "View Source") GenLSP.Structures.CallHierarchyOutgoingCall (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================ Represents an outgoing call, e.g. calling a getter from a method or a method from a constructor etc. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CallHierarchyOutgoingCall{}](#__struct__/0) Fields ------ * to: The item that is called. * from\_ranges: The range at which this item is called. This is the range relative to the caller, e.g the item passed to {@link CallHierarchyItemProvider.provideCallHierarchyOutgoingCalls `provideCallHierarchyOutgoingCalls`} and not {@link CallHierarchyOutgoingCall.to `this.to`}. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_outgoing_call.ex#L22 "View Source") ``` @type t() :: %GenLSP.Structures.CallHierarchyOutgoingCall{ from_ranges: [[GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)()], to: [GenLSP.Structures.CallHierarchyItem.t](GenLSP.Structures.CallHierarchyItem.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CallHierarchyOutgoingCall{} ============================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_outgoing_call.ex#L22 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * to: The item that is called. * from\_ranges: The range at which this item is called. This is the range relative to the caller, e.g the item passed to {@link CallHierarchyItemProvider.provideCallHierarchyOutgoingCalls `provideCallHierarchyOutgoingCalls`} and not {@link CallHierarchyOutgoingCall.to `this.to`}. GenLSP.Structures.CallHierarchyOutgoingCallsParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_outgoing_calls_params.ex#L2 "View Source") GenLSP.Structures.CallHierarchyOutgoingCallsParams (gen\_lsp v0.6.0) =========================================================================================================================================================================================================================================== The parameter of a `callHierarchy/outgoingCalls` request. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CallHierarchyOutgoingCallsParams{}](#__struct__/0) Fields ------ * item * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_outgoing_calls_params.ex#L22 "View Source") ``` @type t() :: %GenLSP.Structures.CallHierarchyOutgoingCallsParams{ item: [GenLSP.Structures.CallHierarchyItem.t](GenLSP.Structures.CallHierarchyItem.html#t:t/0)(), partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CallHierarchyOutgoingCallsParams{} ===================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_outgoing_calls_params.ex#L22 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * item * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. GenLSP.Structures.CallHierarchyPrepareParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_prepare_params.ex#L2 "View Source") GenLSP.Structures.CallHierarchyPrepareParams (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================== The parameter of a `textDocument/prepareCallHierarchy` request. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CallHierarchyPrepareParams{}](#__struct__/0) Fields ------ * work\_done\_token: An optional token that a server can use to report work done progress. * text\_document: The text document. * position: The position inside the text document. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_prepare_params.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.CallHierarchyPrepareParams{ position: [GenLSP.Structures.Position.t](GenLSP.Structures.Position.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CallHierarchyPrepareParams{} =============================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_prepare_params.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_token: An optional token that a server can use to report work done progress. * text\_document: The text document. * position: The position inside the text document. GenLSP.Structures.CallHierarchyRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_registration_options.ex#L2 "View Source") GenLSP.Structures.CallHierarchyRegistrationOptions (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================================== Call hierarchy options used during static or dynamic registration. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CallHierarchyRegistrationOptions{}](#__struct__/0) Fields ------ * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_registration_options.ex#L22 "View Source") ``` @type t() :: %GenLSP.Structures.CallHierarchyRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil, id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CallHierarchyRegistrationOptions{} ===================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/call_hierarchy_registration_options.ex#L22 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. GenLSP.Structures.CancelParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/cancel_params.ex#L2 "View Source") GenLSP.Structures.CancelParams (gen\_lsp v0.6.0) ================================================================================================================================================================================================ [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CancelParams{}](#__struct__/0) Fields ------ * id: The request id to cancel. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/cancel_params.ex#L13 "View Source") ``` @type t() :: %GenLSP.Structures.CancelParams{id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CancelParams{} ================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/cancel_params.ex#L13 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * id: The request id to cancel. GenLSP.Structures.ChangeAnnotation β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/change_annotation.ex#L2 "View Source") GenLSP.Structures.ChangeAnnotation (gen\_lsp v0.6.0) ======================================================================================================================================================================================================== Additional information that describes document changes. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ChangeAnnotation{}](#__struct__/0) Fields ------ * label: A human-readable string describing the actual change. The string is rendered prominent in the user interface. * needs\_confirmation: A flag which indicates that user confirmation is needed before applying the change. * description: A human-readable string which is rendered less prominent in the user interface. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/change_annotation.ex#L24 "View Source") ``` @type t() :: %GenLSP.Structures.ChangeAnnotation{ description: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, label: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), needs_confirmation: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ChangeAnnotation{} ===================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/change_annotation.ex#L24 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * label: A human-readable string describing the actual change. The string is rendered prominent in the user interface. * needs\_confirmation: A flag which indicates that user confirmation is needed before applying the change. * description: A human-readable string which is rendered less prominent in the user interface. GenLSP.Structures.ClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/client_capabilities.ex#L2 "View Source") GenLSP.Structures.ClientCapabilities (gen\_lsp v0.6.0) ============================================================================================================================================================================================================ Defines the capabilities provided by the client. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ClientCapabilities{}](#__struct__/0) Fields ------ * workspace: Workspace specific client capabilities. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/client_capabilities.ex#L26 "View Source") ``` @type t() :: %GenLSP.Structures.ClientCapabilities{ experimental: [GenLSP.TypeAlias.LSPAny.t](GenLSP.TypeAlias.LSPAny.html#t:t/0)() | nil, general: [GenLSP.Structures.GeneralClientCapabilities.t](GenLSP.Structures.GeneralClientCapabilities.html#t:t/0)() | nil, notebook_document: [GenLSP.Structures.NotebookDocumentClientCapabilities.t](GenLSP.Structures.NotebookDocumentClientCapabilities.html#t:t/0)() | nil, text_document: [GenLSP.Structures.TextDocumentClientCapabilities.t](GenLSP.Structures.TextDocumentClientCapabilities.html#t:t/0)() | nil, window: [GenLSP.Structures.WindowClientCapabilities.t](GenLSP.Structures.WindowClientCapabilities.html#t:t/0)() | nil, workspace: [GenLSP.Structures.WorkspaceClientCapabilities.t](GenLSP.Structures.WorkspaceClientCapabilities.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ClientCapabilities{} ======================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/client_capabilities.ex#L26 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * workspace: Workspace specific client capabilities. * text\_document: Text document specific client capabilities. * notebook\_document: Capabilities specific to the notebook document support. @since 3.17.0 * window: Window specific client capabilities. * general: General client capabilities. @since 3.16.0 * experimental: Experimental client capabilities. GenLSP.Structures.CodeAction β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_action.ex#L2 "View Source") GenLSP.Structures.CodeAction (gen\_lsp v0.6.0) ============================================================================================================================================================================================ A code action represents a change that can be performed in code, e.g. to fix a problem or to refactor code. A CodeAction must set either `edit` and/or a `command`. If both are supplied, the `edit` is applied first, then the `command` is executed. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CodeAction{}](#__struct__/0) Fields ------ * title: A short, human-readable, title for this code action. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_action.ex#L54 "View Source") ``` @type t() :: %GenLSP.Structures.CodeAction{ command: [GenLSP.Structures.Command.t](GenLSP.Structures.Command.html#t:t/0)() | nil, data: [GenLSP.TypeAlias.LSPAny.t](GenLSP.TypeAlias.LSPAny.html#t:t/0)() | nil, diagnostics: [[GenLSP.Structures.Diagnostic.t](GenLSP.Structures.Diagnostic.html#t:t/0)()] | nil, disabled: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil, edit: [GenLSP.Structures.WorkspaceEdit.t](GenLSP.Structures.WorkspaceEdit.html#t:t/0)() | nil, is_preferred: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, kind: [GenLSP.Enumerations.CodeActionKind.t](GenLSP.Enumerations.CodeActionKind.html#t:t/0)() | nil, title: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CodeAction{} =============================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_action.ex#L54 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * title: A short, human-readable, title for this code action. * kind: The kind of the code action. Used to filter code actions. * diagnostics: The diagnostics that this code action resolves. * is\_preferred: Marks this as a preferred action. Preferred actions are used by the `auto fix` command and can be targeted by keybindings. A quick fix should be marked preferred if it properly addresses the underlying error. A refactoring should be marked preferred if it is the most reasonable choice of actions to take. @since 3.15.0 * disabled: Marks that the code action cannot currently be applied. Clients should follow the following guidelines regarding disabled code actions: + Disabled code actions are not shown in automatic [lightbulbs](https://code.visualstudio.com/docs/editor/editingevolved#_code-action) code action menus. + Disabled actions are shown as faded out in the code action menu when the user requests a more specific type of code action, such as refactorings. + If the user has a [keybinding](https://code.visualstudio.com/docs/editor/refactoring#_keybindings-for-code-actions) that auto applies a code action and only disabled code actions are returned, the client should show the user an error message with `reason` in the editor.@since 3.16.0 * edit: The workspace edit this code action performs. * command: A command this code action executes. If a code action provides an edit and a command, first the edit is executed and then the command. * data: A data entry field that is preserved on a code action between a `textDocument/codeAction` and a `codeAction/resolve` request. @since 3.16.0 GenLSP.Structures.CodeActionClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_action_client_capabilities.ex#L2 "View Source") GenLSP.Structures.CodeActionClientCapabilities (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================== The Client Capabilities of a {@link CodeActionRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CodeActionClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether code action supports dynamic registration. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_action_client_capabilities.ex#L44 "View Source") ``` @type t() :: %GenLSP.Structures.CodeActionClientCapabilities{ code_action_literal_support: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil, data_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, disabled_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, honors_change_annotations: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, is_preferred_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, resolve_support: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CodeActionClientCapabilities{} ================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_action_client_capabilities.ex#L44 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether code action supports dynamic registration. * code\_action\_literal\_support: The client support code action literals of type `CodeAction` as a valid response of the `textDocument/codeAction` request. If the property is not set the request can only return `Command` literals. @since 3.8.0 * is\_preferred\_support: Whether code action supports the `isPreferred` property. @since 3.15.0 * disabled\_support: Whether code action supports the `disabled` property. @since 3.16.0 * data\_support: Whether code action supports the `data` property which is preserved between a `textDocument/codeAction` and a `codeAction/resolve` request. @since 3.16.0 * resolve\_support: Whether the client supports resolving additional code action properties via a separate `codeAction/resolve` request. @since 3.16.0 * honors\_change\_annotations: Whether the client honors the change annotations in text edits and resource operations returned via the `CodeAction#edit` property by for example presenting the workspace edit in the user interface and asking for confirmation. @since 3.16.0 GenLSP.Structures.CodeActionContext β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_action_context.ex#L2 "View Source") GenLSP.Structures.CodeActionContext (gen\_lsp v0.6.0) =========================================================================================================================================================================================================== Contains additional diagnostic information about the context in which a {@link CodeActionProvider.provideCodeActions code action} is run. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CodeActionContext{}](#__struct__/0) Fields ------ * diagnostics: An array of diagnostics known on the client side overlapping the range provided to the `textDocument/codeAction` request. They are provided so that the server knows which errors are currently presented to the user for the given range. There is no guarantee that these accurately reflect the error state of the resource. The primary parameter to compute code actions is the provided range. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_action_context.ex#L29 "View Source") ``` @type t() :: %GenLSP.Structures.CodeActionContext{ diagnostics: [[GenLSP.Structures.Diagnostic.t](GenLSP.Structures.Diagnostic.html#t:t/0)()], only: [[GenLSP.Enumerations.CodeActionKind.t](GenLSP.Enumerations.CodeActionKind.html#t:t/0)()] | nil, trigger_kind: [GenLSP.Enumerations.CodeActionTriggerKind.t](GenLSP.Enumerations.CodeActionTriggerKind.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CodeActionContext{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_action_context.ex#L29 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * diagnostics: An array of diagnostics known on the client side overlapping the range provided to the `textDocument/codeAction` request. They are provided so that the server knows which errors are currently presented to the user for the given range. There is no guarantee that these accurately reflect the error state of the resource. The primary parameter to compute code actions is the provided range. * only: Requested kind of actions to return. Actions not of this kind are filtered out by the client before being shown. So servers can omit computing them. * trigger\_kind: The reason why code actions were requested. @since 3.17.0 GenLSP.Structures.CodeActionOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_action_options.ex#L2 "View Source") GenLSP.Structures.CodeActionOptions (gen\_lsp v0.6.0) =========================================================================================================================================================================================================== Provider options for a {@link CodeActionRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CodeActionOptions{}](#__struct__/0) Fields ------ * code\_action\_kinds: CodeActionKinds that this server may return. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_action_options.ex#L25 "View Source") ``` @type t() :: %GenLSP.Structures.CodeActionOptions{ code_action_kinds: [[GenLSP.Enumerations.CodeActionKind.t](GenLSP.Enumerations.CodeActionKind.html#t:t/0)()] | nil, resolve_provider: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CodeActionOptions{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_action_options.ex#L25 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * code\_action\_kinds: CodeActionKinds that this server may return. The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server may list out every specific kind they provide. * resolve\_provider: The server provides support to resolve additional information for a code action. @since 3.16.0 * work\_done\_progress GenLSP.Structures.CodeActionParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_action_params.ex#L2 "View Source") GenLSP.Structures.CodeActionParams (gen\_lsp v0.6.0) ========================================================================================================================================================================================================= The parameters of a {@link CodeActionRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CodeActionParams{}](#__struct__/0) Fields ------ * text\_document: The document in which the command was invoked. * range: The range for which the command was invoked. * context: Context carrying additional information. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_action_params.ex#L22 "View Source") ``` @type t() :: %GenLSP.Structures.CodeActionParams{ context: [GenLSP.Structures.CodeActionContext.t](GenLSP.Structures.CodeActionContext.html#t:t/0)(), partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CodeActionParams{} ===================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_action_params.ex#L22 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * text\_document: The document in which the command was invoked. * range: The range for which the command was invoked. * context: Context carrying additional information. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. GenLSP.Structures.CodeActionRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_action_registration_options.ex#L2 "View Source") GenLSP.Structures.CodeActionRegistrationOptions (gen\_lsp v0.6.0) ==================================================================================================================================================================================================================================== Registration options for a {@link CodeActionRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CodeActionRegistrationOptions{}](#__struct__/0) Fields ------ * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_action_registration_options.ex#L26 "View Source") ``` @type t() :: %GenLSP.Structures.CodeActionRegistrationOptions{ code_action_kinds: [[GenLSP.Enumerations.CodeActionKind.t](GenLSP.Enumerations.CodeActionKind.html#t:t/0)()] | nil, document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil, resolve_provider: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CodeActionRegistrationOptions{} ================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_action_registration_options.ex#L26 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. * code\_action\_kinds: CodeActionKinds that this server may return. The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server may list out every specific kind they provide. * resolve\_provider: The server provides support to resolve additional information for a code action. @since 3.16.0 GenLSP.Structures.CodeDescription β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_description.ex#L2 "View Source") GenLSP.Structures.CodeDescription (gen\_lsp v0.6.0) ====================================================================================================================================================================================================== Structure to capture a description for an error code. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CodeDescription{}](#__struct__/0) Fields ------ * href: An URI to open with more information about the diagnostic error. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_description.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.CodeDescription{href: [GenLSP.BaseTypes.uri](GenLSP.BaseTypes.html#t:uri/0)()} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CodeDescription{} ==================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_description.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * href: An URI to open with more information about the diagnostic error. GenLSP.Structures.CodeLens β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_lens.ex#L2 "View Source") GenLSP.Structures.CodeLens (gen\_lsp v0.6.0) ======================================================================================================================================================================================== A code lens represents a {@link Command command} that should be shown along with source text, like the number of references, a way to run tests, etc. A code lens is *unresolved* when no command is associated to it. For performance reasons the creation of a code lens and resolving should be done in two stages. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CodeLens{}](#__struct__/0) Fields ------ * range: The range in which this code lens is valid. Should only span a single line. * command: The command this code lens represents. * data: A data entry field that is preserved on a code lens item between a {@link CodeLensRequest} and a [CodeLensResolveRequest] (#CodeLensResolveRequest) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_lens.ex#L25 "View Source") ``` @type t() :: %GenLSP.Structures.CodeLens{ command: [GenLSP.Structures.Command.t](GenLSP.Structures.Command.html#t:t/0)() | nil, data: [GenLSP.TypeAlias.LSPAny.t](GenLSP.TypeAlias.LSPAny.html#t:t/0)() | nil, range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CodeLens{} ============================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_lens.ex#L25 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * range: The range in which this code lens is valid. Should only span a single line. * command: The command this code lens represents. * data: A data entry field that is preserved on a code lens item between a {@link CodeLensRequest} and a [CodeLensResolveRequest] (#CodeLensResolveRequest) GenLSP.Structures.CodeLensClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_lens_client_capabilities.ex#L2 "View Source") GenLSP.Structures.CodeLensClientCapabilities (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================== The client capabilities of a {@link CodeLensRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CodeLensClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether code lens supports dynamic registration. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_lens_client_capabilities.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.CodeLensClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CodeLensClientCapabilities{} =============================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_lens_client_capabilities.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether code lens supports dynamic registration. GenLSP.Structures.CodeLensOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_lens_options.ex#L2 "View Source") GenLSP.Structures.CodeLensOptions (gen\_lsp v0.6.0) ======================================================================================================================================================================================================= Code Lens provider options of a {@link CodeLensRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CodeLensOptions{}](#__struct__/0) Fields ------ * resolve\_provider: Code lens has a resolve provider as well. * work\_done\_progress [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_lens_options.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.CodeLensOptions{ resolve_provider: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CodeLensOptions{} ==================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_lens_options.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * resolve\_provider: Code lens has a resolve provider as well. * work\_done\_progress GenLSP.Structures.CodeLensParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_lens_params.ex#L2 "View Source") GenLSP.Structures.CodeLensParams (gen\_lsp v0.6.0) ===================================================================================================================================================================================================== The parameters of a {@link CodeLensRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CodeLensParams{}](#__struct__/0) Fields ------ * text\_document: The document to request code lens for. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_lens_params.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.CodeLensParams{ partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CodeLensParams{} =================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_lens_params.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * text\_document: The document to request code lens for. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. GenLSP.Structures.CodeLensRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_lens_registration_options.ex#L2 "View Source") GenLSP.Structures.CodeLensRegistrationOptions (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================ Registration options for a {@link CodeLensRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CodeLensRegistrationOptions{}](#__struct__/0) Fields ------ * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. * resolve\_provider: Code lens has a resolve provider as well. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_lens_registration_options.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.CodeLensRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil, resolve_provider: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CodeLensRegistrationOptions{} ================================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_lens_registration_options.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. * resolve\_provider: Code lens has a resolve provider as well. GenLSP.Structures.CodeLensWorkspaceClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_lens_workspace_client_capabilities.ex#L2 "View Source") GenLSP.Structures.CodeLensWorkspaceClientCapabilities (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================================= @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CodeLensWorkspaceClientCapabilities{}](#__struct__/0) Fields ------ * refresh\_support: Whether the client implementation supports a refresh request sent from the server to the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_lens_workspace_client_capabilities.ex#L23 "View Source") ``` @type t() :: %GenLSP.Structures.CodeLensWorkspaceClientCapabilities{ refresh_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CodeLensWorkspaceClientCapabilities{} ======================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/code_lens_workspace_client_capabilities.ex#L23 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * refresh\_support: Whether the client implementation supports a refresh request sent from the server to the client. Note that this event is global and will force the client to refresh all code lenses currently shown. It should be used with absolute care and is useful for situation where a server for example detect a project wide change that requires such a calculation. GenLSP.Structures.Color β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/color.ex#L2 "View Source") GenLSP.Structures.Color (gen\_lsp v0.6.0) ================================================================================================================================================================================= Represents a color in RGBA space. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.Color{}](#__struct__/0) Fields ------ * red: The red component of this color in the range [0-1]. * green: The green component of this color in the range [0-1]. * blue: The blue component of this color in the range [0-1]. * alpha: The alpha component of this color in the range [0-1]. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/color.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.Color{ alpha: [float](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), blue: [float](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), green: [float](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), red: [float](https://hexdocs.pm/elixir/typespecs.html#basic-types)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.Color{} ========================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/color.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * red: The red component of this color in the range [0-1]. * green: The green component of this color in the range [0-1]. * blue: The blue component of this color in the range [0-1]. * alpha: The alpha component of this color in the range [0-1]. GenLSP.Structures.ColorInformation β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/color_information.ex#L2 "View Source") GenLSP.Structures.ColorInformation (gen\_lsp v0.6.0) ======================================================================================================================================================================================================== Represents a color range from a document. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ColorInformation{}](#__struct__/0) Fields ------ * range: The range in the document where this color appears. * color: The actual color value for this color range. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/color_information.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.ColorInformation{ color: [GenLSP.Structures.Color.t](GenLSP.Structures.Color.html#t:t/0)(), range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ColorInformation{} ===================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/color_information.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * range: The range in the document where this color appears. * color: The actual color value for this color range. GenLSP.Structures.ColorPresentation β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/color_presentation.ex#L2 "View Source") GenLSP.Structures.ColorPresentation (gen\_lsp v0.6.0) ========================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ColorPresentation{}](#__struct__/0) Fields ------ * label: The label of this color presentation. It will be shown on the color picker header. By default this is also the text that is inserted when selecting this color presentation. * text\_edit: An {@link TextEdit edit} which is applied to a document when selecting this presentation for the color. When `falsy` the {@link ColorPresentation.label label} is used. * additional\_text\_edits: An optional array of additional {@link TextEdit text edits} that are applied when selecting this color presentation. Edits must not overlap with the main {@link ColorPresentation.textEdit edit} nor with themselves. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/color_presentation.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.ColorPresentation{ additional_text_edits: [[GenLSP.Structures.TextEdit.t](GenLSP.Structures.TextEdit.html#t:t/0)()] | nil, label: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), text_edit: [GenLSP.Structures.TextEdit.t](GenLSP.Structures.TextEdit.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ColorPresentation{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/color_presentation.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * label: The label of this color presentation. It will be shown on the color picker header. By default this is also the text that is inserted when selecting this color presentation. * text\_edit: An {@link TextEdit edit} which is applied to a document when selecting this presentation for the color. When `falsy` the {@link ColorPresentation.label label} is used. * additional\_text\_edits: An optional array of additional {@link TextEdit text edits} that are applied when selecting this color presentation. Edits must not overlap with the main {@link ColorPresentation.textEdit edit} nor with themselves. GenLSP.Structures.ColorPresentationParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/color_presentation_params.ex#L2 "View Source") GenLSP.Structures.ColorPresentationParams (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================= Parameters for a {@link ColorPresentationRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ColorPresentationParams{}](#__struct__/0) Fields ------ * text\_document: The text document. * color: The color to request presentations for. * range: The range where the color would be inserted. Serves as a context. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/color_presentation_params.ex#L22 "View Source") ``` @type t() :: %GenLSP.Structures.ColorPresentationParams{ color: [GenLSP.Structures.Color.t](GenLSP.Structures.Color.html#t:t/0)(), partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ColorPresentationParams{} ============================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/color_presentation_params.ex#L22 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * text\_document: The text document. * color: The color to request presentations for. * range: The range where the color would be inserted. Serves as a context. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. GenLSP.Structures.Command β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/command.ex#L2 "View Source") GenLSP.Structures.Command (gen\_lsp v0.6.0) ===================================================================================================================================================================================== Represents a reference to a command. Provides a title which will be used to represent a command in the UI and, optionally, an array of arguments which will be passed to the command handler function when invoked. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.Command{}](#__struct__/0) Fields ------ * title: Title of the command, like `save`. * command: The identifier of the actual command handler. * arguments: Arguments that the command handler should be invoked with. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/command.ex#L23 "View Source") ``` @type t() :: %GenLSP.Structures.Command{ arguments: [[GenLSP.TypeAlias.LSPAny.t](GenLSP.TypeAlias.LSPAny.html#t:t/0)()] | nil, command: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), title: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.Command{} ============================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/command.ex#L23 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * title: Title of the command, like `save`. * command: The identifier of the actual command handler. * arguments: Arguments that the command handler should be invoked with. GenLSP.Structures.CompletionClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/completion_client_capabilities.ex#L2 "View Source") GenLSP.Structures.CompletionClientCapabilities (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================= Completion client capabilities [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CompletionClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether completion supports dynamic registration. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/completion_client_capabilities.ex#L31 "View Source") ``` @type t() :: %GenLSP.Structures.CompletionClientCapabilities{ completion_item: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil, completion_item_kind: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil, completion_list: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil, context_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, insert_text_mode: [GenLSP.Enumerations.InsertTextMode.t](GenLSP.Enumerations.InsertTextMode.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CompletionClientCapabilities{} ================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/completion_client_capabilities.ex#L31 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether completion supports dynamic registration. * completion\_item: The client supports the following `CompletionItem` specific capabilities. * completion\_item\_kind * insert\_text\_mode: Defines how the client handles whitespace and indentation when accepting a completion item that uses multi line text in either `insertText` or `textEdit`. @since 3.17.0 * context\_support: The client supports to send additional context information for a `textDocument/completion` request. * completion\_list: The client supports the following `CompletionList` specific capabilities. @since 3.17.0 GenLSP.Structures.CompletionContext β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/completion_context.ex#L2 "View Source") GenLSP.Structures.CompletionContext (gen\_lsp v0.6.0) ========================================================================================================================================================================================================== Contains additional information about the context in which a completion request is triggered. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CompletionContext{}](#__struct__/0) Fields ------ * trigger\_kind: How the completion was triggered. * trigger\_character: The trigger character (a single character) that has trigger code complete. Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter` [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/completion_context.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.CompletionContext{ trigger_character: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, trigger_kind: [GenLSP.Enumerations.CompletionTriggerKind.t](GenLSP.Enumerations.CompletionTriggerKind.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CompletionContext{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/completion_context.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * trigger\_kind: How the completion was triggered. * trigger\_character: The trigger character (a single character) that has trigger code complete. Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter` GenLSP.Structures.CompletionItem β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/completion_item.ex#L2 "View Source") GenLSP.Structures.CompletionItem (gen\_lsp v0.6.0) ==================================================================================================================================================================================================== A completion item represents a text snippet that is proposed to complete text that is being typed. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CompletionItem{}](#__struct__/0) Fields ------ * label: The label of this completion item. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/completion_item.ex#L115 "View Source") ``` @type t() :: %GenLSP.Structures.CompletionItem{ additional_text_edits: [[GenLSP.Structures.TextEdit.t](GenLSP.Structures.TextEdit.html#t:t/0)()] | nil, command: [GenLSP.Structures.Command.t](GenLSP.Structures.Command.html#t:t/0)() | nil, commit_characters: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil, data: [GenLSP.TypeAlias.LSPAny.t](GenLSP.TypeAlias.LSPAny.html#t:t/0)() | nil, deprecated: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, detail: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, documentation: ([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | [GenLSP.Structures.MarkupContent.t](GenLSP.Structures.MarkupContent.html#t:t/0)()) | nil, filter_text: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, insert_text: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, insert_text_format: [GenLSP.Enumerations.InsertTextFormat.t](GenLSP.Enumerations.InsertTextFormat.html#t:t/0)() | nil, insert_text_mode: [GenLSP.Enumerations.InsertTextMode.t](GenLSP.Enumerations.InsertTextMode.html#t:t/0)() | nil, kind: [GenLSP.Enumerations.CompletionItemKind.t](GenLSP.Enumerations.CompletionItemKind.html#t:t/0)() | nil, label: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), label_details: [GenLSP.Structures.CompletionItemLabelDetails.t](GenLSP.Structures.CompletionItemLabelDetails.html#t:t/0)() | nil, preselect: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, sort_text: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, tags: [[GenLSP.Enumerations.CompletionItemTag.t](GenLSP.Enumerations.CompletionItemTag.html#t:t/0)()] | nil, text_edit: ([GenLSP.Structures.TextEdit.t](GenLSP.Structures.TextEdit.html#t:t/0)() | [GenLSP.Structures.InsertReplaceEdit.t](GenLSP.Structures.InsertReplaceEdit.html#t:t/0)()) | nil, text_edit_text: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CompletionItem{} =================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/completion_item.ex#L115 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * label: The label of this completion item. The label property is also by default the text that is inserted when selecting this completion. If label details are provided the label itself should be an unqualified name of the completion item. * label\_details: Additional details for the label @since 3.17.0 * kind: The kind of this completion item. Based of the kind an icon is chosen by the editor. * tags: Tags for this completion item. @since 3.15.0 * detail: A human-readable string with additional information about this item, like type or symbol information. * documentation: A human-readable string that represents a doc-comment. * deprecated: Indicates if this item is deprecated. @deprecated Use `tags` instead. * preselect: Select this item when showing. *Note* that only one completion item can be selected and that the tool / client decides which item that is. The rule is that the *first* item of those that match best is selected. * sort\_text: A string that should be used when comparing this item with other items. When `falsy` the {@link CompletionItem.label label} is used. * filter\_text: A string that should be used when filtering a set of completion items. When `falsy` the {@link CompletionItem.label label} is used. * insert\_text: A string that should be inserted into a document when selecting this completion. When `falsy` the {@link CompletionItem.label label} is used. The `insertText` is subject to interpretation by the client side. Some tools might not take the string literally. For example VS Code when code complete is requested in this example `con<cursor position>` and a completion item with an `insertText` of `console` is provided it will only insert `sole`. Therefore it is recommended to use `textEdit` instead since it avoids additional client side interpretation. * insert\_text\_format: The format of the insert text. The format applies to both the `insertText` property and the `newText` property of a provided `textEdit`. If omitted defaults to `InsertTextFormat.PlainText`. Please note that the insertTextFormat doesn't apply to `additionalTextEdits`. * insert\_text\_mode: How whitespace and indentation is handled during completion item insertion. If not provided the clients default value depends on the `textDocument.completion.insertTextMode` client capability. @since 3.16.0 * text\_edit: An {@link TextEdit edit} which is applied to a document when selecting this completion. When an edit is provided the value of {@link CompletionItem.insertText insertText} is ignored. Most editors support two different operations when accepting a completion item. One is to insert a completion text and the other is to replace an existing text with a completion text. Since this can usually not be predetermined by a server it can report both ranges. Clients need to signal support for `InsertReplaceEdits` via the `textDocument.completion.insertReplaceSupport` client capability property. *Note 1:* The text edit's range as well as both ranges from an insert replace edit must be a [single line] and they must contain the position at which completion has been requested. *Note 2:* If an `InsertReplaceEdit` is returned the edit's insert range must be a prefix of the edit's replace range, that means it must be contained and starting at the same position. @since 3.16.0 additional type `InsertReplaceEdit` * text\_edit\_text: The edit text used if the completion item is part of a CompletionList and CompletionList defines an item default for the text edit range. Clients will only honor this property if they opt into completion list item defaults using the capability `completionList.itemDefaults`. If not provided and a list's default range is provided the label property is used as a text. @since 3.17.0 * additional\_text\_edits: An optional array of additional {@link TextEdit text edits} that are applied when selecting this completion. Edits must not overlap (including the same insert position) with the main {@link CompletionItem.textEdit edit} nor with themselves. Additional text edits should be used to change text unrelated to the current cursor position (for example adding an import statement at the top of the file if the completion item will insert an unqualified type). * commit\_characters: An optional set of characters that when pressed while this completion is active will accept it first and then type that character. *Note* that all commit characters should have `length=1` and that superfluous characters will be ignored. * command: An optional {@link Command command} that is executed *after* inserting this completion. *Note* that additional modifications to the current document should be described with the {@link CompletionItem.additionalTextEdits additionalTextEdits}-property. * data: A data entry field that is preserved on a completion item between a {@link CompletionRequest} and a {@link CompletionResolveRequest}. GenLSP.Structures.CompletionItemLabelDetails β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/completion_item_label_details.ex#L2 "View Source") GenLSP.Structures.CompletionItemLabelDetails (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================== Additional details for a completion item label. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CompletionItemLabelDetails{}](#__struct__/0) Fields ------ * detail: An optional string which is rendered less prominently directly after {@link CompletionItem.label label}, without any spacing. Should be used for function signatures and type annotations. * description: An optional string which is rendered less prominently after {@link CompletionItem.detail}. Should be used for fully qualified names and file paths. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/completion_item_label_details.ex#L22 "View Source") ``` @type t() :: %GenLSP.Structures.CompletionItemLabelDetails{ description: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, detail: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CompletionItemLabelDetails{} =============================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/completion_item_label_details.ex#L22 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * detail: An optional string which is rendered less prominently directly after {@link CompletionItem.label label}, without any spacing. Should be used for function signatures and type annotations. * description: An optional string which is rendered less prominently after {@link CompletionItem.detail}. Should be used for fully qualified names and file paths. GenLSP.Structures.CompletionList β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/completion_list.ex#L2 "View Source") GenLSP.Structures.CompletionList (gen\_lsp v0.6.0) ==================================================================================================================================================================================================== Represents a collection of {@link CompletionItem completion items} to be presented in the editor. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CompletionList{}](#__struct__/0) Fields ------ * is\_incomplete: This list it not complete. Further typing results in recomputing this list. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/completion_list.ex#L35 "View Source") ``` @type t() :: %GenLSP.Structures.CompletionList{ is_incomplete: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), item_defaults: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil, items: [[GenLSP.Structures.CompletionItem.t](GenLSP.Structures.CompletionItem.html#t:t/0)()] } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CompletionList{} =================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/completion_list.ex#L35 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * is\_incomplete: This list it not complete. Further typing results in recomputing this list. Recomputed lists have all their items replaced (not appended) in the incomplete completion sessions. * item\_defaults: In many cases the items of an actual completion result share the same value for properties like `commitCharacters` or the range of a text edit. A completion list can therefore define item defaults which will be used if a completion item itself doesn't specify the value. If a completion list specifies a default value and a completion item also specifies a corresponding value the one from the item is used. Servers are only allowed to return default values if the client signals support for this via the `completionList.itemDefaults` capability. @since 3.17.0 * items: The completion items. GenLSP.Structures.CompletionOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/completion_options.ex#L2 "View Source") GenLSP.Structures.CompletionOptions (gen\_lsp v0.6.0) ========================================================================================================================================================================================================== Completion options. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CompletionOptions{}](#__struct__/0) Fields ------ * trigger\_characters: Most tools trigger completion request automatically without explicitly requesting it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user starts to type an identifier. For example if the user types `c` in a JavaScript file code complete will automatically pop up present `console` besides others as a completion item. Characters that make up identifiers don't need to be listed here. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/completion_options.ex#L39 "View Source") ``` @type t() :: %GenLSP.Structures.CompletionOptions{ all_commit_characters: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil, completion_item: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil, resolve_provider: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, trigger_characters: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil, work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CompletionOptions{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/completion_options.ex#L39 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * trigger\_characters: Most tools trigger completion request automatically without explicitly requesting it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user starts to type an identifier. For example if the user types `c` in a JavaScript file code complete will automatically pop up present `console` besides others as a completion item. Characters that make up identifiers don't need to be listed here. If code complete should automatically be trigger on characters not being valid inside an identifier (for example `.` in JavaScript) list them in `triggerCharacters`. * all\_commit\_characters: The list of all possible characters that commit a completion. This field can be used if clients don't support individual commit characters per completion item. See `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport` If a server provides both `allCommitCharacters` and commit characters on an individual completion item the ones on the completion item win. @since 3.2.0 * resolve\_provider: The server provides support to resolve additional information for a completion item. * completion\_item: The server supports the following `CompletionItem` specific capabilities. @since 3.17.0 * work\_done\_progress GenLSP.Structures.CompletionParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/completion_params.ex#L2 "View Source") GenLSP.Structures.CompletionParams (gen\_lsp v0.6.0) ======================================================================================================================================================================================================== Completion parameters [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CompletionParams{}](#__struct__/0) Fields ------ * context: The completion context. This is only available it the client specifies to send this using the client capability `textDocument.completion.contextSupport === true` * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. * text\_document: The text document. * position: The position inside the text document. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/completion_params.ex#L23 "View Source") ``` @type t() :: %GenLSP.Structures.CompletionParams{ context: [GenLSP.Structures.CompletionContext.t](GenLSP.Structures.CompletionContext.html#t:t/0)() | nil, partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, position: [GenLSP.Structures.Position.t](GenLSP.Structures.Position.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CompletionParams{} ===================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/completion_params.ex#L23 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * context: The completion context. This is only available it the client specifies to send this using the client capability `textDocument.completion.contextSupport === true` * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. * text\_document: The text document. * position: The position inside the text document. GenLSP.Structures.CompletionRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/completion_registration_options.ex#L2 "View Source") GenLSP.Structures.CompletionRegistrationOptions (gen\_lsp v0.6.0) =================================================================================================================================================================================================================================== Registration options for a {@link CompletionRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CompletionRegistrationOptions{}](#__struct__/0) Fields ------ * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/completion_registration_options.ex#L40 "View Source") ``` @type t() :: %GenLSP.Structures.CompletionRegistrationOptions{ all_commit_characters: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil, completion_item: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil, document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil, resolve_provider: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, trigger_characters: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CompletionRegistrationOptions{} ================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/completion_registration_options.ex#L40 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. * trigger\_characters: Most tools trigger completion request automatically without explicitly requesting it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user starts to type an identifier. For example if the user types `c` in a JavaScript file code complete will automatically pop up present `console` besides others as a completion item. Characters that make up identifiers don't need to be listed here. If code complete should automatically be trigger on characters not being valid inside an identifier (for example `.` in JavaScript) list them in `triggerCharacters`. * all\_commit\_characters: The list of all possible characters that commit a completion. This field can be used if clients don't support individual commit characters per completion item. See `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport` If a server provides both `allCommitCharacters` and commit characters on an individual completion item the ones on the completion item win. @since 3.2.0 * resolve\_provider: The server provides support to resolve additional information for a completion item. * completion\_item: The server supports the following `CompletionItem` specific capabilities. @since 3.17.0 GenLSP.Structures.ConfigurationItem β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/configuration_item.ex#L2 "View Source") GenLSP.Structures.ConfigurationItem (gen\_lsp v0.6.0) ========================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ConfigurationItem{}](#__struct__/0) Fields ------ * scope\_uri: The scope to get the configuration section for. * section: The configuration section asked for. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/configuration_item.ex#L14 "View Source") ``` @type t() :: %GenLSP.Structures.ConfigurationItem{ scope_uri: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, section: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ConfigurationItem{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/configuration_item.ex#L14 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * scope\_uri: The scope to get the configuration section for. * section: The configuration section asked for. GenLSP.Structures.ConfigurationParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/configuration_params.ex#L2 "View Source") GenLSP.Structures.ConfigurationParams (gen\_lsp v0.6.0) ============================================================================================================================================================================================================== The parameters of a configuration request. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ConfigurationParams{}](#__struct__/0) Fields ------ * items [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/configuration_params.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.ConfigurationParams{ items: [[GenLSP.Structures.ConfigurationItem.t](GenLSP.Structures.ConfigurationItem.html#t:t/0)()] } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ConfigurationParams{} ======================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/configuration_params.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * items GenLSP.Structures.CreateFile β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/create_file.ex#L2 "View Source") GenLSP.Structures.CreateFile (gen\_lsp v0.6.0) ============================================================================================================================================================================================ Create file operation. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CreateFile{}](#__struct__/0) Fields ------ * kind: A create [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/create_file.ex#L22 "View Source") ``` @type t() :: %GenLSP.Structures.CreateFile{ annotation_id: [GenLSP.TypeAlias.ChangeAnnotationIdentifier.t](GenLSP.TypeAlias.ChangeAnnotationIdentifier.html#t:t/0)() | nil, kind: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), options: [GenLSP.Structures.CreateFileOptions.t](GenLSP.Structures.CreateFileOptions.html#t:t/0)() | nil, uri: [GenLSP.BaseTypes.document\_uri](GenLSP.BaseTypes.html#t:document_uri/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CreateFile{} =============================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/create_file.ex#L22 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * kind: A create * uri: The resource to create. * options: Additional options * annotation\_id: An optional annotation identifier describing the operation. @since 3.16.0 GenLSP.Structures.CreateFileOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/create_file_options.ex#L2 "View Source") GenLSP.Structures.CreateFileOptions (gen\_lsp v0.6.0) =========================================================================================================================================================================================================== Options to create a file. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CreateFileOptions{}](#__struct__/0) Fields ------ * overwrite: Overwrite existing file. Overwrite wins over `ignoreIfExists` * ignore\_if\_exists: Ignore if exists. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/create_file_options.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.CreateFileOptions{ ignore_if_exists: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, overwrite: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CreateFileOptions{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/create_file_options.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * overwrite: Overwrite existing file. Overwrite wins over `ignoreIfExists` * ignore\_if\_exists: Ignore if exists. GenLSP.Structures.CreateFilesParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/create_files_params.ex#L2 "View Source") GenLSP.Structures.CreateFilesParams (gen\_lsp v0.6.0) =========================================================================================================================================================================================================== The parameters sent in notifications/requests for user-initiated creation of files. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.CreateFilesParams{}](#__struct__/0) Fields ------ * files: An array of all files/folders created in this operation. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/create_files_params.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.CreateFilesParams{ files: [[GenLSP.Structures.FileCreate.t](GenLSP.Structures.FileCreate.html#t:t/0)()] } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.CreateFilesParams{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/create_files_params.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * files: An array of all files/folders created in this operation. GenLSP.Structures.DeclarationClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/declaration_client_capabilities.ex#L2 "View Source") GenLSP.Structures.DeclarationClientCapabilities (gen\_lsp v0.6.0) =================================================================================================================================================================================================================================== @since 3.14.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DeclarationClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether declaration supports dynamic registration. If this is set to `true` the client supports the new `DeclarationRegistrationOptions` return value for the corresponding server capability as well. * link\_support: The client supports additional metadata in the form of declaration links. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/declaration_client_capabilities.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.DeclarationClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, link_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DeclarationClientCapabilities{} ================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/declaration_client_capabilities.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether declaration supports dynamic registration. If this is set to `true` the client supports the new `DeclarationRegistrationOptions` return value for the corresponding server capability as well. * link\_support: The client supports additional metadata in the form of declaration links. GenLSP.Structures.DeclarationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/declaration_options.ex#L2 "View Source") GenLSP.Structures.DeclarationOptions (gen\_lsp v0.6.0) ============================================================================================================================================================================================================ [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DeclarationOptions{}](#__struct__/0) Fields ------ * work\_done\_progress [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/declaration_options.ex#L13 "View Source") ``` @type t() :: %GenLSP.Structures.DeclarationOptions{ work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DeclarationOptions{} ======================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/declaration_options.ex#L13 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_progress GenLSP.Structures.DeclarationParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/declaration_params.ex#L2 "View Source") GenLSP.Structures.DeclarationParams (gen\_lsp v0.6.0) ========================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DeclarationParams{}](#__struct__/0) Fields ------ * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. * text\_document: The text document. * position: The position inside the text document. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/declaration_params.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.DeclarationParams{ partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, position: [GenLSP.Structures.Position.t](GenLSP.Structures.Position.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DeclarationParams{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/declaration_params.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. * text\_document: The text document. * position: The position inside the text document. GenLSP.Structures.DeclarationRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/declaration_registration_options.ex#L2 "View Source") GenLSP.Structures.DeclarationRegistrationOptions (gen\_lsp v0.6.0) ===================================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DeclarationRegistrationOptions{}](#__struct__/0) Fields ------ * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/declaration_registration_options.ex#L16 "View Source") ``` @type t() :: %GenLSP.Structures.DeclarationRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil, id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DeclarationRegistrationOptions{} =================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/declaration_registration_options.ex#L16 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. GenLSP.Structures.DefinitionClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/definition_client_capabilities.ex#L2 "View Source") GenLSP.Structures.DefinitionClientCapabilities (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================= Client Capabilities for a {@link DefinitionRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DefinitionClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether definition supports dynamic registration. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/definition_client_capabilities.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.DefinitionClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, link_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DefinitionClientCapabilities{} ================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/definition_client_capabilities.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether definition supports dynamic registration. * link\_support: The client supports additional metadata in the form of definition links. @since 3.14.0 GenLSP.Structures.DefinitionOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/definition_options.ex#L2 "View Source") GenLSP.Structures.DefinitionOptions (gen\_lsp v0.6.0) ========================================================================================================================================================================================================== Server Capabilities for a {@link DefinitionRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DefinitionOptions{}](#__struct__/0) Fields ------ * work\_done\_progress [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/definition_options.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.DefinitionOptions{work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DefinitionOptions{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/definition_options.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_progress GenLSP.Structures.DefinitionParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/definition_params.ex#L2 "View Source") GenLSP.Structures.DefinitionParams (gen\_lsp v0.6.0) ======================================================================================================================================================================================================== Parameters for a {@link DefinitionRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DefinitionParams{}](#__struct__/0) Fields ------ * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. * text\_document: The text document. * position: The position inside the text document. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/definition_params.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.DefinitionParams{ partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, position: [GenLSP.Structures.Position.t](GenLSP.Structures.Position.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DefinitionParams{} ===================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/definition_params.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. * text\_document: The text document. * position: The position inside the text document. GenLSP.Structures.DefinitionRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/definition_registration_options.ex#L2 "View Source") GenLSP.Structures.DefinitionRegistrationOptions (gen\_lsp v0.6.0) =================================================================================================================================================================================================================================== Registration options for a {@link DefinitionRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DefinitionRegistrationOptions{}](#__struct__/0) Fields ------ * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/definition_registration_options.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.DefinitionRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DefinitionRegistrationOptions{} ================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/definition_registration_options.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. GenLSP.Structures.DeleteFile β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/delete_file.ex#L2 "View Source") GenLSP.Structures.DeleteFile (gen\_lsp v0.6.0) ============================================================================================================================================================================================ Delete file operation [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DeleteFile{}](#__struct__/0) Fields ------ * kind: A delete [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/delete_file.ex#L22 "View Source") ``` @type t() :: %GenLSP.Structures.DeleteFile{ annotation_id: [GenLSP.TypeAlias.ChangeAnnotationIdentifier.t](GenLSP.TypeAlias.ChangeAnnotationIdentifier.html#t:t/0)() | nil, kind: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), options: [GenLSP.Structures.DeleteFileOptions.t](GenLSP.Structures.DeleteFileOptions.html#t:t/0)() | nil, uri: [GenLSP.BaseTypes.document\_uri](GenLSP.BaseTypes.html#t:document_uri/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DeleteFile{} =============================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/delete_file.ex#L22 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * kind: A delete * uri: The file to delete. * options: Delete options. * annotation\_id: An optional annotation identifier describing the operation. @since 3.16.0 GenLSP.Structures.DeleteFileOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/delete_file_options.ex#L2 "View Source") GenLSP.Structures.DeleteFileOptions (gen\_lsp v0.6.0) =========================================================================================================================================================================================================== Delete file options [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DeleteFileOptions{}](#__struct__/0) Fields ------ * recursive: Delete the content recursively if a folder is denoted. * ignore\_if\_not\_exists: Ignore the operation if the file doesn't exist. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/delete_file_options.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.DeleteFileOptions{ ignore_if_not_exists: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, recursive: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DeleteFileOptions{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/delete_file_options.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * recursive: Delete the content recursively if a folder is denoted. * ignore\_if\_not\_exists: Ignore the operation if the file doesn't exist. GenLSP.Structures.DeleteFilesParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/delete_files_params.ex#L2 "View Source") GenLSP.Structures.DeleteFilesParams (gen\_lsp v0.6.0) =========================================================================================================================================================================================================== The parameters sent in notifications/requests for user-initiated deletes of files. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DeleteFilesParams{}](#__struct__/0) Fields ------ * files: An array of all files/folders deleted in this operation. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/delete_files_params.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.DeleteFilesParams{ files: [[GenLSP.Structures.FileDelete.t](GenLSP.Structures.FileDelete.html#t:t/0)()] } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DeleteFilesParams{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/delete_files_params.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * files: An array of all files/folders deleted in this operation. GenLSP.Structures.Diagnostic β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/diagnostic.ex#L2 "View Source") GenLSP.Structures.Diagnostic (gen\_lsp v0.6.0) =========================================================================================================================================================================================== Represents a diagnostic, such as a compiler error or warning. Diagnostic objects are only valid in the scope of a resource. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.Diagnostic{}](#__struct__/0) Fields ------ * range: The range at which the message applies [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/diagnostic.ex#L38 "View Source") ``` @type t() :: %GenLSP.Structures.Diagnostic{ code: ([integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) | nil, code_description: [GenLSP.Structures.CodeDescription.t](GenLSP.Structures.CodeDescription.html#t:t/0)() | nil, data: [GenLSP.TypeAlias.LSPAny.t](GenLSP.TypeAlias.LSPAny.html#t:t/0)() | nil, message: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)(), related_information: [[GenLSP.Structures.DiagnosticRelatedInformation.t](GenLSP.Structures.DiagnosticRelatedInformation.html#t:t/0)()] | nil, severity: [GenLSP.Enumerations.DiagnosticSeverity.t](GenLSP.Enumerations.DiagnosticSeverity.html#t:t/0)() | nil, source: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, tags: [[GenLSP.Enumerations.DiagnosticTag.t](GenLSP.Enumerations.DiagnosticTag.html#t:t/0)()] | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.Diagnostic{} =============================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/diagnostic.ex#L38 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * range: The range at which the message applies * severity: The diagnostic's severity. Can be omitted. If omitted it is up to the client to interpret diagnostics as error, warning, info or hint. * code: The diagnostic's code, which usually appear in the user interface. * code\_description: An optional property to describe the error code. Requires the code field (above) to be present/not null. @since 3.16.0 * source: A human-readable string describing the source of this diagnostic, e.g. 'typescript' or 'super lint'. It usually appears in the user interface. * message: The diagnostic's message. It usually appears in the user interface * tags: Additional metadata about the diagnostic. @since 3.15.0 * related\_information: An array of related diagnostic information, e.g. when symbol-names within a scope collide all definitions can be marked via this property. * data: A data entry field that is preserved between a `textDocument/publishDiagnostics` notification and `textDocument/codeAction` request. @since 3.16.0 GenLSP.Structures.DiagnosticClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/diagnostic_client_capabilities.ex#L2 "View Source") GenLSP.Structures.DiagnosticClientCapabilities (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================= Client capabilities specific to diagnostic pull requests. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DiagnosticClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether implementation supports dynamic registration. If this is set to `true` the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` return value for the corresponding server capability as well. * related\_document\_support: Whether the clients supports related documents for document diagnostic pulls. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/diagnostic_client_capabilities.ex#L22 "View Source") ``` @type t() :: %GenLSP.Structures.DiagnosticClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, related_document_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DiagnosticClientCapabilities{} ================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/diagnostic_client_capabilities.ex#L22 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether implementation supports dynamic registration. If this is set to `true` the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` return value for the corresponding server capability as well. * related\_document\_support: Whether the clients supports related documents for document diagnostic pulls. GenLSP.Structures.DiagnosticOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/diagnostic_options.ex#L2 "View Source") GenLSP.Structures.DiagnosticOptions (gen\_lsp v0.6.0) ========================================================================================================================================================================================================== Diagnostic options. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DiagnosticOptions{}](#__struct__/0) Fields ------ * identifier: An optional identifier under which the diagnostics are managed by the client. * inter\_file\_dependencies: Whether the language has inter file dependencies meaning that editing code in one file can result in a different diagnostic set in another file. Inter file dependencies are common for most programming languages and typically uncommon for linters. * workspace\_diagnostics: The server provides support for workspace diagnostics as well. * work\_done\_progress [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/diagnostic_options.ex#L26 "View Source") ``` @type t() :: %GenLSP.Structures.DiagnosticOptions{ identifier: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, inter_file_dependencies: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, workspace_diagnostics: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DiagnosticOptions{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/diagnostic_options.ex#L26 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * identifier: An optional identifier under which the diagnostics are managed by the client. * inter\_file\_dependencies: Whether the language has inter file dependencies meaning that editing code in one file can result in a different diagnostic set in another file. Inter file dependencies are common for most programming languages and typically uncommon for linters. * workspace\_diagnostics: The server provides support for workspace diagnostics as well. * work\_done\_progress GenLSP.Structures.DiagnosticRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/diagnostic_registration_options.ex#L2 "View Source") GenLSP.Structures.DiagnosticRegistrationOptions (gen\_lsp v0.6.0) =================================================================================================================================================================================================================================== Diagnostic registration options. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DiagnosticRegistrationOptions{}](#__struct__/0) Fields ------ * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. * identifier: An optional identifier under which the diagnostics are managed by the client. * inter\_file\_dependencies: Whether the language has inter file dependencies meaning that editing code in one file can result in a different diagnostic set in another file. Inter file dependencies are common for most programming languages and typically uncommon for linters. * workspace\_diagnostics: The server provides support for workspace diagnostics as well. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/diagnostic_registration_options.ex#L29 "View Source") ``` @type t() :: %GenLSP.Structures.DiagnosticRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil, id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, identifier: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, inter_file_dependencies: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), workspace_diagnostics: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DiagnosticRegistrationOptions{} ================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/diagnostic_registration_options.ex#L29 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. * identifier: An optional identifier under which the diagnostics are managed by the client. * inter\_file\_dependencies: Whether the language has inter file dependencies meaning that editing code in one file can result in a different diagnostic set in another file. Inter file dependencies are common for most programming languages and typically uncommon for linters. * workspace\_diagnostics: The server provides support for workspace diagnostics as well. GenLSP.Structures.DiagnosticRelatedInformation β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/diagnostic_related_information.ex#L2 "View Source") GenLSP.Structures.DiagnosticRelatedInformation (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================= Represents a related message and source code location for a diagnostic. This should be used to point to code locations that cause or related to a diagnostics, e.g when duplicating a symbol in a scope. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DiagnosticRelatedInformation{}](#__struct__/0) Fields ------ * location: The location of this related diagnostic information. * message: The message of this related diagnostic information. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/diagnostic_related_information.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.DiagnosticRelatedInformation{ location: [GenLSP.Structures.Location.t](GenLSP.Structures.Location.html#t:t/0)(), message: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DiagnosticRelatedInformation{} ================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/diagnostic_related_information.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * location: The location of this related diagnostic information. * message: The message of this related diagnostic information. GenLSP.Structures.DiagnosticServerCancellationData β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/diagnostic_server_cancellation_data.ex#L2 "View Source") GenLSP.Structures.DiagnosticServerCancellationData (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================================== Cancellation data returned from a diagnostic request. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DiagnosticServerCancellationData{}](#__struct__/0) Fields ------ * retrigger\_request [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/diagnostic_server_cancellation_data.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.DiagnosticServerCancellationData{ retrigger_request: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DiagnosticServerCancellationData{} ===================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/diagnostic_server_cancellation_data.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * retrigger\_request GenLSP.Structures.DiagnosticWorkspaceClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/diagnostic_workspace_client_capabilities.ex#L2 "View Source") GenLSP.Structures.DiagnosticWorkspaceClientCapabilities (gen\_lsp v0.6.0) ==================================================================================================================================================================================================================================================== Workspace client capabilities specific to diagnostic pull requests. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DiagnosticWorkspaceClientCapabilities{}](#__struct__/0) Fields ------ * refresh\_support: Whether the client implementation supports a refresh request sent from the server to the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/diagnostic_workspace_client_capabilities.ex#L25 "View Source") ``` @type t() :: %GenLSP.Structures.DiagnosticWorkspaceClientCapabilities{ refresh_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DiagnosticWorkspaceClientCapabilities{} ========================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/diagnostic_workspace_client_capabilities.ex#L25 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * refresh\_support: Whether the client implementation supports a refresh request sent from the server to the client. Note that this event is global and will force the client to refresh all pulled diagnostics currently shown. It should be used with absolute care and is useful for situation where a server for example detects a project wide change that requires such a calculation. GenLSP.Structures.DidChangeConfigurationClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_configuration_client_capabilities.ex#L2 "View Source") GenLSP.Structures.DidChangeConfigurationClientCapabilities (gen\_lsp v0.6.0) =========================================================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DidChangeConfigurationClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Did change configuration notification supports dynamic registration. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_configuration_client_capabilities.ex#L13 "View Source") ``` @type t() :: %GenLSP.Structures.DidChangeConfigurationClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DidChangeConfigurationClientCapabilities{} ============================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_configuration_client_capabilities.ex#L13 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Did change configuration notification supports dynamic registration. GenLSP.Structures.DidChangeConfigurationParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_configuration_params.ex#L2 "View Source") GenLSP.Structures.DidChangeConfigurationParams (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================== The parameters of a change configuration notification. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DidChangeConfigurationParams{}](#__struct__/0) Fields ------ * settings: The actual changed settings [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_configuration_params.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.DidChangeConfigurationParams{ settings: [GenLSP.TypeAlias.LSPAny.t](GenLSP.TypeAlias.LSPAny.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DidChangeConfigurationParams{} ================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_configuration_params.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * settings: The actual changed settings GenLSP.Structures.DidChangeConfigurationRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_configuration_registration_options.ex#L2 "View Source") GenLSP.Structures.DidChangeConfigurationRegistrationOptions (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================================================= [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DidChangeConfigurationRegistrationOptions{}](#__struct__/0) Fields ------ * section [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_configuration_registration_options.ex#L13 "View Source") ``` @type t() :: %GenLSP.Structures.DidChangeConfigurationRegistrationOptions{ section: ([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()]) | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DidChangeConfigurationRegistrationOptions{} ============================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_configuration_registration_options.ex#L13 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * section GenLSP.Structures.DidChangeNotebookDocumentParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_notebook_document_params.ex#L2 "View Source") GenLSP.Structures.DidChangeNotebookDocumentParams (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================================= The params sent in a change notebook document notification. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DidChangeNotebookDocumentParams{}](#__struct__/0) Fields ------ * notebook\_document: The notebook document that did change. The version number points to the version after all provided changes have been applied. If only the text document content of a cell changes the notebook version doesn't necessarily have to change. * change: The actual changes to the notebook document.The changes describe single state changes to the notebook document. So if there are two changes c1 (at array index 0) and c2 (at array index 1) for a notebook in state S then c1 moves the notebook from S to S' and c2 from S' to S''. So c1 is computed on the state S and c2 is computed on the state S'.To mirror the content of a notebook using change events use the following approach: + start with the same initial content + apply the 'notebookDocument/didChange' notifications in the order you receive them. + apply the `NotebookChangeEvent`s in a single notification in the order you receive them. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_notebook_document_params.ex#L35 "View Source") ``` @type t() :: %GenLSP.Structures.DidChangeNotebookDocumentParams{ change: [GenLSP.Structures.NotebookDocumentChangeEvent.t](GenLSP.Structures.NotebookDocumentChangeEvent.html#t:t/0)(), notebook_document: [GenLSP.Structures.VersionedNotebookDocumentIdentifier.t](GenLSP.Structures.VersionedNotebookDocumentIdentifier.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DidChangeNotebookDocumentParams{} ==================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_notebook_document_params.ex#L35 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * notebook\_document: The notebook document that did change. The version number points to the version after all provided changes have been applied. If only the text document content of a cell changes the notebook version doesn't necessarily have to change. * change: The actual changes to the notebook document.The changes describe single state changes to the notebook document. So if there are two changes c1 (at array index 0) and c2 (at array index 1) for a notebook in state S then c1 moves the notebook from S to S' and c2 from S' to S''. So c1 is computed on the state S and c2 is computed on the state S'.To mirror the content of a notebook using change events use the following approach: + start with the same initial content + apply the 'notebookDocument/didChange' notifications in the order you receive them. + apply the `NotebookChangeEvent`s in a single notification in the order you receive them. GenLSP.Structures.DidChangeTextDocumentParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_text_document_params.ex#L2 "View Source") GenLSP.Structures.DidChangeTextDocumentParams (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================= The change text document notification's parameters. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DidChangeTextDocumentParams{}](#__struct__/0) Fields ------ * text\_document: The document that did change. The version number points to the version after all provided content changes have been applied. * content\_changes: The actual content changes. The content changes describe single state changes to the document. So if there are two content changes c1 (at array index 0) and c2 (at array index 1) for a document in state S then c1 moves the document from S to S' and c2 from S' to S''. So c1 is computed on the state S and c2 is computed on the state S'.To mirror the content of a document using change events use the following approach: + start with the same initial content + apply the 'textDocument/didChange' notifications in the order you receive them. + apply the `TextDocumentContentChangeEvent`s in a single notification in the order you receive them. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_text_document_params.ex#L30 "View Source") ``` @type t() :: %GenLSP.Structures.DidChangeTextDocumentParams{ content_changes: [[GenLSP.TypeAlias.TextDocumentContentChangeEvent.t](GenLSP.TypeAlias.TextDocumentContentChangeEvent.html#t:t/0)()], text_document: [GenLSP.Structures.VersionedTextDocumentIdentifier.t](GenLSP.Structures.VersionedTextDocumentIdentifier.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DidChangeTextDocumentParams{} ================================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_text_document_params.ex#L30 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * text\_document: The document that did change. The version number points to the version after all provided content changes have been applied. * content\_changes: The actual content changes. The content changes describe single state changes to the document. So if there are two content changes c1 (at array index 0) and c2 (at array index 1) for a document in state S then c1 moves the document from S to S' and c2 from S' to S''. So c1 is computed on the state S and c2 is computed on the state S'.To mirror the content of a document using change events use the following approach: + start with the same initial content + apply the 'textDocument/didChange' notifications in the order you receive them. + apply the `TextDocumentContentChangeEvent`s in a single notification in the order you receive them. GenLSP.Structures.DidChangeWatchedFilesClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_watched_files_client_capabilities.ex#L2 "View Source") GenLSP.Structures.DidChangeWatchedFilesClientCapabilities (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DidChangeWatchedFilesClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Did change watched files notification supports dynamic registration. Please note that the current protocol doesn't support static configuration for file changes from the server side. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_watched_files_client_capabilities.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.DidChangeWatchedFilesClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, relative_pattern_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DidChangeWatchedFilesClientCapabilities{} ============================================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_watched_files_client_capabilities.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Did change watched files notification supports dynamic registration. Please note that the current protocol doesn't support static configuration for file changes from the server side. * relative\_pattern\_support: Whether the client has support for {@link RelativePattern relative pattern} or not. @since 3.17.0 GenLSP.Structures.DidChangeWatchedFilesParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_watched_files_params.ex#L2 "View Source") GenLSP.Structures.DidChangeWatchedFilesParams (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================= The watched files change notification's parameters. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DidChangeWatchedFilesParams{}](#__struct__/0) Fields ------ * changes: The actual file events. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_watched_files_params.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.DidChangeWatchedFilesParams{ changes: [[GenLSP.Structures.FileEvent.t](GenLSP.Structures.FileEvent.html#t:t/0)()] } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DidChangeWatchedFilesParams{} ================================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_watched_files_params.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * changes: The actual file events. GenLSP.Structures.DidChangeWatchedFilesRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_watched_files_registration_options.ex#L2 "View Source") GenLSP.Structures.DidChangeWatchedFilesRegistrationOptions (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================================================ Describe options to be used when registered for text document change events. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DidChangeWatchedFilesRegistrationOptions{}](#__struct__/0) Fields ------ * watchers: The watchers to register. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_watched_files_registration_options.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.DidChangeWatchedFilesRegistrationOptions{ watchers: [[GenLSP.Structures.FileSystemWatcher.t](GenLSP.Structures.FileSystemWatcher.html#t:t/0)()] } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DidChangeWatchedFilesRegistrationOptions{} ============================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_watched_files_registration_options.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * watchers: The watchers to register. GenLSP.Structures.DidChangeWorkspaceFoldersParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_workspace_folders_params.ex#L2 "View Source") GenLSP.Structures.DidChangeWorkspaceFoldersParams (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================================= The parameters of a `workspace/didChangeWorkspaceFolders` notification. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DidChangeWorkspaceFoldersParams{}](#__struct__/0) Fields ------ * event: The actual workspace folder change event. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_workspace_folders_params.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.DidChangeWorkspaceFoldersParams{ event: [GenLSP.Structures.WorkspaceFoldersChangeEvent.t](GenLSP.Structures.WorkspaceFoldersChangeEvent.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DidChangeWorkspaceFoldersParams{} ==================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_change_workspace_folders_params.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * event: The actual workspace folder change event. GenLSP.Structures.DidCloseNotebookDocumentParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_close_notebook_document_params.ex#L2 "View Source") GenLSP.Structures.DidCloseNotebookDocumentParams (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================================= The params sent in a close notebook document notification. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DidCloseNotebookDocumentParams{}](#__struct__/0) Fields ------ * notebook\_document: The notebook document that got closed. * cell\_text\_documents: The text documents that represent the content of a notebook cell that got closed. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_close_notebook_document_params.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.DidCloseNotebookDocumentParams{ cell_text_documents: [[GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)()], notebook_document: [GenLSP.Structures.NotebookDocumentIdentifier.t](GenLSP.Structures.NotebookDocumentIdentifier.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DidCloseNotebookDocumentParams{} =================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_close_notebook_document_params.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * notebook\_document: The notebook document that got closed. * cell\_text\_documents: The text documents that represent the content of a notebook cell that got closed. GenLSP.Structures.DidCloseTextDocumentParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_close_text_document_params.ex#L2 "View Source") GenLSP.Structures.DidCloseTextDocumentParams (gen\_lsp v0.6.0) =============================================================================================================================================================================================================================== The parameters sent in a close text document notification [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DidCloseTextDocumentParams{}](#__struct__/0) Fields ------ * text\_document: The document that was closed. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_close_text_document_params.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.DidCloseTextDocumentParams{ text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DidCloseTextDocumentParams{} =============================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_close_text_document_params.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * text\_document: The document that was closed. GenLSP.Structures.DidOpenNotebookDocumentParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_open_notebook_document_params.ex#L2 "View Source") GenLSP.Structures.DidOpenNotebookDocumentParams (gen\_lsp v0.6.0) ===================================================================================================================================================================================================================================== The params sent in an open notebook document notification. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DidOpenNotebookDocumentParams{}](#__struct__/0) Fields ------ * notebook\_document: The notebook document that got opened. * cell\_text\_documents: The text documents that represent the content of a notebook cell. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_open_notebook_document_params.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.DidOpenNotebookDocumentParams{ cell_text_documents: [[GenLSP.Structures.TextDocumentItem.t](GenLSP.Structures.TextDocumentItem.html#t:t/0)()], notebook_document: [GenLSP.Structures.NotebookDocument.t](GenLSP.Structures.NotebookDocument.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DidOpenNotebookDocumentParams{} ================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_open_notebook_document_params.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * notebook\_document: The notebook document that got opened. * cell\_text\_documents: The text documents that represent the content of a notebook cell. GenLSP.Structures.DidOpenTextDocumentParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_open_text_document_params.ex#L2 "View Source") GenLSP.Structures.DidOpenTextDocumentParams (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================= The parameters sent in an open text document notification [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DidOpenTextDocumentParams{}](#__struct__/0) Fields ------ * text\_document: The document that was opened. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_open_text_document_params.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.DidOpenTextDocumentParams{ text_document: [GenLSP.Structures.TextDocumentItem.t](GenLSP.Structures.TextDocumentItem.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DidOpenTextDocumentParams{} ============================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_open_text_document_params.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * text\_document: The document that was opened. GenLSP.Structures.DidSaveNotebookDocumentParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_save_notebook_document_params.ex#L2 "View Source") GenLSP.Structures.DidSaveNotebookDocumentParams (gen\_lsp v0.6.0) ===================================================================================================================================================================================================================================== The params sent in a save notebook document notification. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DidSaveNotebookDocumentParams{}](#__struct__/0) Fields ------ * notebook\_document: The notebook document that got saved. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_save_notebook_document_params.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.DidSaveNotebookDocumentParams{ notebook_document: [GenLSP.Structures.NotebookDocumentIdentifier.t](GenLSP.Structures.NotebookDocumentIdentifier.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DidSaveNotebookDocumentParams{} ================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_save_notebook_document_params.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * notebook\_document: The notebook document that got saved. GenLSP.Structures.DidSaveTextDocumentParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_save_text_document_params.ex#L2 "View Source") GenLSP.Structures.DidSaveTextDocumentParams (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================= The parameters sent in a save text document notification [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DidSaveTextDocumentParams{}](#__struct__/0) Fields ------ * text\_document: The document that was saved. * text: Optional the content when saved. Depends on the includeText value when the save notification was requested. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_save_text_document_params.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.DidSaveTextDocumentParams{ text: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DidSaveTextDocumentParams{} ============================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/did_save_text_document_params.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * text\_document: The document that was saved. * text: Optional the content when saved. Depends on the includeText value when the save notification was requested. GenLSP.Structures.DocumentColorClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_color_client_capabilities.ex#L2 "View Source") GenLSP.Structures.DocumentColorClientCapabilities (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentColorClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether implementation supports dynamic registration. If this is set to `true` the client supports the new `DocumentColorRegistrationOptions` return value for the corresponding server capability as well. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_color_client_capabilities.ex#L15 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentColorClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentColorClientCapabilities{} ==================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_color_client_capabilities.ex#L15 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether implementation supports dynamic registration. If this is set to `true` the client supports the new `DocumentColorRegistrationOptions` return value for the corresponding server capability as well. GenLSP.Structures.DocumentColorOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_color_options.ex#L2 "View Source") GenLSP.Structures.DocumentColorOptions (gen\_lsp v0.6.0) ================================================================================================================================================================================================================= [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentColorOptions{}](#__struct__/0) Fields ------ * work\_done\_progress [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_color_options.ex#L13 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentColorOptions{ work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentColorOptions{} ========================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_color_options.ex#L13 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_progress GenLSP.Structures.DocumentColorParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_color_params.ex#L2 "View Source") GenLSP.Structures.DocumentColorParams (gen\_lsp v0.6.0) =============================================================================================================================================================================================================== Parameters for a {@link DocumentColorRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentColorParams{}](#__struct__/0) Fields ------ * text\_document: The text document. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_color_params.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentColorParams{ partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentColorParams{} ======================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_color_params.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * text\_document: The text document. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. GenLSP.Structures.DocumentColorRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_color_registration_options.ex#L2 "View Source") GenLSP.Structures.DocumentColorRegistrationOptions (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentColorRegistrationOptions{}](#__struct__/0) Fields ------ * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_color_registration_options.ex#L16 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentColorRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil, id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentColorRegistrationOptions{} ===================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_color_registration_options.ex#L16 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. GenLSP.Structures.DocumentDiagnosticParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_diagnostic_params.ex#L2 "View Source") GenLSP.Structures.DocumentDiagnosticParams (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================= Parameters of the document diagnostic request. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentDiagnosticParams{}](#__struct__/0) Fields ------ * text\_document: The text document. * identifier: The additional identifier provided during registration. * previous\_result\_id: The result id of a previous response if provided. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_diagnostic_params.ex#L24 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentDiagnosticParams{ identifier: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, previous_result_id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentDiagnosticParams{} ============================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_diagnostic_params.ex#L24 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * text\_document: The text document. * identifier: The additional identifier provided during registration. * previous\_result\_id: The result id of a previous response if provided. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. GenLSP.Structures.DocumentDiagnosticReportPartialResult β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_diagnostic_report_partial_result.ex#L2 "View Source") GenLSP.Structures.DocumentDiagnosticReportPartialResult (gen\_lsp v0.6.0) ===================================================================================================================================================================================================================================================== A partial result for a document diagnostic report. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentDiagnosticReportPartialResult{}](#__struct__/0) Fields ------ * related\_documents [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_diagnostic_report_partial_result.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentDiagnosticReportPartialResult{ related_documents: %{ required([GenLSP.BaseTypes.document\_uri](GenLSP.BaseTypes.html#t:document_uri/0)()) => [GenLSP.Structures.FullDocumentDiagnosticReport.t](GenLSP.Structures.FullDocumentDiagnosticReport.html#t:t/0)() | [GenLSP.Structures.UnchangedDocumentDiagnosticReport.t](GenLSP.Structures.UnchangedDocumentDiagnosticReport.html#t:t/0)() } } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentDiagnosticReportPartialResult{} ========================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_diagnostic_report_partial_result.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * related\_documents GenLSP.Structures.DocumentFormattingClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_formatting_client_capabilities.ex#L2 "View Source") GenLSP.Structures.DocumentFormattingClientCapabilities (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================================== Client capabilities of a {@link DocumentFormattingRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentFormattingClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether formatting supports dynamic registration. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_formatting_client_capabilities.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentFormattingClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentFormattingClientCapabilities{} ========================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_formatting_client_capabilities.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether formatting supports dynamic registration. GenLSP.Structures.DocumentFormattingOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_formatting_options.ex#L2 "View Source") GenLSP.Structures.DocumentFormattingOptions (gen\_lsp v0.6.0) =========================================================================================================================================================================================================================== Provider options for a {@link DocumentFormattingRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentFormattingOptions{}](#__struct__/0) Fields ------ * work\_done\_progress [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_formatting_options.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentFormattingOptions{ work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentFormattingOptions{} ============================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_formatting_options.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_progress GenLSP.Structures.DocumentFormattingParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_formatting_params.ex#L2 "View Source") GenLSP.Structures.DocumentFormattingParams (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================= The parameters of a {@link DocumentFormattingRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentFormattingParams{}](#__struct__/0) Fields ------ * text\_document: The document to format. * options: The format options. * work\_done\_token: An optional token that a server can use to report work done progress. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_formatting_params.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentFormattingParams{ options: [GenLSP.Structures.FormattingOptions.t](GenLSP.Structures.FormattingOptions.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentFormattingParams{} ============================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_formatting_params.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * text\_document: The document to format. * options: The format options. * work\_done\_token: An optional token that a server can use to report work done progress. GenLSP.Structures.DocumentFormattingRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_formatting_registration_options.ex#L2 "View Source") GenLSP.Structures.DocumentFormattingRegistrationOptions (gen\_lsp v0.6.0) ==================================================================================================================================================================================================================================================== Registration options for a {@link DocumentFormattingRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentFormattingRegistrationOptions{}](#__struct__/0) Fields ------ * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_formatting_registration_options.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentFormattingRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentFormattingRegistrationOptions{} ========================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_formatting_registration_options.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. GenLSP.Structures.DocumentHighlight β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_highlight.ex#L2 "View Source") GenLSP.Structures.DocumentHighlight (gen\_lsp v0.6.0) ========================================================================================================================================================================================================== A document highlight is a range inside a text document which deserves special attention. Usually a document highlight is visualized by changing the background color of its range. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentHighlight{}](#__struct__/0) Fields ------ * range: The range this highlight applies to. * kind: The highlight kind, default is {@link DocumentHighlightKind.Text text}. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_highlight.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentHighlight{ kind: [GenLSP.Enumerations.DocumentHighlightKind.t](GenLSP.Enumerations.DocumentHighlightKind.html#t:t/0)() | nil, range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentHighlight{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_highlight.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * range: The range this highlight applies to. * kind: The highlight kind, default is {@link DocumentHighlightKind.Text text}. GenLSP.Structures.DocumentHighlightClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_highlight_client_capabilities.ex#L2 "View Source") GenLSP.Structures.DocumentHighlightClientCapabilities (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================================ Client Capabilities for a {@link DocumentHighlightRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentHighlightClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether document highlight supports dynamic registration. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_highlight_client_capabilities.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentHighlightClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentHighlightClientCapabilities{} ======================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_highlight_client_capabilities.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether document highlight supports dynamic registration. GenLSP.Structures.DocumentHighlightOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_highlight_options.ex#L2 "View Source") GenLSP.Structures.DocumentHighlightOptions (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================= Provider options for a {@link DocumentHighlightRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentHighlightOptions{}](#__struct__/0) Fields ------ * work\_done\_progress [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_highlight_options.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentHighlightOptions{ work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentHighlightOptions{} ============================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_highlight_options.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_progress GenLSP.Structures.DocumentHighlightParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_highlight_params.ex#L2 "View Source") GenLSP.Structures.DocumentHighlightParams (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================= Parameters for a {@link DocumentHighlightRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentHighlightParams{}](#__struct__/0) Fields ------ * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. * text\_document: The text document. * position: The position inside the text document. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_highlight_params.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentHighlightParams{ partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, position: [GenLSP.Structures.Position.t](GenLSP.Structures.Position.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentHighlightParams{} ============================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_highlight_params.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. * text\_document: The text document. * position: The position inside the text document. GenLSP.Structures.DocumentHighlightRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_highlight_registration_options.ex#L2 "View Source") GenLSP.Structures.DocumentHighlightRegistrationOptions (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================================== Registration options for a {@link DocumentHighlightRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentHighlightRegistrationOptions{}](#__struct__/0) Fields ------ * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_highlight_registration_options.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentHighlightRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentHighlightRegistrationOptions{} ========================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_highlight_registration_options.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. GenLSP.Structures.DocumentLink β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_link.ex#L2 "View Source") GenLSP.Structures.DocumentLink (gen\_lsp v0.6.0) ================================================================================================================================================================================================ A document link is a range in a text document that links to an internal or external resource, like another text document or a web site. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentLink{}](#__struct__/0) Fields ------ * range: The range this link applies to. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_link.ex#L28 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentLink{ data: [GenLSP.TypeAlias.LSPAny.t](GenLSP.TypeAlias.LSPAny.html#t:t/0)() | nil, range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)(), target: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, tooltip: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentLink{} ================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_link.ex#L28 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * range: The range this link applies to. * target: The uri this link points to. If missing a resolve request is sent later. * tooltip: The tooltip text when you hover over this link. If a tooltip is provided, is will be displayed in a string that includes instructions on how to trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS, user settings, and localization. @since 3.15.0 * data: A data entry field that is preserved on a document link between a DocumentLinkRequest and a DocumentLinkResolveRequest. GenLSP.Structures.DocumentLinkClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_link_client_capabilities.ex#L2 "View Source") GenLSP.Structures.DocumentLinkClientCapabilities (gen\_lsp v0.6.0) ====================================================================================================================================================================================================================================== The client capabilities of a {@link DocumentLinkRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentLinkClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether document link supports dynamic registration. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_link_client_capabilities.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentLinkClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, tooltip_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentLinkClientCapabilities{} =================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_link_client_capabilities.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether document link supports dynamic registration. * tooltip\_support: Whether the client supports the `tooltip` property on `DocumentLink`. @since 3.15.0 GenLSP.Structures.DocumentLinkOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_link_options.ex#L2 "View Source") GenLSP.Structures.DocumentLinkOptions (gen\_lsp v0.6.0) =============================================================================================================================================================================================================== Provider options for a {@link DocumentLinkRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentLinkOptions{}](#__struct__/0) Fields ------ * resolve\_provider: Document links have a resolve provider as well. * work\_done\_progress [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_link_options.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentLinkOptions{ resolve_provider: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentLinkOptions{} ======================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_link_options.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * resolve\_provider: Document links have a resolve provider as well. * work\_done\_progress GenLSP.Structures.DocumentLinkParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_link_params.ex#L2 "View Source") GenLSP.Structures.DocumentLinkParams (gen\_lsp v0.6.0) ============================================================================================================================================================================================================= The parameters of a {@link DocumentLinkRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentLinkParams{}](#__struct__/0) Fields ------ * text\_document: The document to provide document links for. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_link_params.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentLinkParams{ partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentLinkParams{} ======================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_link_params.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * text\_document: The document to provide document links for. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. GenLSP.Structures.DocumentLinkRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_link_registration_options.ex#L2 "View Source") GenLSP.Structures.DocumentLinkRegistrationOptions (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================================== Registration options for a {@link DocumentLinkRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentLinkRegistrationOptions{}](#__struct__/0) Fields ------ * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. * resolve\_provider: Document links have a resolve provider as well. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_link_registration_options.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentLinkRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil, resolve_provider: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentLinkRegistrationOptions{} ==================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_link_registration_options.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. * resolve\_provider: Document links have a resolve provider as well. GenLSP.Structures.DocumentOnTypeFormattingClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_on_type_formatting_client_capabilities.ex#L2 "View Source") GenLSP.Structures.DocumentOnTypeFormattingClientCapabilities (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================================================ Client capabilities of a {@link DocumentOnTypeFormattingRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentOnTypeFormattingClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether on type formatting supports dynamic registration. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_on_type_formatting_client_capabilities.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentOnTypeFormattingClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentOnTypeFormattingClientCapabilities{} =============================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_on_type_formatting_client_capabilities.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether on type formatting supports dynamic registration. GenLSP.Structures.DocumentOnTypeFormattingOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_on_type_formatting_options.ex#L2 "View Source") GenLSP.Structures.DocumentOnTypeFormattingOptions (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================================= Provider options for a {@link DocumentOnTypeFormattingRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentOnTypeFormattingOptions{}](#__struct__/0) Fields ------ * first\_trigger\_character: A character on which formatting should be triggered, like `{`. * more\_trigger\_character: More trigger characters. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_on_type_formatting_options.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentOnTypeFormattingOptions{ first_trigger_character: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), more_trigger_character: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentOnTypeFormattingOptions{} ==================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_on_type_formatting_options.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * first\_trigger\_character: A character on which formatting should be triggered, like `{`. * more\_trigger\_character: More trigger characters. GenLSP.Structures.DocumentOnTypeFormattingParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_on_type_formatting_params.ex#L2 "View Source") GenLSP.Structures.DocumentOnTypeFormattingParams (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================================= The parameters of a {@link DocumentOnTypeFormattingRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentOnTypeFormattingParams{}](#__struct__/0) Fields ------ * text\_document: The document to format. * position: The position around which the on type formatting should happen. This is not necessarily the exact position where the character denoted by the property `ch` got typed. * ch: The character that has been typed that triggered the formatting on type request. That is not necessarily the last character that got inserted into the document since the client could auto insert characters as well (e.g. like automatic brace completion). * options: The formatting options. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_on_type_formatting_params.ex#L25 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentOnTypeFormattingParams{ ch: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), options: [GenLSP.Structures.FormattingOptions.t](GenLSP.Structures.FormattingOptions.html#t:t/0)(), position: [GenLSP.Structures.Position.t](GenLSP.Structures.Position.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentOnTypeFormattingParams{} =================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_on_type_formatting_params.ex#L25 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * text\_document: The document to format. * position: The position around which the on type formatting should happen. This is not necessarily the exact position where the character denoted by the property `ch` got typed. * ch: The character that has been typed that triggered the formatting on type request. That is not necessarily the last character that got inserted into the document since the client could auto insert characters as well (e.g. like automatic brace completion). * options: The formatting options. GenLSP.Structures.DocumentOnTypeFormattingRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_on_type_formatting_registration_options.ex#L2 "View Source") GenLSP.Structures.DocumentOnTypeFormattingRegistrationOptions (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================================================== Registration options for a {@link DocumentOnTypeFormattingRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentOnTypeFormattingRegistrationOptions{}](#__struct__/0) Fields ------ * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. * first\_trigger\_character: A character on which formatting should be triggered, like `{`. * more\_trigger\_character: More trigger characters. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_on_type_formatting_registration_options.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentOnTypeFormattingRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil, first_trigger_character: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), more_trigger_character: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentOnTypeFormattingRegistrationOptions{} ================================================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_on_type_formatting_registration_options.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. * first\_trigger\_character: A character on which formatting should be triggered, like `{`. * more\_trigger\_character: More trigger characters. GenLSP.Structures.DocumentRangeFormattingClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_range_formatting_client_capabilities.ex#L2 "View Source") GenLSP.Structures.DocumentRangeFormattingClientCapabilities (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================================================= Client capabilities of a {@link DocumentRangeFormattingRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentRangeFormattingClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether range formatting supports dynamic registration. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_range_formatting_client_capabilities.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentRangeFormattingClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentRangeFormattingClientCapabilities{} ============================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_range_formatting_client_capabilities.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether range formatting supports dynamic registration. GenLSP.Structures.DocumentRangeFormattingOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_range_formatting_options.ex#L2 "View Source") GenLSP.Structures.DocumentRangeFormattingOptions (gen\_lsp v0.6.0) ====================================================================================================================================================================================================================================== Provider options for a {@link DocumentRangeFormattingRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentRangeFormattingOptions{}](#__struct__/0) Fields ------ * work\_done\_progress [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_range_formatting_options.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentRangeFormattingOptions{ work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentRangeFormattingOptions{} =================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_range_formatting_options.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_progress GenLSP.Structures.DocumentRangeFormattingParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_range_formatting_params.ex#L2 "View Source") GenLSP.Structures.DocumentRangeFormattingParams (gen\_lsp v0.6.0) ==================================================================================================================================================================================================================================== The parameters of a {@link DocumentRangeFormattingRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentRangeFormattingParams{}](#__struct__/0) Fields ------ * text\_document: The document to format. * range: The range to format * options: The format options * work\_done\_token: An optional token that a server can use to report work done progress. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_range_formatting_params.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentRangeFormattingParams{ options: [GenLSP.Structures.FormattingOptions.t](GenLSP.Structures.FormattingOptions.html#t:t/0)(), range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentRangeFormattingParams{} ================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_range_formatting_params.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * text\_document: The document to format. * range: The range to format * options: The format options * work\_done\_token: An optional token that a server can use to report work done progress. GenLSP.Structures.DocumentRangeFormattingRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_range_formatting_registration_options.ex#L2 "View Source") GenLSP.Structures.DocumentRangeFormattingRegistrationOptions (gen\_lsp v0.6.0) =============================================================================================================================================================================================================================================================== Registration options for a {@link DocumentRangeFormattingRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentRangeFormattingRegistrationOptions{}](#__struct__/0) Fields ------ * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_range_formatting_registration_options.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentRangeFormattingRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentRangeFormattingRegistrationOptions{} =============================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_range_formatting_registration_options.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. GenLSP.Structures.DocumentSymbol β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_symbol.ex#L2 "View Source") GenLSP.Structures.DocumentSymbol (gen\_lsp v0.6.0) ==================================================================================================================================================================================================== Represents programming constructs like variables, classes, interfaces etc. that appear in a document. Document symbols can be hierarchical and they have two ranges: one that encloses its definition and one that points to its most interesting range, e.g. the range of an identifier. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentSymbol{}](#__struct__/0) Fields ------ * name: The name of this symbol. Will be displayed in the user interface and therefore must not be an empty string or a string only consisting of white spaces. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_symbol.ex#L35 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentSymbol{ children: [[t](#t:t/0)()] | nil, deprecated: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, detail: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, kind: [GenLSP.Enumerations.SymbolKind.t](GenLSP.Enumerations.SymbolKind.html#t:t/0)(), name: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)(), selection_range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)(), tags: [[GenLSP.Enumerations.SymbolTag.t](GenLSP.Enumerations.SymbolTag.html#t:t/0)()] | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentSymbol{} =================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_symbol.ex#L35 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * name: The name of this symbol. Will be displayed in the user interface and therefore must not be an empty string or a string only consisting of white spaces. * detail: More detail for this symbol, e.g the signature of a function. * kind: The kind of this symbol. * tags: Tags for this document symbol. @since 3.16.0 * deprecated: Indicates if this symbol is deprecated. @deprecated Use tags instead * range: The range enclosing this symbol not including leading/trailing whitespace but everything else like comments. This information is typically used to determine if the clients cursor is inside the symbol to reveal in the symbol in the UI. * selection\_range: The range that should be selected and revealed when this symbol is being picked, e.g the name of a function. Must be contained by the `range`. * children: Children of this symbol, e.g. properties of a class. GenLSP.Structures.DocumentSymbolClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_symbol_client_capabilities.ex#L2 "View Source") GenLSP.Structures.DocumentSymbolClientCapabilities (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================================== Client Capabilities for a {@link DocumentSymbolRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentSymbolClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether document symbol supports dynamic registration. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_symbol_client_capabilities.ex#L29 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentSymbolClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, hierarchical_document_symbol_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, label_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, symbol_kind: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil, tag_support: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentSymbolClientCapabilities{} ===================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_symbol_client_capabilities.ex#L29 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether document symbol supports dynamic registration. * symbol\_kind: Specific capabilities for the `SymbolKind` in the `textDocument/documentSymbol` request. * hierarchical\_document\_symbol\_support: The client supports hierarchical document symbols. * tag\_support: The client supports tags on `SymbolInformation`. Tags are supported on `DocumentSymbol` if `hierarchicalDocumentSymbolSupport` is set to true. Clients supporting tags have to handle unknown tags gracefully. @since 3.16.0 * label\_support: The client supports an additional label presented in the UI when registering a document symbol provider. @since 3.16.0 GenLSP.Structures.DocumentSymbolOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_symbol_options.ex#L2 "View Source") GenLSP.Structures.DocumentSymbolOptions (gen\_lsp v0.6.0) =================================================================================================================================================================================================================== Provider options for a {@link DocumentSymbolRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentSymbolOptions{}](#__struct__/0) Fields ------ * label: A human-readable string that is shown when multiple outlines trees are shown for the same document. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_symbol_options.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentSymbolOptions{ label: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentSymbolOptions{} ========================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_symbol_options.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * label: A human-readable string that is shown when multiple outlines trees are shown for the same document. @since 3.16.0 * work\_done\_progress GenLSP.Structures.DocumentSymbolParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_symbol_params.ex#L2 "View Source") GenLSP.Structures.DocumentSymbolParams (gen\_lsp v0.6.0) ================================================================================================================================================================================================================= Parameters for a {@link DocumentSymbolRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentSymbolParams{}](#__struct__/0) Fields ------ * text\_document: The text document. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_symbol_params.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentSymbolParams{ partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentSymbolParams{} ========================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_symbol_params.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * text\_document: The text document. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. GenLSP.Structures.DocumentSymbolRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_symbol_registration_options.ex#L2 "View Source") GenLSP.Structures.DocumentSymbolRegistrationOptions (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================================ Registration options for a {@link DocumentSymbolRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.DocumentSymbolRegistrationOptions{}](#__struct__/0) Fields ------ * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_symbol_registration_options.ex#L22 "View Source") ``` @type t() :: %GenLSP.Structures.DocumentSymbolRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil, label: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.DocumentSymbolRegistrationOptions{} ====================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/document_symbol_registration_options.ex#L22 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. * label: A human-readable string that is shown when multiple outlines trees are shown for the same document. @since 3.16.0 GenLSP.Structures.ExecuteCommandClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/execute_command_client_capabilities.ex#L2 "View Source") GenLSP.Structures.ExecuteCommandClientCapabilities (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================================== The client capabilities of a {@link ExecuteCommandRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ExecuteCommandClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Execute command supports dynamic registration. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/execute_command_client_capabilities.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.ExecuteCommandClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ExecuteCommandClientCapabilities{} ===================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/execute_command_client_capabilities.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Execute command supports dynamic registration. GenLSP.Structures.ExecuteCommandOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/execute_command_options.ex#L2 "View Source") GenLSP.Structures.ExecuteCommandOptions (gen\_lsp v0.6.0) =================================================================================================================================================================================================================== The server capabilities of a {@link ExecuteCommandRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ExecuteCommandOptions{}](#__struct__/0) Fields ------ * commands: The commands to be executed on the server * work\_done\_progress [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/execute_command_options.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.ExecuteCommandOptions{ commands: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()], work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ExecuteCommandOptions{} ========================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/execute_command_options.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * commands: The commands to be executed on the server * work\_done\_progress GenLSP.Structures.ExecuteCommandParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/execute_command_params.ex#L2 "View Source") GenLSP.Structures.ExecuteCommandParams (gen\_lsp v0.6.0) ================================================================================================================================================================================================================= The parameters of a {@link ExecuteCommandRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ExecuteCommandParams{}](#__struct__/0) Fields ------ * command: The identifier of the actual command handler. * arguments: Arguments that the command should be invoked with. * work\_done\_token: An optional token that a server can use to report work done progress. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/execute_command_params.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.ExecuteCommandParams{ arguments: [[GenLSP.TypeAlias.LSPAny.t](GenLSP.TypeAlias.LSPAny.html#t:t/0)()] | nil, command: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ExecuteCommandParams{} ========================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/execute_command_params.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * command: The identifier of the actual command handler. * arguments: Arguments that the command should be invoked with. * work\_done\_token: An optional token that a server can use to report work done progress. GenLSP.Structures.ExecuteCommandRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/execute_command_registration_options.ex#L2 "View Source") GenLSP.Structures.ExecuteCommandRegistrationOptions (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================================ Registration options for a {@link ExecuteCommandRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ExecuteCommandRegistrationOptions{}](#__struct__/0) Fields ------ * commands: The commands to be executed on the server [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/execute_command_registration_options.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.ExecuteCommandRegistrationOptions{ commands: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ExecuteCommandRegistrationOptions{} ====================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/execute_command_registration_options.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * commands: The commands to be executed on the server GenLSP.Structures.ExecutionSummary β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/execution_summary.ex#L2 "View Source") GenLSP.Structures.ExecutionSummary (gen\_lsp v0.6.0) ======================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ExecutionSummary{}](#__struct__/0) Fields ------ * execution\_order: A strict monotonically increasing value indicating the execution order of a cell inside a notebook. * success: Whether the execution was successful or not if known by the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/execution_summary.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.ExecutionSummary{ execution_order: [GenLSP.BaseTypes.uinteger](GenLSP.BaseTypes.html#t:uinteger/0)(), success: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ExecutionSummary{} ===================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/execution_summary.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * execution\_order: A strict monotonically increasing value indicating the execution order of a cell inside a notebook. * success: Whether the execution was successful or not if known by the client. GenLSP.Structures.FileCreate β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_create.ex#L2 "View Source") GenLSP.Structures.FileCreate (gen\_lsp v0.6.0) ============================================================================================================================================================================================ Represents information on a file/folder create. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.FileCreate{}](#__struct__/0) Fields ------ * uri: A file:// URI for the location of the file/folder being created. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_create.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.FileCreate{uri: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.FileCreate{} =============================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_create.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * uri: A file:// URI for the location of the file/folder being created. GenLSP.Structures.FileDelete β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_delete.ex#L2 "View Source") GenLSP.Structures.FileDelete (gen\_lsp v0.6.0) ============================================================================================================================================================================================ Represents information on a file/folder delete. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.FileDelete{}](#__struct__/0) Fields ------ * uri: A file:// URI for the location of the file/folder being deleted. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_delete.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.FileDelete{uri: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.FileDelete{} =============================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_delete.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * uri: A file:// URI for the location of the file/folder being deleted. GenLSP.Structures.FileEvent β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_event.ex#L2 "View Source") GenLSP.Structures.FileEvent (gen\_lsp v0.6.0) ========================================================================================================================================================================================== An event describing a file change. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.FileEvent{}](#__struct__/0) Fields ------ * uri: The file's uri. * type: The change type. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_event.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.FileEvent{ type: [GenLSP.Enumerations.FileChangeType.t](GenLSP.Enumerations.FileChangeType.html#t:t/0)(), uri: [GenLSP.BaseTypes.document\_uri](GenLSP.BaseTypes.html#t:document_uri/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.FileEvent{} ============================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_event.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * uri: The file's uri. * type: The change type. GenLSP.Structures.FileOperationClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_operation_client_capabilities.ex#L2 "View Source") GenLSP.Structures.FileOperationClientCapabilities (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================================== Capabilities relating to events from file operations by the user in the client. These events do not come from the file system, they come from user operations like renaming a file in the UI. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.FileOperationClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether the client supports dynamic registration for file requests/notifications. * did\_create: The client has support for sending didCreateFiles notifications. * will\_create: The client has support for sending willCreateFiles requests. * did\_rename: The client has support for sending didRenameFiles notifications. * will\_rename: The client has support for sending willRenameFiles requests. * did\_delete: The client has support for sending didDeleteFiles notifications. * will\_delete: The client has support for sending willDeleteFiles requests. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_operation_client_capabilities.ex#L28 "View Source") ``` @type t() :: %GenLSP.Structures.FileOperationClientCapabilities{ did_create: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, did_delete: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, did_rename: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, will_create: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, will_delete: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, will_rename: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.FileOperationClientCapabilities{} ==================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_operation_client_capabilities.ex#L28 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether the client supports dynamic registration for file requests/notifications. * did\_create: The client has support for sending didCreateFiles notifications. * will\_create: The client has support for sending willCreateFiles requests. * did\_rename: The client has support for sending didRenameFiles notifications. * will\_rename: The client has support for sending willRenameFiles requests. * did\_delete: The client has support for sending didDeleteFiles notifications. * will\_delete: The client has support for sending willDeleteFiles requests. GenLSP.Structures.FileOperationFilter β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_operation_filter.ex#L2 "View Source") GenLSP.Structures.FileOperationFilter (gen\_lsp v0.6.0) =============================================================================================================================================================================================================== A filter to describe in which file operation requests or notifications the server is interested in receiving. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.FileOperationFilter{}](#__struct__/0) Fields ------ * scheme: A Uri scheme like `file` or `untitled`. * pattern: The actual file operation pattern. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_operation_filter.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.FileOperationFilter{ pattern: [GenLSP.Structures.FileOperationPattern.t](GenLSP.Structures.FileOperationPattern.html#t:t/0)(), scheme: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.FileOperationFilter{} ======================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_operation_filter.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * scheme: A Uri scheme like `file` or `untitled`. * pattern: The actual file operation pattern. GenLSP.Structures.FileOperationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_operation_options.ex#L2 "View Source") GenLSP.Structures.FileOperationOptions (gen\_lsp v0.6.0) ================================================================================================================================================================================================================= Options for notifications/requests for user operations on files. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.FileOperationOptions{}](#__struct__/0) Fields ------ * did\_create: The server is interested in receiving didCreateFiles notifications. * will\_create: The server is interested in receiving willCreateFiles requests. * did\_rename: The server is interested in receiving didRenameFiles notifications. * will\_rename: The server is interested in receiving willRenameFiles requests. * did\_delete: The server is interested in receiving didDeleteFiles file notifications. * will\_delete: The server is interested in receiving willDeleteFiles file requests. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_operation_options.ex#L24 "View Source") ``` @type t() :: %GenLSP.Structures.FileOperationOptions{ did_create: [GenLSP.Structures.FileOperationRegistrationOptions.t](GenLSP.Structures.FileOperationRegistrationOptions.html#t:t/0)() | nil, did_delete: [GenLSP.Structures.FileOperationRegistrationOptions.t](GenLSP.Structures.FileOperationRegistrationOptions.html#t:t/0)() | nil, did_rename: [GenLSP.Structures.FileOperationRegistrationOptions.t](GenLSP.Structures.FileOperationRegistrationOptions.html#t:t/0)() | nil, will_create: [GenLSP.Structures.FileOperationRegistrationOptions.t](GenLSP.Structures.FileOperationRegistrationOptions.html#t:t/0)() | nil, will_delete: [GenLSP.Structures.FileOperationRegistrationOptions.t](GenLSP.Structures.FileOperationRegistrationOptions.html#t:t/0)() | nil, will_rename: [GenLSP.Structures.FileOperationRegistrationOptions.t](GenLSP.Structures.FileOperationRegistrationOptions.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.FileOperationOptions{} ========================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_operation_options.ex#L24 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * did\_create: The server is interested in receiving didCreateFiles notifications. * will\_create: The server is interested in receiving willCreateFiles requests. * did\_rename: The server is interested in receiving didRenameFiles notifications. * will\_rename: The server is interested in receiving willRenameFiles requests. * did\_delete: The server is interested in receiving didDeleteFiles file notifications. * will\_delete: The server is interested in receiving willDeleteFiles file requests. GenLSP.Structures.FileOperationPattern β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_operation_pattern.ex#L2 "View Source") GenLSP.Structures.FileOperationPattern (gen\_lsp v0.6.0) ================================================================================================================================================================================================================= A pattern to describe in which file operation requests or notifications the server is interested in receiving. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.FileOperationPattern{}](#__struct__/0) Fields ------ * glob: The glob pattern to match. Glob patterns can have the following syntax [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_operation_pattern.ex#L30 "View Source") ``` @type t() :: %GenLSP.Structures.FileOperationPattern{ glob: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), matches: [GenLSP.Enumerations.FileOperationPatternKind.t](GenLSP.Enumerations.FileOperationPatternKind.html#t:t/0)() | nil, options: [GenLSP.Structures.FileOperationPatternOptions.t](GenLSP.Structures.FileOperationPatternOptions.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.FileOperationPattern{} ========================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_operation_pattern.ex#L30 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * glob: The glob pattern to match. Glob patterns can have the following syntax: + `*` to match one or more characters in a path segment + `?` to match on one character in a path segment + `**` to match any number of path segments, including none + `{}` to group sub patterns into an OR expression. (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files) + `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) + `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) * matches: Whether to match files or folders with this pattern. Matches both if undefined. * options: Additional options used during matching. GenLSP.Structures.FileOperationPatternOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_operation_pattern_options.ex#L2 "View Source") GenLSP.Structures.FileOperationPatternOptions (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================ Matching options for the file operation pattern. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.FileOperationPatternOptions{}](#__struct__/0) Fields ------ * ignore\_case: The pattern should be matched ignoring casing. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_operation_pattern_options.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.FileOperationPatternOptions{ ignore_case: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.FileOperationPatternOptions{} ================================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_operation_pattern_options.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * ignore\_case: The pattern should be matched ignoring casing. GenLSP.Structures.FileOperationRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_operation_registration_options.ex#L2 "View Source") GenLSP.Structures.FileOperationRegistrationOptions (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================================== The options to register for file operations. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.FileOperationRegistrationOptions{}](#__struct__/0) Fields ------ * filters: The actual filters. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_operation_registration_options.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.FileOperationRegistrationOptions{ filters: [[GenLSP.Structures.FileOperationFilter.t](GenLSP.Structures.FileOperationFilter.html#t:t/0)()] } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.FileOperationRegistrationOptions{} ===================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_operation_registration_options.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * filters: The actual filters. GenLSP.Structures.FileRename β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_rename.ex#L2 "View Source") GenLSP.Structures.FileRename (gen\_lsp v0.6.0) ============================================================================================================================================================================================ Represents information on a file/folder rename. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.FileRename{}](#__struct__/0) Fields ------ * old\_uri: A file:// URI for the original location of the file/folder being renamed. * new\_uri: A file:// URI for the new location of the file/folder being renamed. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_rename.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.FileRename{new_uri: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), old_uri: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.FileRename{} =============================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_rename.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * old\_uri: A file:// URI for the original location of the file/folder being renamed. * new\_uri: A file:// URI for the new location of the file/folder being renamed. GenLSP.Structures.FileSystemWatcher β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_system_watcher.ex#L2 "View Source") GenLSP.Structures.FileSystemWatcher (gen\_lsp v0.6.0) =========================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.FileSystemWatcher{}](#__struct__/0) Fields ------ * glob\_pattern: The glob pattern to watch. See {@link GlobPattern glob pattern} for more detail. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_system_watcher.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.FileSystemWatcher{ glob_pattern: [GenLSP.TypeAlias.GlobPattern.t](GenLSP.TypeAlias.GlobPattern.html#t:t/0)(), kind: [GenLSP.Enumerations.WatchKind.t](GenLSP.Enumerations.WatchKind.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.FileSystemWatcher{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/file_system_watcher.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * glob\_pattern: The glob pattern to watch. See {@link GlobPattern glob pattern} for more detail. @since 3.17.0 support for relative patterns. * kind: The kind of events of interest. If omitted it defaults to WatchKind.Create | WatchKind.Change | WatchKind.Delete which is 7. GenLSP.Structures.FoldingRange β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/folding_range.ex#L2 "View Source") GenLSP.Structures.FoldingRange (gen\_lsp v0.6.0) ================================================================================================================================================================================================ Represents a folding range. To be valid, start and end line must be bigger than zero and smaller than the number of lines in the document. Clients are free to ignore invalid ranges. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.FoldingRange{}](#__struct__/0) Fields ------ * start\_line: The zero-based start line of the range to fold. The folded area starts after the line's last character. To be valid, the end must be zero or larger and smaller than the number of lines in the document. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/folding_range.ex#L31 "View Source") ``` @type t() :: %GenLSP.Structures.FoldingRange{ collapsed_text: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, end_character: [GenLSP.BaseTypes.uinteger](GenLSP.BaseTypes.html#t:uinteger/0)() | nil, end_line: [GenLSP.BaseTypes.uinteger](GenLSP.BaseTypes.html#t:uinteger/0)(), kind: [GenLSP.Enumerations.FoldingRangeKind.t](GenLSP.Enumerations.FoldingRangeKind.html#t:t/0)() | nil, start_character: [GenLSP.BaseTypes.uinteger](GenLSP.BaseTypes.html#t:uinteger/0)() | nil, start_line: [GenLSP.BaseTypes.uinteger](GenLSP.BaseTypes.html#t:uinteger/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.FoldingRange{} ================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/folding_range.ex#L31 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * start\_line: The zero-based start line of the range to fold. The folded area starts after the line's last character. To be valid, the end must be zero or larger and smaller than the number of lines in the document. * start\_character: The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line. * end\_line: The zero-based end line of the range to fold. The folded area ends with the line's last character. To be valid, the end must be zero or larger and smaller than the number of lines in the document. * end\_character: The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line. * kind: Describes the kind of the folding range such as 'comment' or 'region'. The kind is used to categorize folding ranges and used by commands like 'Fold all comments'. See {@link FoldingRangeKind} for an enumeration of standardized kinds. * collapsed\_text: The text that the client should show when the specified range is collapsed. If not defined or not supported by the client, a default will be chosen by the client. @since 3.17.0 GenLSP.Structures.FoldingRangeClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/folding_range_client_capabilities.ex#L2 "View Source") GenLSP.Structures.FoldingRangeClientCapabilities (gen\_lsp v0.6.0) ====================================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.FoldingRangeClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether implementation supports dynamic registration for folding range providers. If this is set to `true` the client supports the new `FoldingRangeRegistrationOptions` return value for the corresponding server capability as well. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/folding_range_client_capabilities.ex#L28 "View Source") ``` @type t() :: %GenLSP.Structures.FoldingRangeClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, folding_range: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil, folding_range_kind: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil, line_folding_only: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, range_limit: [GenLSP.BaseTypes.uinteger](GenLSP.BaseTypes.html#t:uinteger/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.FoldingRangeClientCapabilities{} =================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/folding_range_client_capabilities.ex#L28 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether implementation supports dynamic registration for folding range providers. If this is set to `true` the client supports the new `FoldingRangeRegistrationOptions` return value for the corresponding server capability as well. * range\_limit: The maximum number of folding ranges that the client prefers to receive per document. The value serves as a hint, servers are free to follow the limit. * line\_folding\_only: If set, the client signals that it only supports folding complete lines. If set, client will ignore specified `startCharacter` and `endCharacter` properties in a FoldingRange. * folding\_range\_kind: Specific options for the folding range kind. @since 3.17.0 * folding\_range: Specific options for the folding range. @since 3.17.0 GenLSP.Structures.FoldingRangeOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/folding_range_options.ex#L2 "View Source") GenLSP.Structures.FoldingRangeOptions (gen\_lsp v0.6.0) =============================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.FoldingRangeOptions{}](#__struct__/0) Fields ------ * work\_done\_progress [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/folding_range_options.ex#L13 "View Source") ``` @type t() :: %GenLSP.Structures.FoldingRangeOptions{ work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.FoldingRangeOptions{} ======================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/folding_range_options.ex#L13 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_progress GenLSP.Structures.FoldingRangeParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/folding_range_params.ex#L2 "View Source") GenLSP.Structures.FoldingRangeParams (gen\_lsp v0.6.0) ============================================================================================================================================================================================================= Parameters for a {@link FoldingRangeRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.FoldingRangeParams{}](#__struct__/0) Fields ------ * text\_document: The text document. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/folding_range_params.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.FoldingRangeParams{ partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.FoldingRangeParams{} ======================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/folding_range_params.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * text\_document: The text document. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. GenLSP.Structures.FoldingRangeRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/folding_range_registration_options.ex#L2 "View Source") GenLSP.Structures.FoldingRangeRegistrationOptions (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.FoldingRangeRegistrationOptions{}](#__struct__/0) Fields ------ * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/folding_range_registration_options.ex#L16 "View Source") ``` @type t() :: %GenLSP.Structures.FoldingRangeRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil, id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.FoldingRangeRegistrationOptions{} ==================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/folding_range_registration_options.ex#L16 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. GenLSP.Structures.FormattingOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/formatting_options.ex#L2 "View Source") GenLSP.Structures.FormattingOptions (gen\_lsp v0.6.0) ========================================================================================================================================================================================================== Value-object describing what options formatting should use. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.FormattingOptions{}](#__struct__/0) Fields ------ * tab\_size: Size of a tab in spaces. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/formatting_options.ex#L27 "View Source") ``` @type t() :: %GenLSP.Structures.FormattingOptions{ insert_final_newline: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, insert_spaces: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), tab_size: [GenLSP.BaseTypes.uinteger](GenLSP.BaseTypes.html#t:uinteger/0)(), trim_final_newlines: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, trim_trailing_whitespace: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.FormattingOptions{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/formatting_options.ex#L27 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * tab\_size: Size of a tab in spaces. * insert\_spaces: Prefer spaces over tabs. * trim\_trailing\_whitespace: Trim trailing whitespace on a line. @since 3.15.0 * insert\_final\_newline: Insert a newline character at the end of the file if one does not exist. @since 3.15.0 * trim\_final\_newlines: Trim all newlines after the final newline at the end of the file. @since 3.15.0 GenLSP.Structures.FullDocumentDiagnosticReport β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/full_document_diagnostic_report.ex#L2 "View Source") GenLSP.Structures.FullDocumentDiagnosticReport (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================== A diagnostic report with a full set of problems. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.FullDocumentDiagnosticReport{}](#__struct__/0) Fields ------ * kind: A full document diagnostic report. * result\_id: An optional result id. If provided it will be sent on the next diagnostic request for the same document. * items: The actual items. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/full_document_diagnostic_report.ex#L23 "View Source") ``` @type t() :: %GenLSP.Structures.FullDocumentDiagnosticReport{ items: [[GenLSP.Structures.Diagnostic.t](GenLSP.Structures.Diagnostic.html#t:t/0)()], kind: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), result_id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.FullDocumentDiagnosticReport{} ================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/full_document_diagnostic_report.ex#L23 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * kind: A full document diagnostic report. * result\_id: An optional result id. If provided it will be sent on the next diagnostic request for the same document. * items: The actual items. GenLSP.Structures.GeneralClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/general_client_capabilities.ex#L2 "View Source") GenLSP.Structures.GeneralClientCapabilities (gen\_lsp v0.6.0) =========================================================================================================================================================================================================================== General client capabilities. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.GeneralClientCapabilities{}](#__struct__/0) Fields ------ * stale\_request\_support: Client capability that signals how the client handles stale requests (e.g. a request for which the client will not process the response anymore since the information is outdated). [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/general_client_capabilities.ex#L48 "View Source") ``` @type t() :: %GenLSP.Structures.GeneralClientCapabilities{ markdown: [GenLSP.Structures.MarkdownClientCapabilities.t](GenLSP.Structures.MarkdownClientCapabilities.html#t:t/0)() | nil, position_encodings: [[GenLSP.Enumerations.PositionEncodingKind.t](GenLSP.Enumerations.PositionEncodingKind.html#t:t/0)()] | nil, regular_expressions: [GenLSP.Structures.RegularExpressionsClientCapabilities.t](GenLSP.Structures.RegularExpressionsClientCapabilities.html#t:t/0)() | nil, stale_request_support: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.GeneralClientCapabilities{} ============================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/general_client_capabilities.ex#L48 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * stale\_request\_support: Client capability that signals how the client handles stale requests (e.g. a request for which the client will not process the response anymore since the information is outdated). @since 3.17.0 * regular\_expressions: Client capabilities specific to regular expressions. @since 3.16.0 * markdown: Client capabilities specific to the client's markdown parser. @since 3.16.0 * position\_encodings: The position encodings supported by the client. Client and server have to agree on the same position encoding to ensure that offsets (e.g. character position in a line) are interpreted the same on both sides. To keep the protocol backwards compatible the following applies: if the value 'utf-16' is missing from the array of position encodings servers can assume that the client supports UTF-16. UTF-16 is therefore a mandatory encoding. If omitted it defaults to ['utf-16']. Implementation considerations: since the conversion from one encoding into another requires the content of the file / line the conversion is best done where the file is read which is usually on the server side. @since 3.17.0 GenLSP.Structures.Hover β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/hover.ex#L2 "View Source") GenLSP.Structures.Hover (gen\_lsp v0.6.0) ================================================================================================================================================================================= The result of a hover request. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.Hover{}](#__struct__/0) Fields ------ * contents: The hover's content * range: An optional range inside the text document that is used to visualize the hover, e.g. by changing the background color. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/hover.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.Hover{ contents: [GenLSP.Structures.MarkupContent.t](GenLSP.Structures.MarkupContent.html#t:t/0)() | [GenLSP.TypeAlias.MarkedString.t](GenLSP.TypeAlias.MarkedString.html#t:t/0)() | [[GenLSP.TypeAlias.MarkedString.t](GenLSP.TypeAlias.MarkedString.html#t:t/0)()], range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.Hover{} ========================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/hover.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * contents: The hover's content * range: An optional range inside the text document that is used to visualize the hover, e.g. by changing the background color. GenLSP.Structures.HoverClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/hover_client_capabilities.ex#L2 "View Source") GenLSP.Structures.HoverClientCapabilities (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================= [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.HoverClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether hover supports dynamic registration. * content\_format: Client supports the following content formats for the content property. The order describes the preferred format of the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/hover_client_capabilities.ex#L15 "View Source") ``` @type t() :: %GenLSP.Structures.HoverClientCapabilities{ content_format: [[GenLSP.Enumerations.MarkupKind.t](GenLSP.Enumerations.MarkupKind.html#t:t/0)()] | nil, dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.HoverClientCapabilities{} ============================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/hover_client_capabilities.ex#L15 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether hover supports dynamic registration. * content\_format: Client supports the following content formats for the content property. The order describes the preferred format of the client. GenLSP.Structures.HoverOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/hover_options.ex#L2 "View Source") GenLSP.Structures.HoverOptions (gen\_lsp v0.6.0) ================================================================================================================================================================================================ Hover options. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.HoverOptions{}](#__struct__/0) Fields ------ * work\_done\_progress [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/hover_options.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.HoverOptions{work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.HoverOptions{} ================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/hover_options.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_progress GenLSP.Structures.HoverParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/hover_params.ex#L2 "View Source") GenLSP.Structures.HoverParams (gen\_lsp v0.6.0) ============================================================================================================================================================================================== Parameters for a {@link HoverRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.HoverParams{}](#__struct__/0) Fields ------ * work\_done\_token: An optional token that a server can use to report work done progress. * text\_document: The text document. * position: The position inside the text document. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/hover_params.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.HoverParams{ position: [GenLSP.Structures.Position.t](GenLSP.Structures.Position.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.HoverParams{} ================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/hover_params.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_token: An optional token that a server can use to report work done progress. * text\_document: The text document. * position: The position inside the text document. GenLSP.Structures.HoverRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/hover_registration_options.ex#L2 "View Source") GenLSP.Structures.HoverRegistrationOptions (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================= Registration options for a {@link HoverRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.HoverRegistrationOptions{}](#__struct__/0) Fields ------ * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/hover_registration_options.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.HoverRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.HoverRegistrationOptions{} ============================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/hover_registration_options.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. GenLSP.Structures.ImplementationClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/implementation_client_capabilities.ex#L2 "View Source") GenLSP.Structures.ImplementationClientCapabilities (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================================= @since 3.6.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ImplementationClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether implementation supports dynamic registration. If this is set to `true` the client supports the new `ImplementationRegistrationOptions` return value for the corresponding server capability as well. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/implementation_client_capabilities.ex#L22 "View Source") ``` @type t() :: %GenLSP.Structures.ImplementationClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, link_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ImplementationClientCapabilities{} ===================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/implementation_client_capabilities.ex#L22 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether implementation supports dynamic registration. If this is set to `true` the client supports the new `ImplementationRegistrationOptions` return value for the corresponding server capability as well. * link\_support: The client supports additional metadata in the form of definition links. @since 3.14.0 GenLSP.Structures.ImplementationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/implementation_options.ex#L2 "View Source") GenLSP.Structures.ImplementationOptions (gen\_lsp v0.6.0) ================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ImplementationOptions{}](#__struct__/0) Fields ------ * work\_done\_progress [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/implementation_options.ex#L13 "View Source") ``` @type t() :: %GenLSP.Structures.ImplementationOptions{ work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ImplementationOptions{} ========================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/implementation_options.ex#L13 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_progress GenLSP.Structures.ImplementationParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/implementation_params.ex#L2 "View Source") GenLSP.Structures.ImplementationParams (gen\_lsp v0.6.0) ================================================================================================================================================================================================================ [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ImplementationParams{}](#__struct__/0) Fields ------ * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. * text\_document: The text document. * position: The position inside the text document. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/implementation_params.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.ImplementationParams{ partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, position: [GenLSP.Structures.Position.t](GenLSP.Structures.Position.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ImplementationParams{} ========================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/implementation_params.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. * text\_document: The text document. * position: The position inside the text document. GenLSP.Structures.ImplementationRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/implementation_registration_options.ex#L2 "View Source") GenLSP.Structures.ImplementationRegistrationOptions (gen\_lsp v0.6.0) =========================================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ImplementationRegistrationOptions{}](#__struct__/0) Fields ------ * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/implementation_registration_options.ex#L16 "View Source") ``` @type t() :: %GenLSP.Structures.ImplementationRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil, id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ImplementationRegistrationOptions{} ====================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/implementation_registration_options.ex#L16 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. GenLSP.Structures.InitializeError β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/initialize_error.ex#L2 "View Source") GenLSP.Structures.InitializeError (gen\_lsp v0.6.0) ====================================================================================================================================================================================================== The data type of the ResponseError if the initialize request fails. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.InitializeError{}](#__struct__/0) Fields ------ * retry: Indicates whether the client execute the following retry logic: (1) show the message provided by the ResponseError to the user (2) user selects retry or cancel (3) if user selected retry the initialize method is sent again. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/initialize_error.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.InitializeError{retry: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.InitializeError{} ==================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/initialize_error.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * retry: Indicates whether the client execute the following retry logic: (1) show the message provided by the ResponseError to the user (2) user selects retry or cancel (3) if user selected retry the initialize method is sent again. GenLSP.Structures.InitializeParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/initialize_params.ex#L2 "View Source") GenLSP.Structures.InitializeParams (gen\_lsp v0.6.0) ======================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.InitializeParams{}](#__struct__/0) Fields ------ * process\_id: The process Id of the parent process that started the server. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/initialize_params.ex#L47 "View Source") ``` @type t() :: %GenLSP.Structures.InitializeParams{ capabilities: [GenLSP.Structures.ClientCapabilities.t](GenLSP.Structures.ClientCapabilities.html#t:t/0)(), client_info: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil, initialization_options: [GenLSP.TypeAlias.LSPAny.t](GenLSP.TypeAlias.LSPAny.html#t:t/0)() | nil, locale: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, process_id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil, root_path: ([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil) | nil, root_uri: [GenLSP.BaseTypes.document\_uri](GenLSP.BaseTypes.html#t:document_uri/0)() | nil, trace: [GenLSP.Enumerations.TraceValues.t](GenLSP.Enumerations.TraceValues.html#t:t/0)() | nil, workspace_folders: ([[GenLSP.Structures.WorkspaceFolder.t](GenLSP.Structures.WorkspaceFolder.html#t:t/0)()] | nil) | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.InitializeParams{} ===================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/initialize_params.ex#L47 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * process\_id: The process Id of the parent process that started the server. Is `null` if the process has not been started by another process. If the parent process is not alive then the server should exit. * client\_info: Information about the client @since 3.15.0 * locale: The locale the client is currently showing the user interface in. This must not necessarily be the locale of the operating system. Uses IETF language tags as the value's syntax (See <https://en.wikipedia.org/wiki/IETF_language_tag>) @since 3.16.0 * root\_path: The rootPath of the workspace. Is null if no folder is open. @deprecated in favour of rootUri. * root\_uri: The rootUri of the workspace. Is null if no folder is open. If both `rootPath` and `rootUri` are set `rootUri` wins. @deprecated in favour of workspaceFolders. * capabilities: The capabilities provided by the client (editor or tool) * initialization\_options: User provided initialization options. * trace: The initial trace setting. If omitted trace is disabled ('off'). * workspace\_folders: The workspace folders configured in the client when the server starts. This property is only available if the client supports workspace folders. It can be `null` if the client supports workspace folders but none are configured. @since 3.6.0 GenLSP.Structures.InitializeResult β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/initialize_result.ex#L2 "View Source") GenLSP.Structures.InitializeResult (gen\_lsp v0.6.0) ======================================================================================================================================================================================================== The result returned from an initialize request. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.InitializeResult{}](#__struct__/0) Fields ------ * capabilities: The capabilities the language server provides. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/initialize_result.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.InitializeResult{ capabilities: [GenLSP.Structures.ServerCapabilities.t](GenLSP.Structures.ServerCapabilities.html#t:t/0)(), server_info: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.InitializeResult{} ===================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/initialize_result.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * capabilities: The capabilities the language server provides. * server\_info: Information about the server. @since 3.15.0 GenLSP.Structures.InitializedParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/initialized_params.ex#L2 "View Source") GenLSP.Structures.InitializedParams (gen\_lsp v0.6.0) ========================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.InitializedParams{}](#__struct__/0) Fields ------ [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/initialized_params.ex#L12 "View Source") ``` @type t() :: %GenLSP.Structures.InitializedParams{} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.InitializedParams{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/initialized_params.ex#L12 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- GenLSP.Structures.InlayHint β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inlay_hint.ex#L2 "View Source") GenLSP.Structures.InlayHint (gen\_lsp v0.6.0) ========================================================================================================================================================================================== Inlay hint information. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.InlayHint{}](#__struct__/0) Fields ------ * position: The position of this hint. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inlay_hint.ex#L43 "View Source") ``` @type t() :: %GenLSP.Structures.InlayHint{ data: [GenLSP.TypeAlias.LSPAny.t](GenLSP.TypeAlias.LSPAny.html#t:t/0)() | nil, kind: [GenLSP.Enumerations.InlayHintKind.t](GenLSP.Enumerations.InlayHintKind.html#t:t/0)() | nil, label: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | [[GenLSP.Structures.InlayHintLabelPart.t](GenLSP.Structures.InlayHintLabelPart.html#t:t/0)()], padding_left: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, padding_right: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, position: [GenLSP.Structures.Position.t](GenLSP.Structures.Position.html#t:t/0)(), text_edits: [[GenLSP.Structures.TextEdit.t](GenLSP.Structures.TextEdit.html#t:t/0)()] | nil, tooltip: ([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | [GenLSP.Structures.MarkupContent.t](GenLSP.Structures.MarkupContent.html#t:t/0)()) | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.InlayHint{} ============================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inlay_hint.ex#L43 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * position: The position of this hint. * label: The label of this hint. A human readable string or an array of InlayHintLabelPart label parts. *Note* that neither the string nor the label part can be empty. * kind: The kind of this hint. Can be omitted in which case the client should fall back to a reasonable default. * text\_edits: Optional text edits that are performed when accepting this inlay hint. *Note* that edits are expected to change the document so that the inlay hint (or its nearest variant) is now part of the document and the inlay hint itself is now obsolete. * tooltip: The tooltip text when you hover over this item. * padding\_left: Render padding before the hint. Note: Padding should use the editor's background color, not the background color of the hint itself. That means padding can be used to visually align/separate an inlay hint. * padding\_right: Render padding after the hint. Note: Padding should use the editor's background color, not the background color of the hint itself. That means padding can be used to visually align/separate an inlay hint. * data: A data entry field that is preserved on an inlay hint between a `textDocument/inlayHint` and a `inlayHint/resolve` request. GenLSP.Structures.InlayHintClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inlay_hint_client_capabilities.ex#L2 "View Source") GenLSP.Structures.InlayHintClientCapabilities (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================ Inlay hint client capabilities. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.InlayHintClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether inlay hints support dynamic registration. * resolve\_support: Indicates which properties a client can resolve lazily on an inlay hint. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inlay_hint_client_capabilities.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.InlayHintClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, resolve_support: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.InlayHintClientCapabilities{} ================================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inlay_hint_client_capabilities.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether inlay hints support dynamic registration. * resolve\_support: Indicates which properties a client can resolve lazily on an inlay hint. GenLSP.Structures.InlayHintLabelPart β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inlay_hint_label_part.ex#L2 "View Source") GenLSP.Structures.InlayHintLabelPart (gen\_lsp v0.6.0) ============================================================================================================================================================================================================== An inlay hint label part allows for interactive and composite labels of inlay hints. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.InlayHintLabelPart{}](#__struct__/0) Fields ------ * value: The value of this label part. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inlay_hint_label_part.ex#L38 "View Source") ``` @type t() :: %GenLSP.Structures.InlayHintLabelPart{ command: [GenLSP.Structures.Command.t](GenLSP.Structures.Command.html#t:t/0)() | nil, location: [GenLSP.Structures.Location.t](GenLSP.Structures.Location.html#t:t/0)() | nil, tooltip: ([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | [GenLSP.Structures.MarkupContent.t](GenLSP.Structures.MarkupContent.html#t:t/0)()) | nil, value: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.InlayHintLabelPart{} ======================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inlay_hint_label_part.ex#L38 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * value: The value of this label part. * tooltip: The tooltip text when you hover over this label part. Depending on the client capability `inlayHint.resolveSupport` clients might resolve this property late using the resolve request. * location: An optional source code location that represents this label part. The editor will use this location for the hover and for code navigation features: This part will become a clickable link that resolves to the definition of the symbol at the given location (not necessarily the location itself), it shows the hover that shows at the given location, and it shows a context menu with further code navigation commands. Depending on the client capability `inlayHint.resolveSupport` clients might resolve this property late using the resolve request. * command: An optional command for this label part. Depending on the client capability `inlayHint.resolveSupport` clients might resolve this property late using the resolve request. GenLSP.Structures.InlayHintOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inlay_hint_options.ex#L2 "View Source") GenLSP.Structures.InlayHintOptions (gen\_lsp v0.6.0) ========================================================================================================================================================================================================= Inlay hint options used during static registration. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.InlayHintOptions{}](#__struct__/0) Fields ------ * resolve\_provider: The server provides support to resolve additional information for an inlay hint item. * work\_done\_progress [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inlay_hint_options.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.InlayHintOptions{ resolve_provider: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.InlayHintOptions{} ===================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inlay_hint_options.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * resolve\_provider: The server provides support to resolve additional information for an inlay hint item. * work\_done\_progress GenLSP.Structures.InlayHintParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inlay_hint_params.ex#L2 "View Source") GenLSP.Structures.InlayHintParams (gen\_lsp v0.6.0) ======================================================================================================================================================================================================= A parameter literal used in inlay hint requests. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.InlayHintParams{}](#__struct__/0) Fields ------ * text\_document: The text document. * range: The document range for which inlay hints should be computed. * work\_done\_token: An optional token that a server can use to report work done progress. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inlay_hint_params.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.InlayHintParams{ range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.InlayHintParams{} ==================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inlay_hint_params.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * text\_document: The text document. * range: The document range for which inlay hints should be computed. * work\_done\_token: An optional token that a server can use to report work done progress. GenLSP.Structures.InlayHintRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inlay_hint_registration_options.ex#L2 "View Source") GenLSP.Structures.InlayHintRegistrationOptions (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================== Inlay hint options used during static or dynamic registration. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.InlayHintRegistrationOptions{}](#__struct__/0) Fields ------ * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * resolve\_provider: The server provides support to resolve additional information for an inlay hint item. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inlay_hint_registration_options.ex#L24 "View Source") ``` @type t() :: %GenLSP.Structures.InlayHintRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil, id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, resolve_provider: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.InlayHintRegistrationOptions{} ================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inlay_hint_registration_options.ex#L24 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * resolve\_provider: The server provides support to resolve additional information for an inlay hint item. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. GenLSP.Structures.InlayHintWorkspaceClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inlay_hint_workspace_client_capabilities.ex#L2 "View Source") GenLSP.Structures.InlayHintWorkspaceClientCapabilities (gen\_lsp v0.6.0) =================================================================================================================================================================================================================================================== Client workspace capabilities specific to inlay hints. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.InlayHintWorkspaceClientCapabilities{}](#__struct__/0) Fields ------ * refresh\_support: Whether the client implementation supports a refresh request sent from the server to the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inlay_hint_workspace_client_capabilities.ex#L25 "View Source") ``` @type t() :: %GenLSP.Structures.InlayHintWorkspaceClientCapabilities{ refresh_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.InlayHintWorkspaceClientCapabilities{} ========================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inlay_hint_workspace_client_capabilities.ex#L25 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * refresh\_support: Whether the client implementation supports a refresh request sent from the server to the client. Note that this event is global and will force the client to refresh all inlay hints currently shown. It should be used with absolute care and is useful for situation where a server for example detects a project wide change that requires such a calculation. GenLSP.Structures.InlineValueClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_client_capabilities.ex#L2 "View Source") GenLSP.Structures.InlineValueClientCapabilities (gen\_lsp v0.6.0) ==================================================================================================================================================================================================================================== Client capabilities specific to inline values. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.InlineValueClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether implementation supports dynamic registration for inline value providers. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_client_capabilities.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.InlineValueClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.InlineValueClientCapabilities{} ================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_client_capabilities.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether implementation supports dynamic registration for inline value providers. GenLSP.Structures.InlineValueContext β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_context.ex#L2 "View Source") GenLSP.Structures.InlineValueContext (gen\_lsp v0.6.0) ============================================================================================================================================================================================================= @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.InlineValueContext{}](#__struct__/0) Fields ------ * frame\_id: The stack frame (as a DAP Id) where the execution has stopped. * stopped\_location: The document range where execution has stopped. Typically the end position of the range denotes the line where the inline values are shown. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_context.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.InlineValueContext{ frame_id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), stopped_location: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.InlineValueContext{} ======================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_context.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * frame\_id: The stack frame (as a DAP Id) where the execution has stopped. * stopped\_location: The document range where execution has stopped. Typically the end position of the range denotes the line where the inline values are shown. GenLSP.Structures.InlineValueEvaluatableExpression β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_evaluatable_expression.ex#L2 "View Source") GenLSP.Structures.InlineValueEvaluatableExpression (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================================== Provide an inline value through an expression evaluation. If only a range is specified, the expression will be extracted from the underlying document. An optional expression can be used to override the extracted expression. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.InlineValueEvaluatableExpression{}](#__struct__/0) Fields ------ * range: The document range for which the inline value applies. The range is used to extract the evaluatable expression from the underlying document. * expression: If specified the expression overrides the extracted expression. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_evaluatable_expression.ex#L23 "View Source") ``` @type t() :: %GenLSP.Structures.InlineValueEvaluatableExpression{ expression: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.InlineValueEvaluatableExpression{} ===================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_evaluatable_expression.ex#L23 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * range: The document range for which the inline value applies. The range is used to extract the evaluatable expression from the underlying document. * expression: If specified the expression overrides the extracted expression. GenLSP.Structures.InlineValueOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_options.ex#L2 "View Source") GenLSP.Structures.InlineValueOptions (gen\_lsp v0.6.0) ============================================================================================================================================================================================================= Inline value options used during static registration. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.InlineValueOptions{}](#__struct__/0) Fields ------ * work\_done\_progress [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_options.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.InlineValueOptions{ work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.InlineValueOptions{} ======================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_options.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_progress GenLSP.Structures.InlineValueParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_params.ex#L2 "View Source") GenLSP.Structures.InlineValueParams (gen\_lsp v0.6.0) =========================================================================================================================================================================================================== A parameter literal used in inline value requests. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.InlineValueParams{}](#__struct__/0) Fields ------ * text\_document: The text document. * range: The document range for which inline values should be computed. * context: Additional information about the context in which inline values were requested. * work\_done\_token: An optional token that a server can use to report work done progress. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_params.ex#L23 "View Source") ``` @type t() :: %GenLSP.Structures.InlineValueParams{ context: [GenLSP.Structures.InlineValueContext.t](GenLSP.Structures.InlineValueContext.html#t:t/0)(), range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.InlineValueParams{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_params.ex#L23 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * text\_document: The text document. * range: The document range for which inline values should be computed. * context: Additional information about the context in which inline values were requested. * work\_done\_token: An optional token that a server can use to report work done progress. GenLSP.Structures.InlineValueRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_registration_options.ex#L2 "View Source") GenLSP.Structures.InlineValueRegistrationOptions (gen\_lsp v0.6.0) ====================================================================================================================================================================================================================================== Inline value options used during static or dynamic registration. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.InlineValueRegistrationOptions{}](#__struct__/0) Fields ------ * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_registration_options.ex#L22 "View Source") ``` @type t() :: %GenLSP.Structures.InlineValueRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil, id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.InlineValueRegistrationOptions{} =================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_registration_options.ex#L22 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. GenLSP.Structures.InlineValueText β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_text.ex#L2 "View Source") GenLSP.Structures.InlineValueText (gen\_lsp v0.6.0) ======================================================================================================================================================================================================= Provide inline value as text. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.InlineValueText{}](#__struct__/0) Fields ------ * range: The document range for which the inline value applies. * text: The text of the inline value. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_text.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.InlineValueText{ range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)(), text: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.InlineValueText{} ==================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_text.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * range: The document range for which the inline value applies. * text: The text of the inline value. GenLSP.Structures.InlineValueVariableLookup β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_variable_lookup.ex#L2 "View Source") GenLSP.Structures.InlineValueVariableLookup (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================ Provide inline value through a variable lookup. If only a range is specified, the variable name will be extracted from the underlying document. An optional variable name can be used to override the extracted name. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.InlineValueVariableLookup{}](#__struct__/0) Fields ------ * range: The document range for which the inline value applies. The range is used to extract the variable name from the underlying document. * variable\_name: If specified the name of the variable to look up. * case\_sensitive\_lookup: How to perform the lookup. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_variable_lookup.ex#L24 "View Source") ``` @type t() :: %GenLSP.Structures.InlineValueVariableLookup{ case_sensitive_lookup: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)(), variable_name: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.InlineValueVariableLookup{} ============================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_variable_lookup.ex#L24 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * range: The document range for which the inline value applies. The range is used to extract the variable name from the underlying document. * variable\_name: If specified the name of the variable to look up. * case\_sensitive\_lookup: How to perform the lookup. GenLSP.Structures.InlineValueWorkspaceClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_workspace_client_capabilities.ex#L2 "View Source") GenLSP.Structures.InlineValueWorkspaceClientCapabilities (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================================================= Client workspace capabilities specific to inline values. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.InlineValueWorkspaceClientCapabilities{}](#__struct__/0) Fields ------ * refresh\_support: Whether the client implementation supports a refresh request sent from the server to the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_workspace_client_capabilities.ex#L25 "View Source") ``` @type t() :: %GenLSP.Structures.InlineValueWorkspaceClientCapabilities{ refresh_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.InlineValueWorkspaceClientCapabilities{} =========================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/inline_value_workspace_client_capabilities.ex#L25 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * refresh\_support: Whether the client implementation supports a refresh request sent from the server to the client. Note that this event is global and will force the client to refresh all inline values currently shown. It should be used with absolute care and is useful for situation where a server for example detects a project wide change that requires such a calculation. GenLSP.Structures.InsertReplaceEdit β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/insert_replace_edit.ex#L2 "View Source") GenLSP.Structures.InsertReplaceEdit (gen\_lsp v0.6.0) =========================================================================================================================================================================================================== A special text edit to provide an insert and a replace operation. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.InsertReplaceEdit{}](#__struct__/0) Fields ------ * new\_text: The string to be inserted. * insert: The range if the insert is requested * replace: The range if the replace is requested. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/insert_replace_edit.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.InsertReplaceEdit{ insert: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)(), new_text: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), replace: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.InsertReplaceEdit{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/insert_replace_edit.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * new\_text: The string to be inserted. * insert: The range if the insert is requested * replace: The range if the replace is requested. GenLSP.Structures.LinkedEditingRangeClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/linked_editing_range_client_capabilities.ex#L2 "View Source") GenLSP.Structures.LinkedEditingRangeClientCapabilities (gen\_lsp v0.6.0) =================================================================================================================================================================================================================================================== Client capabilities for the linked editing range request. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.LinkedEditingRangeClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether implementation supports dynamic registration. If this is set to `true` the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` return value for the corresponding server capability as well. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/linked_editing_range_client_capabilities.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.LinkedEditingRangeClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.LinkedEditingRangeClientCapabilities{} ========================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/linked_editing_range_client_capabilities.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether implementation supports dynamic registration. If this is set to `true` the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` return value for the corresponding server capability as well. GenLSP.Structures.LinkedEditingRangeOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/linked_editing_range_options.ex#L2 "View Source") GenLSP.Structures.LinkedEditingRangeOptions (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================ [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.LinkedEditingRangeOptions{}](#__struct__/0) Fields ------ * work\_done\_progress [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/linked_editing_range_options.ex#L13 "View Source") ``` @type t() :: %GenLSP.Structures.LinkedEditingRangeOptions{ work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.LinkedEditingRangeOptions{} ============================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/linked_editing_range_options.ex#L13 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_progress GenLSP.Structures.LinkedEditingRangeParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/linked_editing_range_params.ex#L2 "View Source") GenLSP.Structures.LinkedEditingRangeParams (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.LinkedEditingRangeParams{}](#__struct__/0) Fields ------ * work\_done\_token: An optional token that a server can use to report work done progress. * text\_document: The text document. * position: The position inside the text document. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/linked_editing_range_params.ex#L15 "View Source") ``` @type t() :: %GenLSP.Structures.LinkedEditingRangeParams{ position: [GenLSP.Structures.Position.t](GenLSP.Structures.Position.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.LinkedEditingRangeParams{} ============================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/linked_editing_range_params.ex#L15 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_token: An optional token that a server can use to report work done progress. * text\_document: The text document. * position: The position inside the text document. GenLSP.Structures.LinkedEditingRangeRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/linked_editing_range_registration_options.ex#L2 "View Source") GenLSP.Structures.LinkedEditingRangeRegistrationOptions (gen\_lsp v0.6.0) ===================================================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.LinkedEditingRangeRegistrationOptions{}](#__struct__/0) Fields ------ * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/linked_editing_range_registration_options.ex#L16 "View Source") ``` @type t() :: %GenLSP.Structures.LinkedEditingRangeRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil, id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.LinkedEditingRangeRegistrationOptions{} ========================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/linked_editing_range_registration_options.ex#L16 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. GenLSP.Structures.LinkedEditingRanges β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/linked_editing_ranges.ex#L2 "View Source") GenLSP.Structures.LinkedEditingRanges (gen\_lsp v0.6.0) =============================================================================================================================================================================================================== The result of a linked editing range request. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.LinkedEditingRanges{}](#__struct__/0) Fields ------ * ranges: A list of ranges that can be edited together. The ranges must have identical length and contain identical text content. The ranges cannot overlap. * word\_pattern: An optional word pattern (regular expression) that describes valid contents for the given ranges. If no pattern is provided, the client configuration's word pattern will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/linked_editing_ranges.ex#L23 "View Source") ``` @type t() :: %GenLSP.Structures.LinkedEditingRanges{ ranges: [[GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)()], word_pattern: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.LinkedEditingRanges{} ======================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/linked_editing_ranges.ex#L23 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * ranges: A list of ranges that can be edited together. The ranges must have identical length and contain identical text content. The ranges cannot overlap. * word\_pattern: An optional word pattern (regular expression) that describes valid contents for the given ranges. If no pattern is provided, the client configuration's word pattern will be used. GenLSP.Structures.Location β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/location.ex#L2 "View Source") GenLSP.Structures.Location (gen\_lsp v0.6.0) ======================================================================================================================================================================================= Represents a location inside a resource, such as a line inside a text file. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.Location{}](#__struct__/0) Fields ------ * uri * range [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/location.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.Location{ range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)(), uri: [GenLSP.BaseTypes.document\_uri](GenLSP.BaseTypes.html#t:document_uri/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.Location{} ============================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/location.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * uri * range GenLSP.Structures.LocationLink β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/location_link.ex#L2 "View Source") GenLSP.Structures.LocationLink (gen\_lsp v0.6.0) ================================================================================================================================================================================================ Represents the connection of two locations. Provides additional metadata over normal {@link Location locations}, including an origin range. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.LocationLink{}](#__struct__/0) Fields ------ * origin\_selection\_range: Span of the origin of this link. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/location_link.ex#L27 "View Source") ``` @type t() :: %GenLSP.Structures.LocationLink{ origin_selection_range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)() | nil, target_range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)(), target_selection_range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)(), target_uri: [GenLSP.BaseTypes.document\_uri](GenLSP.BaseTypes.html#t:document_uri/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.LocationLink{} ================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/location_link.ex#L27 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * origin\_selection\_range: Span of the origin of this link. Used as the underlined span for mouse interaction. Defaults to the word range at the definition position. * target\_uri: The target resource identifier of this link. * target\_range: The full target range of this link. If the target for example is a symbol then target range is the range enclosing this symbol not including leading/trailing whitespace but everything else like comments. This information is typically used to highlight the range in the editor. * target\_selection\_range: The range that should be selected and revealed when this link is being followed, e.g the name of a function. Must be contained by the `targetRange`. See also `DocumentSymbol#range` GenLSP.Structures.LogMessageParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/log_message_params.ex#L2 "View Source") GenLSP.Structures.LogMessageParams (gen\_lsp v0.6.0) ========================================================================================================================================================================================================= The log message parameters. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.LogMessageParams{}](#__struct__/0) Fields ------ * type: The message type. See {@link MessageType} * message: The actual message. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/log_message_params.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.LogMessageParams{ message: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), type: [GenLSP.Enumerations.MessageType.t](GenLSP.Enumerations.MessageType.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.LogMessageParams{} ===================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/log_message_params.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * type: The message type. See {@link MessageType} * message: The actual message. GenLSP.Structures.LogTraceParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/log_trace_params.ex#L2 "View Source") GenLSP.Structures.LogTraceParams (gen\_lsp v0.6.0) ===================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.LogTraceParams{}](#__struct__/0) Fields ------ * message * verbose [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/log_trace_params.ex#L14 "View Source") ``` @type t() :: %GenLSP.Structures.LogTraceParams{ message: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), verbose: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.LogTraceParams{} =================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/log_trace_params.ex#L14 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * message * verbose GenLSP.Structures.MarkdownClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/markdown_client_capabilities.ex#L2 "View Source") GenLSP.Structures.MarkdownClientCapabilities (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================= Client capabilities specific to the used markdown parser. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.MarkdownClientCapabilities{}](#__struct__/0) Fields ------ * parser: The name of the parser. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/markdown_client_capabilities.ex#L24 "View Source") ``` @type t() :: %GenLSP.Structures.MarkdownClientCapabilities{ allowed_tags: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil, parser: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), version: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.MarkdownClientCapabilities{} =============================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/markdown_client_capabilities.ex#L24 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * parser: The name of the parser. * version: The version of the parser. * allowed\_tags: A list of HTML tags that the client allows / supports in Markdown. @since 3.17.0 GenLSP.Structures.MarkupContent β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/markup_content.ex#L2 "View Source") GenLSP.Structures.MarkupContent (gen\_lsp v0.6.0) ================================================================================================================================================================================================== A `MarkupContent` literal represents a string value which content is interpreted base on its kind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds. If the kind is `markdown` then the value can contain fenced code blocks like in GitHub issues. See <https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting> Here is an example how such a string can be constructed using JavaScript / TypeScript: ``` let markdown: MarkdownContent = { kind: MarkupKind.Markdown, value: [ '# Header', 'Some text', '```typescript', 'someCode();', '```' ].join(' ') }; ``` *Please Note* that clients might sanitize the return markdown. A client could decide to remove HTML from the markdown to avoid script execution. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.MarkupContent{}](#__struct__/0) Fields ------ * kind: The type of the Markup * value: The content itself [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/markup_content.ex#L39 "View Source") ``` @type t() :: %GenLSP.Structures.MarkupContent{ kind: [GenLSP.Enumerations.MarkupKind.t](GenLSP.Enumerations.MarkupKind.html#t:t/0)(), value: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.MarkupContent{} ================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/markup_content.ex#L39 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * kind: The type of the Markup * value: The content itself GenLSP.Structures.MessageActionItem β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/message_action_item.ex#L2 "View Source") GenLSP.Structures.MessageActionItem (gen\_lsp v0.6.0) =========================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.MessageActionItem{}](#__struct__/0) Fields ------ * title: A short title like 'Retry', 'Open Log' etc. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/message_action_item.ex#L13 "View Source") ``` @type t() :: %GenLSP.Structures.MessageActionItem{title: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.MessageActionItem{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/message_action_item.ex#L13 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * title: A short title like 'Retry', 'Open Log' etc. GenLSP.Structures.Moniker β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/moniker.ex#L2 "View Source") GenLSP.Structures.Moniker (gen\_lsp v0.6.0) ===================================================================================================================================================================================== Moniker definition to match LSIF 0.5 moniker definition. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.Moniker{}](#__struct__/0) Fields ------ * scheme: The scheme of the moniker. For example tsc or .Net * identifier: The identifier of the moniker. The value is opaque in LSIF however schema owners are allowed to define the structure if they want. * unique: The scope in which the moniker is unique * kind: The moniker kind if known. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/moniker.ex#L23 "View Source") ``` @type t() :: %GenLSP.Structures.Moniker{ identifier: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), kind: [GenLSP.Enumerations.MonikerKind.t](GenLSP.Enumerations.MonikerKind.html#t:t/0)() | nil, scheme: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), unique: [GenLSP.Enumerations.UniquenessLevel.t](GenLSP.Enumerations.UniquenessLevel.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.Moniker{} ============================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/moniker.ex#L23 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * scheme: The scheme of the moniker. For example tsc or .Net * identifier: The identifier of the moniker. The value is opaque in LSIF however schema owners are allowed to define the structure if they want. * unique: The scope in which the moniker is unique * kind: The moniker kind if known. GenLSP.Structures.MonikerClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/moniker_client_capabilities.ex#L2 "View Source") GenLSP.Structures.MonikerClientCapabilities (gen\_lsp v0.6.0) =========================================================================================================================================================================================================================== Client capabilities specific to the moniker request. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.MonikerClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether moniker supports dynamic registration. If this is set to `true` the client supports the new `MonikerRegistrationOptions` return value for the corresponding server capability as well. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/moniker_client_capabilities.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.MonikerClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.MonikerClientCapabilities{} ============================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/moniker_client_capabilities.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether moniker supports dynamic registration. If this is set to `true` the client supports the new `MonikerRegistrationOptions` return value for the corresponding server capability as well. GenLSP.Structures.MonikerOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/moniker_options.ex#L2 "View Source") GenLSP.Structures.MonikerOptions (gen\_lsp v0.6.0) ==================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.MonikerOptions{}](#__struct__/0) Fields ------ * work\_done\_progress [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/moniker_options.ex#L13 "View Source") ``` @type t() :: %GenLSP.Structures.MonikerOptions{work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.MonikerOptions{} =================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/moniker_options.ex#L13 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_progress GenLSP.Structures.MonikerParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/moniker_params.ex#L2 "View Source") GenLSP.Structures.MonikerParams (gen\_lsp v0.6.0) ================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.MonikerParams{}](#__struct__/0) Fields ------ * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. * text\_document: The text document. * position: The position inside the text document. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/moniker_params.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.MonikerParams{ partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, position: [GenLSP.Structures.Position.t](GenLSP.Structures.Position.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.MonikerParams{} ================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/moniker_params.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. * text\_document: The text document. * position: The position inside the text document. GenLSP.Structures.MonikerRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/moniker_registration_options.ex#L2 "View Source") GenLSP.Structures.MonikerRegistrationOptions (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================= [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.MonikerRegistrationOptions{}](#__struct__/0) Fields ------ * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/moniker_registration_options.ex#L14 "View Source") ``` @type t() :: %GenLSP.Structures.MonikerRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.MonikerRegistrationOptions{} =============================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/moniker_registration_options.ex#L14 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. GenLSP.Structures.NotebookCell β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_cell.ex#L2 "View Source") GenLSP.Structures.NotebookCell (gen\_lsp v0.6.0) ================================================================================================================================================================================================ A notebook cell. A cell's document URI must be unique across ALL notebook cells and can therefore be used to uniquely identify a notebook cell or the cell's text document. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.NotebookCell{}](#__struct__/0) Fields ------ * kind: The cell's kind [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_cell.ex#L30 "View Source") ``` @type t() :: %GenLSP.Structures.NotebookCell{ document: [GenLSP.BaseTypes.document\_uri](GenLSP.BaseTypes.html#t:document_uri/0)(), execution_summary: [GenLSP.Structures.ExecutionSummary.t](GenLSP.Structures.ExecutionSummary.html#t:t/0)() | nil, kind: [GenLSP.Enumerations.NotebookCellKind.t](GenLSP.Enumerations.NotebookCellKind.html#t:t/0)(), metadata: [GenLSP.TypeAlias.LSPObject.t](GenLSP.TypeAlias.LSPObject.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.NotebookCell{} ================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_cell.ex#L30 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * kind: The cell's kind * document: The URI of the cell's text document content. * metadata: Additional metadata stored with the cell. Note: should always be an object literal (e.g. LSPObject) * execution\_summary: Additional execution summary information if supported by the client. GenLSP.Structures.NotebookCellArrayChange β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_cell_array_change.ex#L2 "View Source") GenLSP.Structures.NotebookCellArrayChange (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================== A change describing how to move a `NotebookCell` array from state S to S'. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.NotebookCellArrayChange{}](#__struct__/0) Fields ------ * start: The start oftest of the cell that changed. * delete\_count: The deleted cells * cells: The new cells, if any [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_cell_array_change.ex#L22 "View Source") ``` @type t() :: %GenLSP.Structures.NotebookCellArrayChange{ cells: [[GenLSP.Structures.NotebookCell.t](GenLSP.Structures.NotebookCell.html#t:t/0)()] | nil, delete_count: [GenLSP.BaseTypes.uinteger](GenLSP.BaseTypes.html#t:uinteger/0)(), start: [GenLSP.BaseTypes.uinteger](GenLSP.BaseTypes.html#t:uinteger/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.NotebookCellArrayChange{} ============================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_cell_array_change.ex#L22 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * start: The start oftest of the cell that changed. * delete\_count: The deleted cells * cells: The new cells, if any GenLSP.Structures.NotebookCellTextDocumentFilter β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_cell_text_document_filter.ex#L2 "View Source") GenLSP.Structures.NotebookCellTextDocumentFilter (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================================= A notebook cell text document filter denotes a cell text document by different properties. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.NotebookCellTextDocumentFilter{}](#__struct__/0) Fields ------ * notebook: A filter that matches against the notebook containing the notebook cell. If a string value is provided it matches against the notebook type. '\*' matches every notebook. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_cell_text_document_filter.ex#L27 "View Source") ``` @type t() :: %GenLSP.Structures.NotebookCellTextDocumentFilter{ language: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, notebook: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | [GenLSP.TypeAlias.NotebookDocumentFilter.t](GenLSP.TypeAlias.NotebookDocumentFilter.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.NotebookCellTextDocumentFilter{} =================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_cell_text_document_filter.ex#L27 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * notebook: A filter that matches against the notebook containing the notebook cell. If a string value is provided it matches against the notebook type. '\*' matches every notebook. * language: A language id like `python`. Will be matched against the language id of the notebook cell document. '\*' matches every language. GenLSP.Structures.NotebookDocument β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_document.ex#L2 "View Source") GenLSP.Structures.NotebookDocument (gen\_lsp v0.6.0) ======================================================================================================================================================================================================== A notebook document. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.NotebookDocument{}](#__struct__/0) Fields ------ * uri: The notebook document's uri. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_document.ex#L27 "View Source") ``` @type t() :: %GenLSP.Structures.NotebookDocument{ cells: [[GenLSP.Structures.NotebookCell.t](GenLSP.Structures.NotebookCell.html#t:t/0)()], metadata: [GenLSP.TypeAlias.LSPObject.t](GenLSP.TypeAlias.LSPObject.html#t:t/0)() | nil, notebook_type: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), uri: [GenLSP.BaseTypes.uri](GenLSP.BaseTypes.html#t:uri/0)(), version: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.NotebookDocument{} ===================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_document.ex#L27 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * uri: The notebook document's uri. * notebook\_type: The type of the notebook. * version: The version number of this document (it will increase after each change, including undo/redo). * metadata: Additional metadata stored with the notebook document. Note: should always be an object literal (e.g. LSPObject) * cells: The cells of a notebook. GenLSP.Structures.NotebookDocumentChangeEvent β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_document_change_event.ex#L2 "View Source") GenLSP.Structures.NotebookDocumentChangeEvent (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================ A change event for a notebook document. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.NotebookDocumentChangeEvent{}](#__struct__/0) Fields ------ * metadata: The changed meta data if any. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_document_change_event.ex#L22 "View Source") ``` @type t() :: %GenLSP.Structures.NotebookDocumentChangeEvent{ cells: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil, metadata: [GenLSP.TypeAlias.LSPObject.t](GenLSP.TypeAlias.LSPObject.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.NotebookDocumentChangeEvent{} ================================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_document_change_event.ex#L22 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * metadata: The changed meta data if any. Note: should always be an object literal (e.g. LSPObject) * cells: Changes to cells GenLSP.Structures.NotebookDocumentClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_document_client_capabilities.ex#L2 "View Source") GenLSP.Structures.NotebookDocumentClientCapabilities (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================================== Capabilities specific to the notebook document support. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.NotebookDocumentClientCapabilities{}](#__struct__/0) Fields ------ * synchronization: Capabilities specific to notebook document synchronization [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_document_client_capabilities.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.NotebookDocumentClientCapabilities{ synchronization: [GenLSP.Structures.NotebookDocumentSyncClientCapabilities.t](GenLSP.Structures.NotebookDocumentSyncClientCapabilities.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.NotebookDocumentClientCapabilities{} ======================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_document_client_capabilities.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * synchronization: Capabilities specific to notebook document synchronization @since 3.17.0 GenLSP.Structures.NotebookDocumentIdentifier β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_document_identifier.ex#L2 "View Source") GenLSP.Structures.NotebookDocumentIdentifier (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================= A literal to identify a notebook document in the client. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.NotebookDocumentIdentifier{}](#__struct__/0) Fields ------ * uri: The notebook document's uri. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_document_identifier.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.NotebookDocumentIdentifier{ uri: [GenLSP.BaseTypes.uri](GenLSP.BaseTypes.html#t:uri/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.NotebookDocumentIdentifier{} =============================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_document_identifier.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * uri: The notebook document's uri. GenLSP.Structures.NotebookDocumentSyncClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_document_sync_client_capabilities.ex#L2 "View Source") GenLSP.Structures.NotebookDocumentSyncClientCapabilities (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================================================= Notebook specific client capabilities. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.NotebookDocumentSyncClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether implementation supports dynamic registration. If this is set to `true` the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` return value for the corresponding server capability as well. * execution\_summary\_support: The client supports sending execution summary data per cell. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_document_sync_client_capabilities.ex#L23 "View Source") ``` @type t() :: %GenLSP.Structures.NotebookDocumentSyncClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, execution_summary_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.NotebookDocumentSyncClientCapabilities{} =========================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_document_sync_client_capabilities.ex#L23 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether implementation supports dynamic registration. If this is set to `true` the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` return value for the corresponding server capability as well. * execution\_summary\_support: The client supports sending execution summary data per cell. GenLSP.Structures.NotebookDocumentSyncOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_document_sync_options.ex#L2 "View Source") GenLSP.Structures.NotebookDocumentSyncOptions (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================ Options specific to a notebook plus its cells to be synced to the server. If a selector provides a notebook document filter but no cell selector all cells of a matching notebook document will be synced. If a selector provides no notebook document filter but only a cell selector all notebook document that contain at least one matching cell will be synced. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.NotebookDocumentSyncOptions{}](#__struct__/0) Fields ------ * notebook\_selector: The notebooks to be synced * save: Whether save notification should be forwarded to the server. Will only be honored if mode === `notebook`. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_document_sync_options.ex#L31 "View Source") ``` @type t() :: %GenLSP.Structures.NotebookDocumentSyncOptions{ notebook_selector: [[map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)()], save: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.NotebookDocumentSyncOptions{} ================================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_document_sync_options.ex#L31 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * notebook\_selector: The notebooks to be synced * save: Whether save notification should be forwarded to the server. Will only be honored if mode === `notebook`. GenLSP.Structures.NotebookDocumentSyncRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_document_sync_registration_options.ex#L2 "View Source") GenLSP.Structures.NotebookDocumentSyncRegistrationOptions (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================================================= Registration options specific to a notebook. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.NotebookDocumentSyncRegistrationOptions{}](#__struct__/0) Fields ------ * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * notebook\_selector: The notebooks to be synced * save: Whether save notification should be forwarded to the server. Will only be honored if mode === `notebook`. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_document_sync_registration_options.ex#L23 "View Source") ``` @type t() :: %GenLSP.Structures.NotebookDocumentSyncRegistrationOptions{ id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, notebook_selector: [[map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)()], save: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.NotebookDocumentSyncRegistrationOptions{} ============================================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/notebook_document_sync_registration_options.ex#L23 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * notebook\_selector: The notebooks to be synced * save: Whether save notification should be forwarded to the server. Will only be honored if mode === `notebook`. GenLSP.Structures.OptionalVersionedTextDocumentIdentifier β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/optional_versioned_text_document_identifier.ex#L2 "View Source") GenLSP.Structures.OptionalVersionedTextDocumentIdentifier (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================================================= A text document identifier to optionally denote a specific version of a text document. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.OptionalVersionedTextDocumentIdentifier{}](#__struct__/0) Fields ------ * version: The version number of this document. If a versioned text document identifier is sent from the server to the client and the file is not open in the editor (the server has not received an open notification before) the server can send `null` to indicate that the version is unknown and the content on disk is the truth (as specified with document content ownership). * uri: The text document's uri. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/optional_versioned_text_document_identifier.ex#L22 "View Source") ``` @type t() :: %GenLSP.Structures.OptionalVersionedTextDocumentIdentifier{ uri: [GenLSP.BaseTypes.document\_uri](GenLSP.BaseTypes.html#t:document_uri/0)(), version: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.OptionalVersionedTextDocumentIdentifier{} ============================================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/optional_versioned_text_document_identifier.ex#L22 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * version: The version number of this document. If a versioned text document identifier is sent from the server to the client and the file is not open in the editor (the server has not received an open notification before) the server can send `null` to indicate that the version is unknown and the content on disk is the truth (as specified with document content ownership). * uri: The text document's uri. GenLSP.Structures.ParameterInformation β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/parameter_information.ex#L2 "View Source") GenLSP.Structures.ParameterInformation (gen\_lsp v0.6.0) ================================================================================================================================================================================================================ Represents a parameter of a callable-signature. A parameter can have a label and a doc-comment. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ParameterInformation{}](#__struct__/0) Fields ------ * label: The label of this parameter information. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/parameter_information.ex#L27 "View Source") ``` @type t() :: %GenLSP.Structures.ParameterInformation{ documentation: ([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | [GenLSP.Structures.MarkupContent.t](GenLSP.Structures.MarkupContent.html#t:t/0)()) | nil, label: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | {[GenLSP.BaseTypes.uinteger](GenLSP.BaseTypes.html#t:uinteger/0)(), [GenLSP.BaseTypes.uinteger](GenLSP.BaseTypes.html#t:uinteger/0)()} } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ParameterInformation{} ========================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/parameter_information.ex#L27 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * label: The label of this parameter information. Either a string or an inclusive start and exclusive end offsets within its containing signature label. (see SignatureInformation.label). The offsets are based on a UTF-16 string representation as `Position` and [`Range`](https://hexdocs.pm/elixir/Range.html) does. *Note*: a label of type string should be a substring of its containing signature label. Its intended use case is to highlight the parameter label part in the `SignatureInformation.label`. * documentation: The human-readable doc-comment of this parameter. Will be shown in the UI but can be omitted. GenLSP.Structures.PartialResultParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/partial_result_params.ex#L2 "View Source") GenLSP.Structures.PartialResultParams (gen\_lsp v0.6.0) =============================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.PartialResultParams{}](#__struct__/0) Fields ------ * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/partial_result_params.ex#L14 "View Source") ``` @type t() :: %GenLSP.Structures.PartialResultParams{ partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.PartialResultParams{} ======================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/partial_result_params.ex#L14 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. GenLSP.Structures.Position β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/position.ex#L2 "View Source") GenLSP.Structures.Position (gen\_lsp v0.6.0) ======================================================================================================================================================================================= Position in a text document expressed as zero-based line and character offset. Prior to 3.17 the offsets were always based on a UTF-16 string representation. So a string of the form `a𐐀b` the character offset of the character `a` is 0, the character offset of `𐐀` is 1 and the character offset of b is 3 since `𐐀` is represented using two code units in UTF-16. Since 3.17 clients and servers can agree on a different string encoding representation (e.g. UTF-8). The client announces it's supported encoding via the client capability [`general.positionEncodings`](#clientCapabilities). The value is an array of position encodings the client supports, with decreasing preference (e.g. the encoding at index `0` is the most preferred one). To stay backwards compatible the only mandatory encoding is UTF-16 represented via the string `utf-16`. The server can pick one of the encodings offered by the client and signals that encoding back to the client via the initialize result's property [`capabilities.positionEncoding`](#serverCapabilities). If the string value `utf-16` is missing from the client's capability `general.positionEncodings` servers can safely assume that the client supports UTF-16. If the server omits the position encoding in its initialize result the encoding defaults to the string value `utf-16`. Implementation considerations: since the conversion from one encoding into another requires the content of the file / line the conversion is best done where the file is read which is usually on the server side. Positions are line end character agnostic. So you can not specify a position that denotes `|` or `|` where `|` represents the character offset. @since 3.17.0 - support for negotiated position encoding. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.Position{}](#__struct__/0) Fields ------ * line: Line position in a document (zero-based). [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/position.ex#L53 "View Source") ``` @type t() :: %GenLSP.Structures.Position{ character: [GenLSP.BaseTypes.uinteger](GenLSP.BaseTypes.html#t:uinteger/0)(), line: [GenLSP.BaseTypes.uinteger](GenLSP.BaseTypes.html#t:uinteger/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.Position{} ============================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/position.ex#L53 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * line: Line position in a document (zero-based). If a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document. If a line number is negative, it defaults to 0. * character: Character offset on a line in a document (zero-based). The meaning of this offset is determined by the negotiated `PositionEncodingKind`. If the character value is greater than the line length it defaults back to the line length. GenLSP.Structures.PrepareRenameParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/prepare_rename_params.ex#L2 "View Source") GenLSP.Structures.PrepareRenameParams (gen\_lsp v0.6.0) =============================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.PrepareRenameParams{}](#__struct__/0) Fields ------ * work\_done\_token: An optional token that a server can use to report work done progress. * text\_document: The text document. * position: The position inside the text document. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/prepare_rename_params.ex#L15 "View Source") ``` @type t() :: %GenLSP.Structures.PrepareRenameParams{ position: [GenLSP.Structures.Position.t](GenLSP.Structures.Position.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.PrepareRenameParams{} ======================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/prepare_rename_params.ex#L15 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_token: An optional token that a server can use to report work done progress. * text\_document: The text document. * position: The position inside the text document. GenLSP.Structures.PreviousResultId β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/previous_result_id.ex#L2 "View Source") GenLSP.Structures.PreviousResultId (gen\_lsp v0.6.0) ========================================================================================================================================================================================================= A previous result id in a workspace pull request. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.PreviousResultId{}](#__struct__/0) Fields ------ * uri: The URI for which the client knowns a result id. * value: The value of the previous result id. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/previous_result_id.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.PreviousResultId{ uri: [GenLSP.BaseTypes.document\_uri](GenLSP.BaseTypes.html#t:document_uri/0)(), value: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.PreviousResultId{} ===================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/previous_result_id.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * uri: The URI for which the client knowns a result id. * value: The value of the previous result id. GenLSP.Structures.PrivateInitializeParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/private_initialize_params.ex#L2 "View Source") GenLSP.Structures.PrivateInitializeParams (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================= The initialize parameters [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.PrivateInitializeParams{}](#__struct__/0) Fields ------ * process\_id: The process Id of the parent process that started the server. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/private_initialize_params.ex#L45 "View Source") ``` @type t() :: %GenLSP.Structures.PrivateInitializeParams{ capabilities: [GenLSP.Structures.ClientCapabilities.t](GenLSP.Structures.ClientCapabilities.html#t:t/0)(), client_info: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil, initialization_options: [GenLSP.TypeAlias.LSPAny.t](GenLSP.TypeAlias.LSPAny.html#t:t/0)() | nil, locale: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, process_id: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil, root_path: ([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil) | nil, root_uri: [GenLSP.BaseTypes.document\_uri](GenLSP.BaseTypes.html#t:document_uri/0)() | nil, trace: [GenLSP.Enumerations.TraceValues.t](GenLSP.Enumerations.TraceValues.html#t:t/0)() | nil, work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.PrivateInitializeParams{} ============================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/private_initialize_params.ex#L45 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * process\_id: The process Id of the parent process that started the server. Is `null` if the process has not been started by another process. If the parent process is not alive then the server should exit. * client\_info: Information about the client @since 3.15.0 * locale: The locale the client is currently showing the user interface in. This must not necessarily be the locale of the operating system. Uses IETF language tags as the value's syntax (See <https://en.wikipedia.org/wiki/IETF_language_tag>) @since 3.16.0 * root\_path: The rootPath of the workspace. Is null if no folder is open. @deprecated in favour of rootUri. * root\_uri: The rootUri of the workspace. Is null if no folder is open. If both `rootPath` and `rootUri` are set `rootUri` wins. @deprecated in favour of workspaceFolders. * capabilities: The capabilities provided by the client (editor or tool) * initialization\_options: User provided initialization options. * trace: The initial trace setting. If omitted trace is disabled ('off'). * work\_done\_token: An optional token that a server can use to report work done progress. GenLSP.Structures.ProgressParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/progress_params.ex#L2 "View Source") GenLSP.Structures.ProgressParams (gen\_lsp v0.6.0) ==================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ProgressParams{}](#__struct__/0) Fields ------ * token: The progress token provided by the client or server. * value: The progress data. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/progress_params.ex#L14 "View Source") ``` @type t() :: %GenLSP.Structures.ProgressParams{ token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)(), value: [GenLSP.TypeAlias.LSPAny.t](GenLSP.TypeAlias.LSPAny.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ProgressParams{} =================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/progress_params.ex#L14 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * token: The progress token provided by the client or server. * value: The progress data. GenLSP.Structures.PublishDiagnosticsClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/publish_diagnostics_client_capabilities.ex#L2 "View Source") GenLSP.Structures.PublishDiagnosticsClientCapabilities (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================================== The publish diagnostic client capabilities. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.PublishDiagnosticsClientCapabilities{}](#__struct__/0) Fields ------ * related\_information: Whether the clients accepts diagnostics with related information. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/publish_diagnostics_client_capabilities.ex#L33 "View Source") ``` @type t() :: %GenLSP.Structures.PublishDiagnosticsClientCapabilities{ code_description_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, data_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, related_information: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, tag_support: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil, version_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.PublishDiagnosticsClientCapabilities{} ========================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/publish_diagnostics_client_capabilities.ex#L33 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * related\_information: Whether the clients accepts diagnostics with related information. * tag\_support: Client supports the tag property to provide meta data about a diagnostic. Clients supporting tags have to handle unknown tags gracefully. @since 3.15.0 * version\_support: Whether the client interprets the version property of the `textDocument/publishDiagnostics` notification's parameter. @since 3.15.0 * code\_description\_support: Client supports a codeDescription property @since 3.16.0 * data\_support: Whether code action supports the `data` property which is preserved between a `textDocument/publishDiagnostics` and `textDocument/codeAction` request. @since 3.16.0 GenLSP.Structures.PublishDiagnosticsParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/publish_diagnostics_params.ex#L2 "View Source") GenLSP.Structures.PublishDiagnosticsParams (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================= The publish diagnostic notification's parameters. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.PublishDiagnosticsParams{}](#__struct__/0) Fields ------ * uri: The URI for which diagnostic information is reported. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/publish_diagnostics_params.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.PublishDiagnosticsParams{ diagnostics: [[GenLSP.Structures.Diagnostic.t](GenLSP.Structures.Diagnostic.html#t:t/0)()], uri: [GenLSP.BaseTypes.document\_uri](GenLSP.BaseTypes.html#t:document_uri/0)(), version: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.PublishDiagnosticsParams{} ============================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/publish_diagnostics_params.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * uri: The URI for which diagnostic information is reported. * version: Optional the version number of the document the diagnostics are published for. @since 3.15.0 * diagnostics: An array of diagnostic information items. GenLSP.Structures.Range β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/range.ex#L2 "View Source") GenLSP.Structures.Range (gen\_lsp v0.6.0) ================================================================================================================================================================================= A range in a text document expressed as (zero-based) start and end positions. If you want to specify a range that contains a line including the line ending character(s) then use an end position denoting the start of the next line. For example: ``` { start: { line: 5, character: 23 } end : { line 6, character : 0 } } ``` [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.Range{}](#__struct__/0) Fields ------ * start: The range's start position. * end: The range's end position. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/range.ex#L28 "View Source") ``` @type t() :: %GenLSP.Structures.Range{ end: [GenLSP.Structures.Position.t](GenLSP.Structures.Position.html#t:t/0)(), start: [GenLSP.Structures.Position.t](GenLSP.Structures.Position.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.Range{} ========================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/range.ex#L28 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * start: The range's start position. * end: The range's end position. GenLSP.Structures.ReferenceClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/reference_client_capabilities.ex#L2 "View Source") GenLSP.Structures.ReferenceClientCapabilities (gen\_lsp v0.6.0) =============================================================================================================================================================================================================================== Client Capabilities for a {@link ReferencesRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ReferenceClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether references supports dynamic registration. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/reference_client_capabilities.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.ReferenceClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ReferenceClientCapabilities{} ================================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/reference_client_capabilities.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether references supports dynamic registration. GenLSP.Structures.ReferenceContext β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/reference_context.ex#L2 "View Source") GenLSP.Structures.ReferenceContext (gen\_lsp v0.6.0) ======================================================================================================================================================================================================== Value-object that contains additional information when requesting references. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ReferenceContext{}](#__struct__/0) Fields ------ * include\_declaration: Include the declaration of the current symbol. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/reference_context.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.ReferenceContext{include_declaration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ReferenceContext{} ===================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/reference_context.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * include\_declaration: Include the declaration of the current symbol. GenLSP.Structures.ReferenceOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/reference_options.ex#L2 "View Source") GenLSP.Structures.ReferenceOptions (gen\_lsp v0.6.0) ======================================================================================================================================================================================================== Reference options. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ReferenceOptions{}](#__struct__/0) Fields ------ * work\_done\_progress [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/reference_options.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.ReferenceOptions{work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ReferenceOptions{} ===================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/reference_options.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_progress GenLSP.Structures.ReferenceParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/reference_params.ex#L2 "View Source") GenLSP.Structures.ReferenceParams (gen\_lsp v0.6.0) ====================================================================================================================================================================================================== Parameters for a {@link ReferencesRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ReferenceParams{}](#__struct__/0) Fields ------ * context * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. * text\_document: The text document. * position: The position inside the text document. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/reference_params.ex#L22 "View Source") ``` @type t() :: %GenLSP.Structures.ReferenceParams{ context: [GenLSP.Structures.ReferenceContext.t](GenLSP.Structures.ReferenceContext.html#t:t/0)(), partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, position: [GenLSP.Structures.Position.t](GenLSP.Structures.Position.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ReferenceParams{} ==================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/reference_params.ex#L22 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * context * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. * text\_document: The text document. * position: The position inside the text document. GenLSP.Structures.ReferenceRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/reference_registration_options.ex#L2 "View Source") GenLSP.Structures.ReferenceRegistrationOptions (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================= Registration options for a {@link ReferencesRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ReferenceRegistrationOptions{}](#__struct__/0) Fields ------ * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/reference_registration_options.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.ReferenceRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ReferenceRegistrationOptions{} ================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/reference_registration_options.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. GenLSP.Structures.Registration β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/registration.ex#L2 "View Source") GenLSP.Structures.Registration (gen\_lsp v0.6.0) =============================================================================================================================================================================================== General parameters to register for a notification or to register a provider. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.Registration{}](#__struct__/0) Fields ------ * id: The id used to register the request. The id can be used to deregister the request again. * method: The method / capability to register for. * register\_options: Options necessary for the registration. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/registration.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.Registration{ id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), register_options: [GenLSP.TypeAlias.LSPAny.t](GenLSP.TypeAlias.LSPAny.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.Registration{} ================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/registration.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * id: The id used to register the request. The id can be used to deregister the request again. * method: The method / capability to register for. * register\_options: Options necessary for the registration. GenLSP.Structures.RegistrationParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/registration_params.ex#L2 "View Source") GenLSP.Structures.RegistrationParams (gen\_lsp v0.6.0) ============================================================================================================================================================================================================ [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.RegistrationParams{}](#__struct__/0) Fields ------ * registrations [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/registration_params.ex#L13 "View Source") ``` @type t() :: %GenLSP.Structures.RegistrationParams{ registrations: [[GenLSP.Structures.Registration.t](GenLSP.Structures.Registration.html#t:t/0)()] } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.RegistrationParams{} ======================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/registration_params.ex#L13 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * registrations GenLSP.Structures.RegularExpressionsClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/regular_expressions_client_capabilities.ex#L2 "View Source") GenLSP.Structures.RegularExpressionsClientCapabilities (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================================== Client capabilities specific to regular expressions. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.RegularExpressionsClientCapabilities{}](#__struct__/0) Fields ------ * engine: The engine's name. * version: The engine's version. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/regular_expressions_client_capabilities.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.RegularExpressionsClientCapabilities{ engine: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), version: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.RegularExpressionsClientCapabilities{} ========================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/regular_expressions_client_capabilities.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * engine: The engine's name. * version: The engine's version. GenLSP.Structures.RelatedFullDocumentDiagnosticReport β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/related_full_document_diagnostic_report.ex#L2 "View Source") GenLSP.Structures.RelatedFullDocumentDiagnosticReport (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================================= A full diagnostic report with a set of related documents. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.RelatedFullDocumentDiagnosticReport{}](#__struct__/0) Fields ------ * related\_documents: Diagnostics of related documents. This information is useful in programming languages where code in a file A can generate diagnostics in a file B which A depends on. An example of such a language is C/C++ where marco definitions in a file a.cpp and result in errors in a header file b.hpp. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/related_full_document_diagnostic_report.ex#L30 "View Source") ``` @type t() :: %GenLSP.Structures.RelatedFullDocumentDiagnosticReport{ items: [[GenLSP.Structures.Diagnostic.t](GenLSP.Structures.Diagnostic.html#t:t/0)()], kind: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), related_documents: %{ required([GenLSP.BaseTypes.document\_uri](GenLSP.BaseTypes.html#t:document_uri/0)()) => [GenLSP.Structures.FullDocumentDiagnosticReport.t](GenLSP.Structures.FullDocumentDiagnosticReport.html#t:t/0)() | [GenLSP.Structures.UnchangedDocumentDiagnosticReport.t](GenLSP.Structures.UnchangedDocumentDiagnosticReport.html#t:t/0)() } | nil, result_id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.RelatedFullDocumentDiagnosticReport{} ======================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/related_full_document_diagnostic_report.ex#L30 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * related\_documents: Diagnostics of related documents. This information is useful in programming languages where code in a file A can generate diagnostics in a file B which A depends on. An example of such a language is C/C++ where marco definitions in a file a.cpp and result in errors in a header file b.hpp. @since 3.17.0 * kind: A full document diagnostic report. * result\_id: An optional result id. If provided it will be sent on the next diagnostic request for the same document. * items: The actual items. GenLSP.Structures.RelatedUnchangedDocumentDiagnosticReport β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/related_unchanged_document_diagnostic_report.ex#L2 "View Source") GenLSP.Structures.RelatedUnchangedDocumentDiagnosticReport (gen\_lsp v0.6.0) =========================================================================================================================================================================================================================================================== An unchanged diagnostic report with a set of related documents. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.RelatedUnchangedDocumentDiagnosticReport{}](#__struct__/0) Fields ------ * related\_documents: Diagnostics of related documents. This information is useful in programming languages where code in a file A can generate diagnostics in a file B which A depends on. An example of such a language is C/C++ where marco definitions in a file a.cpp and result in errors in a header file b.hpp. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/related_unchanged_document_diagnostic_report.ex#L31 "View Source") ``` @type t() :: %GenLSP.Structures.RelatedUnchangedDocumentDiagnosticReport{ kind: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), related_documents: %{ required([GenLSP.BaseTypes.document\_uri](GenLSP.BaseTypes.html#t:document_uri/0)()) => [GenLSP.Structures.FullDocumentDiagnosticReport.t](GenLSP.Structures.FullDocumentDiagnosticReport.html#t:t/0)() | [GenLSP.Structures.UnchangedDocumentDiagnosticReport.t](GenLSP.Structures.UnchangedDocumentDiagnosticReport.html#t:t/0)() } | nil, result_id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.RelatedUnchangedDocumentDiagnosticReport{} ============================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/related_unchanged_document_diagnostic_report.ex#L31 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * related\_documents: Diagnostics of related documents. This information is useful in programming languages where code in a file A can generate diagnostics in a file B which A depends on. An example of such a language is C/C++ where marco definitions in a file a.cpp and result in errors in a header file b.hpp. @since 3.17.0 * kind: A document diagnostic report indicating no changes to the last result. A server can only return `unchanged` if result ids are provided. * result\_id: A result id which will be sent on the next diagnostic request for the same document. GenLSP.Structures.RelativePattern β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/relative_pattern.ex#L2 "View Source") GenLSP.Structures.RelativePattern (gen\_lsp v0.6.0) ====================================================================================================================================================================================================== A relative pattern is a helper to construct glob patterns that are matched relatively to a base URI. The common value for a `baseUri` is a workspace folder root, but it can be another absolute URI as well. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.RelativePattern{}](#__struct__/0) Fields ------ * base\_uri: A workspace folder or a base URI to which this pattern will be matched against relatively. * pattern: The actual glob pattern; [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/relative_pattern.ex#L23 "View Source") ``` @type t() :: %GenLSP.Structures.RelativePattern{ base_uri: [GenLSP.Structures.WorkspaceFolder.t](GenLSP.Structures.WorkspaceFolder.html#t:t/0)() | [GenLSP.BaseTypes.uri](GenLSP.BaseTypes.html#t:uri/0)(), pattern: [GenLSP.TypeAlias.Pattern.t](GenLSP.TypeAlias.Pattern.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.RelativePattern{} ==================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/relative_pattern.ex#L23 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * base\_uri: A workspace folder or a base URI to which this pattern will be matched against relatively. * pattern: The actual glob pattern; GenLSP.Structures.RenameClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/rename_client_capabilities.ex#L2 "View Source") GenLSP.Structures.RenameClientCapabilities (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================= [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.RenameClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether rename supports dynamic registration. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/rename_client_capabilities.ex#L30 "View Source") ``` @type t() :: %GenLSP.Structures.RenameClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, honors_change_annotations: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, prepare_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, prepare_support_default_behavior: [GenLSP.Enumerations.PrepareSupportDefaultBehavior.t](GenLSP.Enumerations.PrepareSupportDefaultBehavior.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.RenameClientCapabilities{} ============================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/rename_client_capabilities.ex#L30 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether rename supports dynamic registration. * prepare\_support: Client supports testing for validity of rename operations before execution. @since 3.12.0 * prepare\_support\_default\_behavior: Client supports the default behavior result. The value indicates the default behavior used by the client. @since 3.16.0 * honors\_change\_annotations: Whether the client honors the change annotations in text edits and resource operations returned via the rename request's workspace edit by for example presenting the workspace edit in the user interface and asking for confirmation. @since 3.16.0 GenLSP.Structures.RenameFile β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/rename_file.ex#L2 "View Source") GenLSP.Structures.RenameFile (gen\_lsp v0.6.0) ============================================================================================================================================================================================ Rename file operation [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.RenameFile{}](#__struct__/0) Fields ------ * kind: A rename [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/rename_file.ex#L23 "View Source") ``` @type t() :: %GenLSP.Structures.RenameFile{ annotation_id: [GenLSP.TypeAlias.ChangeAnnotationIdentifier.t](GenLSP.TypeAlias.ChangeAnnotationIdentifier.html#t:t/0)() | nil, kind: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), new_uri: [GenLSP.BaseTypes.document\_uri](GenLSP.BaseTypes.html#t:document_uri/0)(), old_uri: [GenLSP.BaseTypes.document\_uri](GenLSP.BaseTypes.html#t:document_uri/0)(), options: [GenLSP.Structures.RenameFileOptions.t](GenLSP.Structures.RenameFileOptions.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.RenameFile{} =============================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/rename_file.ex#L23 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * kind: A rename * old\_uri: The old (existing) location. * new\_uri: The new location. * options: Rename options. * annotation\_id: An optional annotation identifier describing the operation. @since 3.16.0 GenLSP.Structures.RenameFileOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/rename_file_options.ex#L2 "View Source") GenLSP.Structures.RenameFileOptions (gen\_lsp v0.6.0) =========================================================================================================================================================================================================== Rename file options [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.RenameFileOptions{}](#__struct__/0) Fields ------ * overwrite: Overwrite target if existing. Overwrite wins over `ignoreIfExists` * ignore\_if\_exists: Ignores if target exists. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/rename_file_options.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.RenameFileOptions{ ignore_if_exists: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, overwrite: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.RenameFileOptions{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/rename_file_options.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * overwrite: Overwrite target if existing. Overwrite wins over `ignoreIfExists` * ignore\_if\_exists: Ignores if target exists. GenLSP.Structures.RenameFilesParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/rename_files_params.ex#L2 "View Source") GenLSP.Structures.RenameFilesParams (gen\_lsp v0.6.0) =========================================================================================================================================================================================================== The parameters sent in notifications/requests for user-initiated renames of files. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.RenameFilesParams{}](#__struct__/0) Fields ------ * files: An array of all files/folders renamed in this operation. When a folder is renamed, only the folder will be included, and not its children. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/rename_files_params.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.RenameFilesParams{ files: [[GenLSP.Structures.FileRename.t](GenLSP.Structures.FileRename.html#t:t/0)()] } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.RenameFilesParams{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/rename_files_params.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * files: An array of all files/folders renamed in this operation. When a folder is renamed, only the folder will be included, and not its children. GenLSP.Structures.RenameOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/rename_options.ex#L2 "View Source") GenLSP.Structures.RenameOptions (gen\_lsp v0.6.0) ================================================================================================================================================================================================== Provider options for a {@link RenameRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.RenameOptions{}](#__struct__/0) Fields ------ * prepare\_provider: Renames should be checked and tested before being executed. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/rename_options.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.RenameOptions{ prepare_provider: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.RenameOptions{} ================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/rename_options.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * prepare\_provider: Renames should be checked and tested before being executed. @since version 3.12.0 * work\_done\_progress GenLSP.Structures.RenameParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/rename_params.ex#L2 "View Source") GenLSP.Structures.RenameParams (gen\_lsp v0.6.0) ================================================================================================================================================================================================ The parameters of a {@link RenameRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.RenameParams{}](#__struct__/0) Fields ------ * text\_document: The document to rename. * position: The position at which this request was sent. * new\_name: The new name of the symbol. If the given name is not valid the request must return a {@link ResponseError} with an appropriate message set. * work\_done\_token: An optional token that a server can use to report work done progress. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/rename_params.ex#L22 "View Source") ``` @type t() :: %GenLSP.Structures.RenameParams{ new_name: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), position: [GenLSP.Structures.Position.t](GenLSP.Structures.Position.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.RenameParams{} ================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/rename_params.ex#L22 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * text\_document: The document to rename. * position: The position at which this request was sent. * new\_name: The new name of the symbol. If the given name is not valid the request must return a {@link ResponseError} with an appropriate message set. * work\_done\_token: An optional token that a server can use to report work done progress. GenLSP.Structures.RenameRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/rename_registration_options.ex#L2 "View Source") GenLSP.Structures.RenameRegistrationOptions (gen\_lsp v0.6.0) =========================================================================================================================================================================================================================== Registration options for a {@link RenameRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.RenameRegistrationOptions{}](#__struct__/0) Fields ------ * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/rename_registration_options.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.RenameRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil, prepare_provider: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.RenameRegistrationOptions{} ============================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/rename_registration_options.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. * prepare\_provider: Renames should be checked and tested before being executed. @since version 3.12.0 GenLSP.Structures.ResourceOperation β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/resource_operation.ex#L2 "View Source") GenLSP.Structures.ResourceOperation (gen\_lsp v0.6.0) ========================================================================================================================================================================================================== A generic resource operation. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ResourceOperation{}](#__struct__/0) Fields ------ * kind: The resource operation kind. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/resource_operation.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.ResourceOperation{ annotation_id: [GenLSP.TypeAlias.ChangeAnnotationIdentifier.t](GenLSP.TypeAlias.ChangeAnnotationIdentifier.html#t:t/0)() | nil, kind: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ResourceOperation{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/resource_operation.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * kind: The resource operation kind. * annotation\_id: An optional annotation identifier describing the operation. @since 3.16.0 GenLSP.Structures.SaveOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/save_options.ex#L2 "View Source") GenLSP.Structures.SaveOptions (gen\_lsp v0.6.0) ============================================================================================================================================================================================== Save options. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SaveOptions{}](#__struct__/0) Fields ------ * include\_text: The client is supposed to include the content on save. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/save_options.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.SaveOptions{include_text: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SaveOptions{} ================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/save_options.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * include\_text: The client is supposed to include the content on save. GenLSP.Structures.SelectionRange β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/selection_range.ex#L2 "View Source") GenLSP.Structures.SelectionRange (gen\_lsp v0.6.0) ==================================================================================================================================================================================================== A selection range represents a part of a selection hierarchy. A selection range may have a parent selection range that contains it. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SelectionRange{}](#__struct__/0) Fields ------ * range: The {@link Range range} of this selection range. * parent: The parent selection range containing this range. Therefore `parent.range` must contain `this.range`. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/selection_range.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.SelectionRange{ parent: [t](#t:t/0)() | nil, range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SelectionRange{} =================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/selection_range.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * range: The {@link Range range} of this selection range. * parent: The parent selection range containing this range. Therefore `parent.range` must contain `this.range`. GenLSP.Structures.SelectionRangeClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/selection_range_client_capabilities.ex#L2 "View Source") GenLSP.Structures.SelectionRangeClientCapabilities (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SelectionRangeClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether implementation supports dynamic registration for selection range providers. If this is set to `true` the client supports the new `SelectionRangeRegistrationOptions` return value for the corresponding server capability as well. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/selection_range_client_capabilities.ex#L15 "View Source") ``` @type t() :: %GenLSP.Structures.SelectionRangeClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SelectionRangeClientCapabilities{} ===================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/selection_range_client_capabilities.ex#L15 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether implementation supports dynamic registration for selection range providers. If this is set to `true` the client supports the new `SelectionRangeRegistrationOptions` return value for the corresponding server capability as well. GenLSP.Structures.SelectionRangeOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/selection_range_options.ex#L2 "View Source") GenLSP.Structures.SelectionRangeOptions (gen\_lsp v0.6.0) =================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SelectionRangeOptions{}](#__struct__/0) Fields ------ * work\_done\_progress [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/selection_range_options.ex#L13 "View Source") ``` @type t() :: %GenLSP.Structures.SelectionRangeOptions{ work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SelectionRangeOptions{} ========================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/selection_range_options.ex#L13 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_progress GenLSP.Structures.SelectionRangeParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/selection_range_params.ex#L2 "View Source") GenLSP.Structures.SelectionRangeParams (gen\_lsp v0.6.0) ================================================================================================================================================================================================================= A parameter literal used in selection range requests. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SelectionRangeParams{}](#__struct__/0) Fields ------ * text\_document: The text document. * positions: The positions inside the text document. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/selection_range_params.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.SelectionRangeParams{ partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, positions: [[GenLSP.Structures.Position.t](GenLSP.Structures.Position.html#t:t/0)()], text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SelectionRangeParams{} ========================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/selection_range_params.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * text\_document: The text document. * positions: The positions inside the text document. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. GenLSP.Structures.SelectionRangeRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/selection_range_registration_options.ex#L2 "View Source") GenLSP.Structures.SelectionRangeRegistrationOptions (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================================ [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SelectionRangeRegistrationOptions{}](#__struct__/0) Fields ------ * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/selection_range_registration_options.ex#L16 "View Source") ``` @type t() :: %GenLSP.Structures.SelectionRangeRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil, id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SelectionRangeRegistrationOptions{} ====================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/selection_range_registration_options.ex#L16 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. GenLSP.Structures.SemanticTokens β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens.ex#L2 "View Source") GenLSP.Structures.SemanticTokens (gen\_lsp v0.6.0) ==================================================================================================================================================================================================== @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SemanticTokens{}](#__struct__/0) Fields ------ * result\_id: An optional result id. If provided and clients support delta updating the client will include the result id in the next semantic token request. A server can then instead of computing all semantic tokens again simply send a delta. * data: The actual tokens. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.SemanticTokens{ data: [[GenLSP.BaseTypes.uinteger](GenLSP.BaseTypes.html#t:uinteger/0)()], result_id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SemanticTokens{} =================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * result\_id: An optional result id. If provided and clients support delta updating the client will include the result id in the next semantic token request. A server can then instead of computing all semantic tokens again simply send a delta. * data: The actual tokens. GenLSP.Structures.SemanticTokensClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_client_capabilities.ex#L2 "View Source") GenLSP.Structures.SemanticTokensClientCapabilities (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================================== @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SemanticTokensClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether implementation supports dynamic registration. If this is set to `true` the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` return value for the corresponding server capability as well. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_client_capabilities.ex#L48 "View Source") ``` @type t() :: %GenLSP.Structures.SemanticTokensClientCapabilities{ augments_syntax_tokens: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, formats: [[GenLSP.Enumerations.TokenFormat.t](GenLSP.Enumerations.TokenFormat.html#t:t/0)()], multiline_token_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, overlapping_token_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, requests: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), server_cancel_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, token_modifiers: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()], token_types: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SemanticTokensClientCapabilities{} ===================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_client_capabilities.ex#L48 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether implementation supports dynamic registration. If this is set to `true` the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` return value for the corresponding server capability as well. * requests: Which requests the client supports and might send to the server depending on the server's capability. Please note that clients might not show semantic tokens or degrade some of the user experience if a range or full request is advertised by the client but not provided by the server. If for example the client capability `requests.full` and `request.range` are both set to true but the server only provides a range provider the client might not render a minimap correctly or might even decide to not show any semantic tokens at all. * token\_types: The token types that the client supports. * token\_modifiers: The token modifiers that the client supports. * formats: The token formats the clients supports. * overlapping\_token\_support: Whether the client supports tokens that can overlap each other. * multiline\_token\_support: Whether the client supports tokens that can span multiple lines. * server\_cancel\_support: Whether the client allows the server to actively cancel a semantic token request, e.g. supports returning LSPErrorCodes.ServerCancelled. If a server does the client needs to retrigger the request. @since 3.17.0 * augments\_syntax\_tokens: Whether the client uses semantic tokens to augment existing syntax tokens. If set to `true` client side created syntax tokens and semantic tokens are both used for colorization. If set to `false` the client only uses the returned semantic tokens for colorization. If the value is `undefined` then the client behavior is not specified. @since 3.17.0 GenLSP.Structures.SemanticTokensDelta β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_delta.ex#L2 "View Source") GenLSP.Structures.SemanticTokensDelta (gen\_lsp v0.6.0) =============================================================================================================================================================================================================== @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SemanticTokensDelta{}](#__struct__/0) Fields ------ * result\_id * edits: The semantic token edits to transform a previous result into a new result. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_delta.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.SemanticTokensDelta{ edits: [[GenLSP.Structures.SemanticTokensEdit.t](GenLSP.Structures.SemanticTokensEdit.html#t:t/0)()], result_id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SemanticTokensDelta{} ======================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_delta.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * result\_id * edits: The semantic token edits to transform a previous result into a new result. GenLSP.Structures.SemanticTokensDeltaParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_delta_params.ex#L2 "View Source") GenLSP.Structures.SemanticTokensDeltaParams (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================ @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SemanticTokensDeltaParams{}](#__struct__/0) Fields ------ * text\_document: The text document. * previous\_result\_id: The result id of a previous response. The result Id can either point to a full response or a delta response depending on what was received last. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_delta_params.ex#L22 "View Source") ``` @type t() :: %GenLSP.Structures.SemanticTokensDeltaParams{ partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, previous_result_id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SemanticTokensDeltaParams{} ============================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_delta_params.ex#L22 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * text\_document: The text document. * previous\_result\_id: The result id of a previous response. The result Id can either point to a full response or a delta response depending on what was received last. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. GenLSP.Structures.SemanticTokensDeltaPartialResult β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_delta_partial_result.ex#L2 "View Source") GenLSP.Structures.SemanticTokensDeltaPartialResult (gen\_lsp v0.6.0) =========================================================================================================================================================================================================================================== @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SemanticTokensDeltaPartialResult{}](#__struct__/0) Fields ------ * edits [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_delta_partial_result.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.SemanticTokensDeltaPartialResult{ edits: [[GenLSP.Structures.SemanticTokensEdit.t](GenLSP.Structures.SemanticTokensEdit.html#t:t/0)()] } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SemanticTokensDeltaPartialResult{} ===================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_delta_partial_result.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * edits GenLSP.Structures.SemanticTokensEdit β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_edit.ex#L2 "View Source") GenLSP.Structures.SemanticTokensEdit (gen\_lsp v0.6.0) ============================================================================================================================================================================================================= @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SemanticTokensEdit{}](#__struct__/0) Fields ------ * start: The start offset of the edit. * delete\_count: The count of elements to remove. * data: The elements to insert. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_edit.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.SemanticTokensEdit{ data: [[GenLSP.BaseTypes.uinteger](GenLSP.BaseTypes.html#t:uinteger/0)()] | nil, delete_count: [GenLSP.BaseTypes.uinteger](GenLSP.BaseTypes.html#t:uinteger/0)(), start: [GenLSP.BaseTypes.uinteger](GenLSP.BaseTypes.html#t:uinteger/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SemanticTokensEdit{} ======================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_edit.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * start: The start offset of the edit. * delete\_count: The count of elements to remove. * data: The elements to insert. GenLSP.Structures.SemanticTokensLegend β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_legend.ex#L2 "View Source") GenLSP.Structures.SemanticTokensLegend (gen\_lsp v0.6.0) ================================================================================================================================================================================================================= @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SemanticTokensLegend{}](#__struct__/0) Fields ------ * token\_types: The token types a server uses. * token\_modifiers: The token modifiers a server uses. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_legend.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.SemanticTokensLegend{ token_modifiers: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()], token_types: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SemanticTokensLegend{} ========================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_legend.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * token\_types: The token types a server uses. * token\_modifiers: The token modifiers a server uses. GenLSP.Structures.SemanticTokensOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_options.ex#L2 "View Source") GenLSP.Structures.SemanticTokensOptions (gen\_lsp v0.6.0) =================================================================================================================================================================================================================== @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SemanticTokensOptions{}](#__struct__/0) Fields ------ * legend: The legend used by the server * range: Server supports providing semantic tokens for a specific range of a document. * full: Server supports providing semantic tokens for a full document. * work\_done\_progress [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_options.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.SemanticTokensOptions{ full: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) | nil, legend: [GenLSP.Structures.SemanticTokensLegend.t](GenLSP.Structures.SemanticTokensLegend.html#t:t/0)(), range: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) | nil, work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SemanticTokensOptions{} ========================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_options.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * legend: The legend used by the server * range: Server supports providing semantic tokens for a specific range of a document. * full: Server supports providing semantic tokens for a full document. * work\_done\_progress GenLSP.Structures.SemanticTokensParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_params.ex#L2 "View Source") GenLSP.Structures.SemanticTokensParams (gen\_lsp v0.6.0) ================================================================================================================================================================================================================= @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SemanticTokensParams{}](#__struct__/0) Fields ------ * text\_document: The text document. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_params.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.SemanticTokensParams{ partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SemanticTokensParams{} ========================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_params.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * text\_document: The text document. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. GenLSP.Structures.SemanticTokensPartialResult β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_partial_result.ex#L2 "View Source") GenLSP.Structures.SemanticTokensPartialResult (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================ @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SemanticTokensPartialResult{}](#__struct__/0) Fields ------ * data [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_partial_result.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.SemanticTokensPartialResult{ data: [[GenLSP.BaseTypes.uinteger](GenLSP.BaseTypes.html#t:uinteger/0)()] } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SemanticTokensPartialResult{} ================================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_partial_result.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * data GenLSP.Structures.SemanticTokensRangeParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_range_params.ex#L2 "View Source") GenLSP.Structures.SemanticTokensRangeParams (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================ @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SemanticTokensRangeParams{}](#__struct__/0) Fields ------ * text\_document: The text document. * range: The range the semantic tokens are requested for. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_range_params.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.SemanticTokensRangeParams{ partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SemanticTokensRangeParams{} ============================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_range_params.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * text\_document: The text document. * range: The range the semantic tokens are requested for. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. GenLSP.Structures.SemanticTokensRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_registration_options.ex#L2 "View Source") GenLSP.Structures.SemanticTokensRegistrationOptions (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================================ @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SemanticTokensRegistrationOptions{}](#__struct__/0) Fields ------ * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. * legend: The legend used by the server * range: Server supports providing semantic tokens for a specific range of a document. * full: Server supports providing semantic tokens for a full document. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_registration_options.ex#L24 "View Source") ``` @type t() :: %GenLSP.Structures.SemanticTokensRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil, full: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) | nil, id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, legend: [GenLSP.Structures.SemanticTokensLegend.t](GenLSP.Structures.SemanticTokensLegend.html#t:t/0)(), range: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SemanticTokensRegistrationOptions{} ====================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_registration_options.ex#L24 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. * legend: The legend used by the server * range: Server supports providing semantic tokens for a specific range of a document. * full: Server supports providing semantic tokens for a full document. GenLSP.Structures.SemanticTokensWorkspaceClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_workspace_client_capabilities.ex#L2 "View Source") GenLSP.Structures.SemanticTokensWorkspaceClientCapabilities (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================================================= @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SemanticTokensWorkspaceClientCapabilities{}](#__struct__/0) Fields ------ * refresh\_support: Whether the client implementation supports a refresh request sent from the server to the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_workspace_client_capabilities.ex#L23 "View Source") ``` @type t() :: %GenLSP.Structures.SemanticTokensWorkspaceClientCapabilities{ refresh_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SemanticTokensWorkspaceClientCapabilities{} ============================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/semantic_tokens_workspace_client_capabilities.ex#L23 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * refresh\_support: Whether the client implementation supports a refresh request sent from the server to the client. Note that this event is global and will force the client to refresh all semantic tokens currently shown. It should be used with absolute care and is useful for situation where a server for example detects a project wide change that requires such a calculation. GenLSP.Structures.ServerCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/server_capabilities.ex#L2 "View Source") GenLSP.Structures.ServerCapabilities (gen\_lsp v0.6.0) ============================================================================================================================================================================================================ Defines the capabilities provided by a language server. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ServerCapabilities{}](#__struct__/0) Fields ------ * position\_encoding: The position encoding the server picked from the encodings offered by the client via the client capability `general.positionEncodings`. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/server_capabilities.ex#L84 "View Source") ``` @type t() :: %GenLSP.Structures.ServerCapabilities{ call_hierarchy_provider: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [GenLSP.Structures.CallHierarchyOptions.t](GenLSP.Structures.CallHierarchyOptions.html#t:t/0)() | [GenLSP.Structures.CallHierarchyRegistrationOptions.t](GenLSP.Structures.CallHierarchyRegistrationOptions.html#t:t/0)()) | nil, code_action_provider: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [GenLSP.Structures.CodeActionOptions.t](GenLSP.Structures.CodeActionOptions.html#t:t/0)()) | nil, code_lens_provider: [GenLSP.Structures.CodeLensOptions.t](GenLSP.Structures.CodeLensOptions.html#t:t/0)() | nil, color_provider: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [GenLSP.Structures.DocumentColorOptions.t](GenLSP.Structures.DocumentColorOptions.html#t:t/0)() | [GenLSP.Structures.DocumentColorRegistrationOptions.t](GenLSP.Structures.DocumentColorRegistrationOptions.html#t:t/0)()) | nil, completion_provider: [GenLSP.Structures.CompletionOptions.t](GenLSP.Structures.CompletionOptions.html#t:t/0)() | nil, declaration_provider: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [GenLSP.Structures.DeclarationOptions.t](GenLSP.Structures.DeclarationOptions.html#t:t/0)() | [GenLSP.Structures.DeclarationRegistrationOptions.t](GenLSP.Structures.DeclarationRegistrationOptions.html#t:t/0)()) | nil, definition_provider: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [GenLSP.Structures.DefinitionOptions.t](GenLSP.Structures.DefinitionOptions.html#t:t/0)()) | nil, diagnostic_provider: ([GenLSP.Structures.DiagnosticOptions.t](GenLSP.Structures.DiagnosticOptions.html#t:t/0)() | [GenLSP.Structures.DiagnosticRegistrationOptions.t](GenLSP.Structures.DiagnosticRegistrationOptions.html#t:t/0)()) | nil, document_formatting_provider: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [GenLSP.Structures.DocumentFormattingOptions.t](GenLSP.Structures.DocumentFormattingOptions.html#t:t/0)()) | nil, document_highlight_provider: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [GenLSP.Structures.DocumentHighlightOptions.t](GenLSP.Structures.DocumentHighlightOptions.html#t:t/0)()) | nil, document_link_provider: [GenLSP.Structures.DocumentLinkOptions.t](GenLSP.Structures.DocumentLinkOptions.html#t:t/0)() | nil, document_on_type_formatting_provider: [GenLSP.Structures.DocumentOnTypeFormattingOptions.t](GenLSP.Structures.DocumentOnTypeFormattingOptions.html#t:t/0)() | nil, document_range_formatting_provider: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [GenLSP.Structures.DocumentRangeFormattingOptions.t](GenLSP.Structures.DocumentRangeFormattingOptions.html#t:t/0)()) | nil, document_symbol_provider: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [GenLSP.Structures.DocumentSymbolOptions.t](GenLSP.Structures.DocumentSymbolOptions.html#t:t/0)()) | nil, execute_command_provider: [GenLSP.Structures.ExecuteCommandOptions.t](GenLSP.Structures.ExecuteCommandOptions.html#t:t/0)() | nil, experimental: [GenLSP.TypeAlias.LSPAny.t](GenLSP.TypeAlias.LSPAny.html#t:t/0)() | nil, folding_range_provider: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [GenLSP.Structures.FoldingRangeOptions.t](GenLSP.Structures.FoldingRangeOptions.html#t:t/0)() | [GenLSP.Structures.FoldingRangeRegistrationOptions.t](GenLSP.Structures.FoldingRangeRegistrationOptions.html#t:t/0)()) | nil, hover_provider: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [GenLSP.Structures.HoverOptions.t](GenLSP.Structures.HoverOptions.html#t:t/0)()) | nil, implementation_provider: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [GenLSP.Structures.ImplementationOptions.t](GenLSP.Structures.ImplementationOptions.html#t:t/0)() | [GenLSP.Structures.ImplementationRegistrationOptions.t](GenLSP.Structures.ImplementationRegistrationOptions.html#t:t/0)()) | nil, inlay_hint_provider: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [GenLSP.Structures.InlayHintOptions.t](GenLSP.Structures.InlayHintOptions.html#t:t/0)() | [GenLSP.Structures.InlayHintRegistrationOptions.t](GenLSP.Structures.InlayHintRegistrationOptions.html#t:t/0)()) | nil, inline_value_provider: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [GenLSP.Structures.InlineValueOptions.t](GenLSP.Structures.InlineValueOptions.html#t:t/0)() | [GenLSP.Structures.InlineValueRegistrationOptions.t](GenLSP.Structures.InlineValueRegistrationOptions.html#t:t/0)()) | nil, linked_editing_range_provider: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [GenLSP.Structures.LinkedEditingRangeOptions.t](GenLSP.Structures.LinkedEditingRangeOptions.html#t:t/0)() | [GenLSP.Structures.LinkedEditingRangeRegistrationOptions.t](GenLSP.Structures.LinkedEditingRangeRegistrationOptions.html#t:t/0)()) | nil, moniker_provider: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [GenLSP.Structures.MonikerOptions.t](GenLSP.Structures.MonikerOptions.html#t:t/0)() | [GenLSP.Structures.MonikerRegistrationOptions.t](GenLSP.Structures.MonikerRegistrationOptions.html#t:t/0)()) | nil, notebook_document_sync: ([GenLSP.Structures.NotebookDocumentSyncOptions.t](GenLSP.Structures.NotebookDocumentSyncOptions.html#t:t/0)() | [GenLSP.Structures.NotebookDocumentSyncRegistrationOptions.t](GenLSP.Structures.NotebookDocumentSyncRegistrationOptions.html#t:t/0)()) | nil, position_encoding: [GenLSP.Enumerations.PositionEncodingKind.t](GenLSP.Enumerations.PositionEncodingKind.html#t:t/0)() | nil, references_provider: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [GenLSP.Structures.ReferenceOptions.t](GenLSP.Structures.ReferenceOptions.html#t:t/0)()) | nil, rename_provider: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [GenLSP.Structures.RenameOptions.t](GenLSP.Structures.RenameOptions.html#t:t/0)()) | nil, selection_range_provider: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [GenLSP.Structures.SelectionRangeOptions.t](GenLSP.Structures.SelectionRangeOptions.html#t:t/0)() | [GenLSP.Structures.SelectionRangeRegistrationOptions.t](GenLSP.Structures.SelectionRangeRegistrationOptions.html#t:t/0)()) | nil, semantic_tokens_provider: ([GenLSP.Structures.SemanticTokensOptions.t](GenLSP.Structures.SemanticTokensOptions.html#t:t/0)() | [GenLSP.Structures.SemanticTokensRegistrationOptions.t](GenLSP.Structures.SemanticTokensRegistrationOptions.html#t:t/0)()) | nil, signature_help_provider: [GenLSP.Structures.SignatureHelpOptions.t](GenLSP.Structures.SignatureHelpOptions.html#t:t/0)() | nil, text_document_sync: ([GenLSP.Structures.TextDocumentSyncOptions.t](GenLSP.Structures.TextDocumentSyncOptions.html#t:t/0)() | [GenLSP.Enumerations.TextDocumentSyncKind.t](GenLSP.Enumerations.TextDocumentSyncKind.html#t:t/0)()) | nil, type_definition_provider: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [GenLSP.Structures.TypeDefinitionOptions.t](GenLSP.Structures.TypeDefinitionOptions.html#t:t/0)() | [GenLSP.Structures.TypeDefinitionRegistrationOptions.t](GenLSP.Structures.TypeDefinitionRegistrationOptions.html#t:t/0)()) | nil, type_hierarchy_provider: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [GenLSP.Structures.TypeHierarchyOptions.t](GenLSP.Structures.TypeHierarchyOptions.html#t:t/0)() | [GenLSP.Structures.TypeHierarchyRegistrationOptions.t](GenLSP.Structures.TypeHierarchyRegistrationOptions.html#t:t/0)()) | nil, workspace: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil, workspace_symbol_provider: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [GenLSP.Structures.WorkspaceSymbolOptions.t](GenLSP.Structures.WorkspaceSymbolOptions.html#t:t/0)()) | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ServerCapabilities{} ======================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/server_capabilities.ex#L84 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * position\_encoding: The position encoding the server picked from the encodings offered by the client via the client capability `general.positionEncodings`. If the client didn't provide any position encodings the only valid value that a server can return is 'utf-16'. If omitted it defaults to 'utf-16'. @since 3.17.0 * text\_document\_sync: Defines how text documents are synced. Is either a detailed structure defining each notification or for backwards compatibility the TextDocumentSyncKind number. * notebook\_document\_sync: Defines how notebook documents are synced. @since 3.17.0 * completion\_provider: The server provides completion support. * hover\_provider: The server provides hover support. * signature\_help\_provider: The server provides signature help support. * declaration\_provider: The server provides Goto Declaration support. * definition\_provider: The server provides goto definition support. * type\_definition\_provider: The server provides Goto Type Definition support. * implementation\_provider: The server provides Goto Implementation support. * references\_provider: The server provides find references support. * document\_highlight\_provider: The server provides document highlight support. * document\_symbol\_provider: The server provides document symbol support. * code\_action\_provider: The server provides code actions. CodeActionOptions may only be specified if the client states that it supports `codeActionLiteralSupport` in its initial `initialize` request. * code\_lens\_provider: The server provides code lens. * document\_link\_provider: The server provides document link support. * color\_provider: The server provides color provider support. * workspace\_symbol\_provider: The server provides workspace symbol support. * document\_formatting\_provider: The server provides document formatting. * document\_range\_formatting\_provider: The server provides document range formatting. * document\_on\_type\_formatting\_provider: The server provides document formatting on typing. * rename\_provider: The server provides rename support. RenameOptions may only be specified if the client states that it supports `prepareSupport` in its initial `initialize` request. * folding\_range\_provider: The server provides folding provider support. * selection\_range\_provider: The server provides selection range support. * execute\_command\_provider: The server provides execute command support. * call\_hierarchy\_provider: The server provides call hierarchy support. @since 3.16.0 * linked\_editing\_range\_provider: The server provides linked editing range support. @since 3.16.0 * semantic\_tokens\_provider: The server provides semantic tokens support. @since 3.16.0 * moniker\_provider: The server provides moniker support. @since 3.16.0 * type\_hierarchy\_provider: The server provides type hierarchy support. @since 3.17.0 * inline\_value\_provider: The server provides inline values. @since 3.17.0 * inlay\_hint\_provider: The server provides inlay hints. @since 3.17.0 * diagnostic\_provider: The server has support for pull model diagnostics. @since 3.17.0 * workspace: Workspace specific server capabilities. * experimental: Experimental server capabilities. GenLSP.Structures.SetTraceParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/set_trace_params.ex#L2 "View Source") GenLSP.Structures.SetTraceParams (gen\_lsp v0.6.0) ===================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SetTraceParams{}](#__struct__/0) Fields ------ * value [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/set_trace_params.ex#L13 "View Source") ``` @type t() :: %GenLSP.Structures.SetTraceParams{ value: [GenLSP.Enumerations.TraceValues.t](GenLSP.Enumerations.TraceValues.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SetTraceParams{} =================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/set_trace_params.ex#L13 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * value GenLSP.Structures.ShowDocumentClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/show_document_client_capabilities.ex#L2 "View Source") GenLSP.Structures.ShowDocumentClientCapabilities (gen\_lsp v0.6.0) ====================================================================================================================================================================================================================================== Client capabilities for the showDocument request. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ShowDocumentClientCapabilities{}](#__struct__/0) Fields ------ * support: The client has support for the showDocument request. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/show_document_client_capabilities.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.ShowDocumentClientCapabilities{support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ShowDocumentClientCapabilities{} =================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/show_document_client_capabilities.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * support: The client has support for the showDocument request. GenLSP.Structures.ShowDocumentParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/show_document_params.ex#L2 "View Source") GenLSP.Structures.ShowDocumentParams (gen\_lsp v0.6.0) ============================================================================================================================================================================================================= Params to show a document. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ShowDocumentParams{}](#__struct__/0) Fields ------ * uri: The document uri to show. * external: Indicates to show the resource in an external program. To show for example `https://code.visualstudio.com/` in the default WEB browser set `external` to `true`. * take\_focus: An optional property to indicate whether the editor showing the document should take focus or not. Clients might ignore this property if an external program is started. * selection: An optional selection range if the document is a text document. Clients might ignore the property if an external program is started or the file is not a text file. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/show_document_params.ex#L30 "View Source") ``` @type t() :: %GenLSP.Structures.ShowDocumentParams{ external: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, selection: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)() | nil, take_focus: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, uri: [GenLSP.BaseTypes.uri](GenLSP.BaseTypes.html#t:uri/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ShowDocumentParams{} ======================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/show_document_params.ex#L30 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * uri: The document uri to show. * external: Indicates to show the resource in an external program. To show for example `https://code.visualstudio.com/` in the default WEB browser set `external` to `true`. * take\_focus: An optional property to indicate whether the editor showing the document should take focus or not. Clients might ignore this property if an external program is started. * selection: An optional selection range if the document is a text document. Clients might ignore the property if an external program is started or the file is not a text file. GenLSP.Structures.ShowDocumentResult β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/show_document_result.ex#L2 "View Source") GenLSP.Structures.ShowDocumentResult (gen\_lsp v0.6.0) ============================================================================================================================================================================================================= The result of a showDocument request. @since 3.16.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ShowDocumentResult{}](#__struct__/0) Fields ------ * success: A boolean indicating if the show was successful. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/show_document_result.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.ShowDocumentResult{success: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ShowDocumentResult{} ======================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/show_document_result.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * success: A boolean indicating if the show was successful. GenLSP.Structures.ShowMessageParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/show_message_params.ex#L2 "View Source") GenLSP.Structures.ShowMessageParams (gen\_lsp v0.6.0) =========================================================================================================================================================================================================== The parameters of a notification message. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ShowMessageParams{}](#__struct__/0) Fields ------ * type: The message type. See {@link MessageType} * message: The actual message. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/show_message_params.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.ShowMessageParams{ message: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), type: [GenLSP.Enumerations.MessageType.t](GenLSP.Enumerations.MessageType.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ShowMessageParams{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/show_message_params.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * type: The message type. See {@link MessageType} * message: The actual message. GenLSP.Structures.ShowMessageRequestClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/show_message_request_client_capabilities.ex#L2 "View Source") GenLSP.Structures.ShowMessageRequestClientCapabilities (gen\_lsp v0.6.0) =================================================================================================================================================================================================================================================== Show message request client capabilities [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ShowMessageRequestClientCapabilities{}](#__struct__/0) Fields ------ * message\_action\_item: Capabilities specific to the `MessageActionItem` type. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/show_message_request_client_capabilities.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.ShowMessageRequestClientCapabilities{ message_action_item: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ShowMessageRequestClientCapabilities{} ========================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/show_message_request_client_capabilities.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * message\_action\_item: Capabilities specific to the `MessageActionItem` type. GenLSP.Structures.ShowMessageRequestParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/show_message_request_params.ex#L2 "View Source") GenLSP.Structures.ShowMessageRequestParams (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.ShowMessageRequestParams{}](#__struct__/0) Fields ------ * type: The message type. See {@link MessageType} * message: The actual message. * actions: The message action items to present. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/show_message_request_params.ex#L15 "View Source") ``` @type t() :: %GenLSP.Structures.ShowMessageRequestParams{ actions: [[GenLSP.Structures.MessageActionItem.t](GenLSP.Structures.MessageActionItem.html#t:t/0)()] | nil, message: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), type: [GenLSP.Enumerations.MessageType.t](GenLSP.Enumerations.MessageType.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.ShowMessageRequestParams{} ============================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/show_message_request_params.ex#L15 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * type: The message type. See {@link MessageType} * message: The actual message. * actions: The message action items to present. GenLSP.Structures.SignatureHelp β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/signature_help.ex#L2 "View Source") GenLSP.Structures.SignatureHelp (gen\_lsp v0.6.0) ================================================================================================================================================================================================== Signature help represents the signature of something callable. There can be multiple signature but only one active and only one active parameter. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SignatureHelp{}](#__struct__/0) Fields ------ * signatures: One or more signatures. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/signature_help.ex#L35 "View Source") ``` @type t() :: %GenLSP.Structures.SignatureHelp{ active_parameter: [GenLSP.BaseTypes.uinteger](GenLSP.BaseTypes.html#t:uinteger/0)() | nil, active_signature: [GenLSP.BaseTypes.uinteger](GenLSP.BaseTypes.html#t:uinteger/0)() | nil, signatures: [[GenLSP.Structures.SignatureInformation.t](GenLSP.Structures.SignatureInformation.html#t:t/0)()] } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SignatureHelp{} ================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/signature_help.ex#L35 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * signatures: One or more signatures. * active\_signature: The active signature. If omitted or the value lies outside the range of `signatures` the value defaults to zero or is ignored if the `SignatureHelp` has no signatures. Whenever possible implementors should make an active decision about the active signature and shouldn't rely on a default value. In future version of the protocol this property might become mandatory to better express this. * active\_parameter: The active parameter of the active signature. If omitted or the value lies outside the range of `signatures[activeSignature].parameters` defaults to 0 if the active signature has parameters. If the active signature has no parameters it is ignored. In future version of the protocol this property might become mandatory to better express the active parameter if the active signature does have any. GenLSP.Structures.SignatureHelpClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/signature_help_client_capabilities.ex#L2 "View Source") GenLSP.Structures.SignatureHelpClientCapabilities (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================================== Client Capabilities for a {@link SignatureHelpRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SignatureHelpClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether signature help supports dynamic registration. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/signature_help_client_capabilities.ex#L25 "View Source") ``` @type t() :: %GenLSP.Structures.SignatureHelpClientCapabilities{ context_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, signature_information: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SignatureHelpClientCapabilities{} ==================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/signature_help_client_capabilities.ex#L25 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether signature help supports dynamic registration. * signature\_information: The client supports the following `SignatureInformation` specific properties. * context\_support: The client supports to send additional context information for a `textDocument/signatureHelp` request. A client that opts into contextSupport will also support the `retriggerCharacters` on `SignatureHelpOptions`. @since 3.15.0 GenLSP.Structures.SignatureHelpContext β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/signature_help_context.ex#L2 "View Source") GenLSP.Structures.SignatureHelpContext (gen\_lsp v0.6.0) ================================================================================================================================================================================================================= Additional information about the context in which a signature help request was triggered. @since 3.15.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SignatureHelpContext{}](#__struct__/0) Fields ------ * trigger\_kind: Action that caused signature help to be triggered. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/signature_help_context.ex#L30 "View Source") ``` @type t() :: %GenLSP.Structures.SignatureHelpContext{ active_signature_help: [GenLSP.Structures.SignatureHelp.t](GenLSP.Structures.SignatureHelp.html#t:t/0)() | nil, is_retrigger: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), trigger_character: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, trigger_kind: [GenLSP.Enumerations.SignatureHelpTriggerKind.t](GenLSP.Enumerations.SignatureHelpTriggerKind.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SignatureHelpContext{} ========================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/signature_help_context.ex#L30 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * trigger\_kind: Action that caused signature help to be triggered. * trigger\_character: Character that caused signature help to be triggered. This is undefined when `triggerKind !== SignatureHelpTriggerKind.TriggerCharacter` * is\_retrigger: `true` if signature help was already showing when it was triggered. Retriggers occurs when the signature help is already active and can be caused by actions such as typing a trigger character, a cursor move, or document content changes. * active\_signature\_help: The currently active `SignatureHelp`. The `activeSignatureHelp` has its `SignatureHelp.activeSignature` field updated based on the user navigating through available signatures. GenLSP.Structures.SignatureHelpOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/signature_help_options.ex#L2 "View Source") GenLSP.Structures.SignatureHelpOptions (gen\_lsp v0.6.0) ================================================================================================================================================================================================================= Server Capabilities for a {@link SignatureHelpRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SignatureHelpOptions{}](#__struct__/0) Fields ------ * trigger\_characters: List of characters that trigger signature help automatically. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/signature_help_options.ex#L24 "View Source") ``` @type t() :: %GenLSP.Structures.SignatureHelpOptions{ retrigger_characters: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil, trigger_characters: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil, work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SignatureHelpOptions{} ========================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/signature_help_options.ex#L24 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * trigger\_characters: List of characters that trigger signature help automatically. * retrigger\_characters: List of characters that re-trigger signature help. These trigger characters are only active when signature help is already showing. All trigger characters are also counted as re-trigger characters. @since 3.15.0 * work\_done\_progress GenLSP.Structures.SignatureHelpParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/signature_help_params.ex#L2 "View Source") GenLSP.Structures.SignatureHelpParams (gen\_lsp v0.6.0) =============================================================================================================================================================================================================== Parameters for a {@link SignatureHelpRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SignatureHelpParams{}](#__struct__/0) Fields ------ * context: The signature help context. This is only available if the client specifies to send this using the client capability `textDocument.signatureHelp.contextSupport === true` [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/signature_help_params.ex#L23 "View Source") ``` @type t() :: %GenLSP.Structures.SignatureHelpParams{ context: [GenLSP.Structures.SignatureHelpContext.t](GenLSP.Structures.SignatureHelpContext.html#t:t/0)() | nil, position: [GenLSP.Structures.Position.t](GenLSP.Structures.Position.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SignatureHelpParams{} ======================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/signature_help_params.ex#L23 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * context: The signature help context. This is only available if the client specifies to send this using the client capability `textDocument.signatureHelp.contextSupport === true` @since 3.15.0 * work\_done\_token: An optional token that a server can use to report work done progress. * text\_document: The text document. * position: The position inside the text document. GenLSP.Structures.SignatureHelpRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/signature_help_registration_options.ex#L2 "View Source") GenLSP.Structures.SignatureHelpRegistrationOptions (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================================== Registration options for a {@link SignatureHelpRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SignatureHelpRegistrationOptions{}](#__struct__/0) Fields ------ * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/signature_help_registration_options.ex#L25 "View Source") ``` @type t() :: %GenLSP.Structures.SignatureHelpRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil, retrigger_characters: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil, trigger_characters: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SignatureHelpRegistrationOptions{} ===================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/signature_help_registration_options.ex#L25 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. * trigger\_characters: List of characters that trigger signature help automatically. * retrigger\_characters: List of characters that re-trigger signature help. These trigger characters are only active when signature help is already showing. All trigger characters are also counted as re-trigger characters. @since 3.15.0 GenLSP.Structures.SignatureInformation β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/signature_information.ex#L2 "View Source") GenLSP.Structures.SignatureInformation (gen\_lsp v0.6.0) ================================================================================================================================================================================================================ Represents the signature of something callable. A signature can have a label, like a function-name, a doc-comment, and a set of parameters. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SignatureInformation{}](#__struct__/0) Fields ------ * label: The label of this signature. Will be shown in the UI. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/signature_information.ex#L28 "View Source") ``` @type t() :: %GenLSP.Structures.SignatureInformation{ active_parameter: [GenLSP.BaseTypes.uinteger](GenLSP.BaseTypes.html#t:uinteger/0)() | nil, documentation: ([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | [GenLSP.Structures.MarkupContent.t](GenLSP.Structures.MarkupContent.html#t:t/0)()) | nil, label: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), parameters: [[GenLSP.Structures.ParameterInformation.t](GenLSP.Structures.ParameterInformation.html#t:t/0)()] | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SignatureInformation{} ========================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/signature_information.ex#L28 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * label: The label of this signature. Will be shown in the UI. * documentation: The human-readable doc-comment of this signature. Will be shown in the UI but can be omitted. * parameters: The parameters of this signature. * active\_parameter: The index of the active parameter. If provided, this is used in place of `SignatureHelp.activeParameter`. @since 3.16.0 GenLSP.Structures.StaticRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/static_registration_options.ex#L2 "View Source") GenLSP.Structures.StaticRegistrationOptions (gen\_lsp v0.6.0) =========================================================================================================================================================================================================================== Static registration options to be returned in the initialize request. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.StaticRegistrationOptions{}](#__struct__/0) Fields ------ * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/static_registration_options.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.StaticRegistrationOptions{id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.StaticRegistrationOptions{} ============================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/static_registration_options.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. GenLSP.Structures.SymbolInformation β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/symbol_information.ex#L2 "View Source") GenLSP.Structures.SymbolInformation (gen\_lsp v0.6.0) ========================================================================================================================================================================================================== Represents information about programming constructs like variables, classes, interfaces etc. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.SymbolInformation{}](#__struct__/0) Fields ------ * deprecated: Indicates if this symbol is deprecated. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/symbol_information.ex#L38 "View Source") ``` @type t() :: %GenLSP.Structures.SymbolInformation{ container_name: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, deprecated: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, kind: [GenLSP.Enumerations.SymbolKind.t](GenLSP.Enumerations.SymbolKind.html#t:t/0)(), location: [GenLSP.Structures.Location.t](GenLSP.Structures.Location.html#t:t/0)(), name: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), tags: [[GenLSP.Enumerations.SymbolTag.t](GenLSP.Enumerations.SymbolTag.html#t:t/0)()] | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.SymbolInformation{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/symbol_information.ex#L38 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * deprecated: Indicates if this symbol is deprecated. @deprecated Use tags instead * location: The location of this symbol. The location's range is used by a tool to reveal the location in the editor. If the symbol is selected in the tool the range's start information is used to position the cursor. So the range usually spans more than the actual symbol's name and does normally include things like visibility modifiers. The range doesn't have to denote a node range in the sense of an abstract syntax tree. It can therefore not be used to re-construct a hierarchy of the symbols. * name: The name of this symbol. * kind: The kind of this symbol. * tags: Tags for this symbol. @since 3.16.0 * container\_name: The name of the symbol containing this symbol. This information is for user interface purposes (e.g. to render a qualifier in the user interface if necessary). It can't be used to re-infer a hierarchy for the document symbols. GenLSP.Structures.TextDocumentChangeRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_change_registration_options.ex#L2 "View Source") GenLSP.Structures.TextDocumentChangeRegistrationOptions (gen\_lsp v0.6.0) ===================================================================================================================================================================================================================================================== Describe options to be used when registered for text document change events. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.TextDocumentChangeRegistrationOptions{}](#__struct__/0) Fields ------ * sync\_kind: How documents are synced to the server. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_change_registration_options.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.TextDocumentChangeRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil, sync_kind: [GenLSP.Enumerations.TextDocumentSyncKind.t](GenLSP.Enumerations.TextDocumentSyncKind.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.TextDocumentChangeRegistrationOptions{} ========================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_change_registration_options.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * sync\_kind: How documents are synced to the server. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. GenLSP.Structures.TextDocumentClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_client_capabilities.ex#L2 "View Source") GenLSP.Structures.TextDocumentClientCapabilities (gen\_lsp v0.6.0) ====================================================================================================================================================================================================================================== Text document specific client capabilities. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.TextDocumentClientCapabilities{}](#__struct__/0) Fields ------ * synchronization: Defines which synchronization capabilities the client supports. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_client_capabilities.ex#L75 "View Source") ``` @type t() :: %GenLSP.Structures.TextDocumentClientCapabilities{ call_hierarchy: [GenLSP.Structures.CallHierarchyClientCapabilities.t](GenLSP.Structures.CallHierarchyClientCapabilities.html#t:t/0)() | nil, code_action: [GenLSP.Structures.CodeActionClientCapabilities.t](GenLSP.Structures.CodeActionClientCapabilities.html#t:t/0)() | nil, code_lens: [GenLSP.Structures.CodeLensClientCapabilities.t](GenLSP.Structures.CodeLensClientCapabilities.html#t:t/0)() | nil, color_provider: [GenLSP.Structures.DocumentColorClientCapabilities.t](GenLSP.Structures.DocumentColorClientCapabilities.html#t:t/0)() | nil, completion: [GenLSP.Structures.CompletionClientCapabilities.t](GenLSP.Structures.CompletionClientCapabilities.html#t:t/0)() | nil, declaration: [GenLSP.Structures.DeclarationClientCapabilities.t](GenLSP.Structures.DeclarationClientCapabilities.html#t:t/0)() | nil, definition: [GenLSP.Structures.DefinitionClientCapabilities.t](GenLSP.Structures.DefinitionClientCapabilities.html#t:t/0)() | nil, diagnostic: [GenLSP.Structures.DiagnosticClientCapabilities.t](GenLSP.Structures.DiagnosticClientCapabilities.html#t:t/0)() | nil, document_highlight: [GenLSP.Structures.DocumentHighlightClientCapabilities.t](GenLSP.Structures.DocumentHighlightClientCapabilities.html#t:t/0)() | nil, document_link: [GenLSP.Structures.DocumentLinkClientCapabilities.t](GenLSP.Structures.DocumentLinkClientCapabilities.html#t:t/0)() | nil, document_symbol: [GenLSP.Structures.DocumentSymbolClientCapabilities.t](GenLSP.Structures.DocumentSymbolClientCapabilities.html#t:t/0)() | nil, folding_range: [GenLSP.Structures.FoldingRangeClientCapabilities.t](GenLSP.Structures.FoldingRangeClientCapabilities.html#t:t/0)() | nil, formatting: [GenLSP.Structures.DocumentFormattingClientCapabilities.t](GenLSP.Structures.DocumentFormattingClientCapabilities.html#t:t/0)() | nil, hover: [GenLSP.Structures.HoverClientCapabilities.t](GenLSP.Structures.HoverClientCapabilities.html#t:t/0)() | nil, implementation: [GenLSP.Structures.ImplementationClientCapabilities.t](GenLSP.Structures.ImplementationClientCapabilities.html#t:t/0)() | nil, inlay_hint: [GenLSP.Structures.InlayHintClientCapabilities.t](GenLSP.Structures.InlayHintClientCapabilities.html#t:t/0)() | nil, inline_value: [GenLSP.Structures.InlineValueClientCapabilities.t](GenLSP.Structures.InlineValueClientCapabilities.html#t:t/0)() | nil, linked_editing_range: [GenLSP.Structures.LinkedEditingRangeClientCapabilities.t](GenLSP.Structures.LinkedEditingRangeClientCapabilities.html#t:t/0)() | nil, moniker: [GenLSP.Structures.MonikerClientCapabilities.t](GenLSP.Structures.MonikerClientCapabilities.html#t:t/0)() | nil, on_type_formatting: [GenLSP.Structures.DocumentOnTypeFormattingClientCapabilities.t](GenLSP.Structures.DocumentOnTypeFormattingClientCapabilities.html#t:t/0)() | nil, publish_diagnostics: [GenLSP.Structures.PublishDiagnosticsClientCapabilities.t](GenLSP.Structures.PublishDiagnosticsClientCapabilities.html#t:t/0)() | nil, range_formatting: [GenLSP.Structures.DocumentRangeFormattingClientCapabilities.t](GenLSP.Structures.DocumentRangeFormattingClientCapabilities.html#t:t/0)() | nil, references: [GenLSP.Structures.ReferenceClientCapabilities.t](GenLSP.Structures.ReferenceClientCapabilities.html#t:t/0)() | nil, rename: [GenLSP.Structures.RenameClientCapabilities.t](GenLSP.Structures.RenameClientCapabilities.html#t:t/0)() | nil, selection_range: [GenLSP.Structures.SelectionRangeClientCapabilities.t](GenLSP.Structures.SelectionRangeClientCapabilities.html#t:t/0)() | nil, semantic_tokens: [GenLSP.Structures.SemanticTokensClientCapabilities.t](GenLSP.Structures.SemanticTokensClientCapabilities.html#t:t/0)() | nil, signature_help: [GenLSP.Structures.SignatureHelpClientCapabilities.t](GenLSP.Structures.SignatureHelpClientCapabilities.html#t:t/0)() | nil, synchronization: [GenLSP.Structures.TextDocumentSyncClientCapabilities.t](GenLSP.Structures.TextDocumentSyncClientCapabilities.html#t:t/0)() | nil, type_definition: [GenLSP.Structures.TypeDefinitionClientCapabilities.t](GenLSP.Structures.TypeDefinitionClientCapabilities.html#t:t/0)() | nil, type_hierarchy: [GenLSP.Structures.TypeHierarchyClientCapabilities.t](GenLSP.Structures.TypeHierarchyClientCapabilities.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.TextDocumentClientCapabilities{} =================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_client_capabilities.ex#L75 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * synchronization: Defines which synchronization capabilities the client supports. * completion: Capabilities specific to the `textDocument/completion` request. * hover: Capabilities specific to the `textDocument/hover` request. * signature\_help: Capabilities specific to the `textDocument/signatureHelp` request. * declaration: Capabilities specific to the `textDocument/declaration` request. @since 3.14.0 * definition: Capabilities specific to the `textDocument/definition` request. * type\_definition: Capabilities specific to the `textDocument/typeDefinition` request. @since 3.6.0 * implementation: Capabilities specific to the `textDocument/implementation` request. @since 3.6.0 * references: Capabilities specific to the `textDocument/references` request. * document\_highlight: Capabilities specific to the `textDocument/documentHighlight` request. * document\_symbol: Capabilities specific to the `textDocument/documentSymbol` request. * code\_action: Capabilities specific to the `textDocument/codeAction` request. * code\_lens: Capabilities specific to the `textDocument/codeLens` request. * document\_link: Capabilities specific to the `textDocument/documentLink` request. * color\_provider: Capabilities specific to the `textDocument/documentColor` and the `textDocument/colorPresentation` request. @since 3.6.0 * formatting: Capabilities specific to the `textDocument/formatting` request. * range\_formatting: Capabilities specific to the `textDocument/rangeFormatting` request. * on\_type\_formatting: Capabilities specific to the `textDocument/onTypeFormatting` request. * rename: Capabilities specific to the `textDocument/rename` request. * folding\_range: Capabilities specific to the `textDocument/foldingRange` request. @since 3.10.0 * selection\_range: Capabilities specific to the `textDocument/selectionRange` request. @since 3.15.0 * publish\_diagnostics: Capabilities specific to the `textDocument/publishDiagnostics` notification. * call\_hierarchy: Capabilities specific to the various call hierarchy requests. @since 3.16.0 * semantic\_tokens: Capabilities specific to the various semantic token request. @since 3.16.0 * linked\_editing\_range: Capabilities specific to the `textDocument/linkedEditingRange` request. @since 3.16.0 * moniker: Client capabilities specific to the `textDocument/moniker` request. @since 3.16.0 * type\_hierarchy: Capabilities specific to the various type hierarchy requests. @since 3.17.0 * inline\_value: Capabilities specific to the `textDocument/inlineValue` request. @since 3.17.0 * inlay\_hint: Capabilities specific to the `textDocument/inlayHint` request. @since 3.17.0 * diagnostic: Capabilities specific to the diagnostic pull model. @since 3.17.0 GenLSP.Structures.TextDocumentEdit β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_edit.ex#L2 "View Source") GenLSP.Structures.TextDocumentEdit (gen\_lsp v0.6.0) ========================================================================================================================================================================================================= Describes textual changes on a text document. A TextDocumentEdit describes all changes on a document version Si and after they are applied move the document to version Si+1. So the creator of a TextDocumentEdit doesn't need to sort the array of edits or do any kind of ordering. However the edits must be non overlapping. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.TextDocumentEdit{}](#__struct__/0) Fields ------ * text\_document: The text document to change. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_edit.ex#L24 "View Source") ``` @type t() :: %GenLSP.Structures.TextDocumentEdit{ edits: [ [GenLSP.Structures.TextEdit.t](GenLSP.Structures.TextEdit.html#t:t/0)() | [GenLSP.Structures.AnnotatedTextEdit.t](GenLSP.Structures.AnnotatedTextEdit.html#t:t/0)() ], text_document: [GenLSP.Structures.OptionalVersionedTextDocumentIdentifier.t](GenLSP.Structures.OptionalVersionedTextDocumentIdentifier.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.TextDocumentEdit{} ===================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_edit.ex#L24 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * text\_document: The text document to change. * edits: The edits to be applied. @since 3.16.0 - support for AnnotatedTextEdit. This is guarded using a client capability. GenLSP.Structures.TextDocumentIdentifier β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_identifier.ex#L2 "View Source") GenLSP.Structures.TextDocumentIdentifier (gen\_lsp v0.6.0) ===================================================================================================================================================================================================================== A literal to identify a text document in the client. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.TextDocumentIdentifier{}](#__struct__/0) Fields ------ * uri: The text document's uri. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_identifier.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.TextDocumentIdentifier{ uri: [GenLSP.BaseTypes.document\_uri](GenLSP.BaseTypes.html#t:document_uri/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.TextDocumentIdentifier{} =========================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_identifier.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * uri: The text document's uri. GenLSP.Structures.TextDocumentItem β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_item.ex#L2 "View Source") GenLSP.Structures.TextDocumentItem (gen\_lsp v0.6.0) ========================================================================================================================================================================================================= An item to transfer a text document from the client to the server. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.TextDocumentItem{}](#__struct__/0) Fields ------ * uri: The text document's uri. * language\_id: The text document's language identifier. * version: The version number of this document (it will increase after each change, including undo/redo). * text: The content of the opened text document. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_item.ex#L22 "View Source") ``` @type t() :: %GenLSP.Structures.TextDocumentItem{ language_id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), text: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), uri: [GenLSP.BaseTypes.document\_uri](GenLSP.BaseTypes.html#t:document_uri/0)(), version: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.TextDocumentItem{} ===================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_item.ex#L22 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * uri: The text document's uri. * language\_id: The text document's language identifier. * version: The version number of this document (it will increase after each change, including undo/redo). * text: The content of the opened text document. GenLSP.Structures.TextDocumentPositionParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_position_params.ex#L2 "View Source") GenLSP.Structures.TextDocumentPositionParams (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================== A parameter literal used in requests to pass a text document and a position inside that document. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.TextDocumentPositionParams{}](#__struct__/0) Fields ------ * text\_document: The text document. * position: The position inside the text document. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_position_params.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.TextDocumentPositionParams{ position: [GenLSP.Structures.Position.t](GenLSP.Structures.Position.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.TextDocumentPositionParams{} =============================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_position_params.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * text\_document: The text document. * position: The position inside the text document. GenLSP.Structures.TextDocumentRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_registration_options.ex#L2 "View Source") GenLSP.Structures.TextDocumentRegistrationOptions (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================================== General text document registration options. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.TextDocumentRegistrationOptions{}](#__struct__/0) Fields ------ * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_registration_options.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.TextDocumentRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.TextDocumentRegistrationOptions{} ==================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_registration_options.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. GenLSP.Structures.TextDocumentSaveRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_save_registration_options.ex#L2 "View Source") GenLSP.Structures.TextDocumentSaveRegistrationOptions (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================================= Save registration options. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.TextDocumentSaveRegistrationOptions{}](#__struct__/0) Fields ------ * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. * include\_text: The client is supposed to include the content on save. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_save_registration_options.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.TextDocumentSaveRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil, include_text: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.TextDocumentSaveRegistrationOptions{} ======================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_save_registration_options.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. * include\_text: The client is supposed to include the content on save. GenLSP.Structures.TextDocumentSyncClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_sync_client_capabilities.ex#L2 "View Source") GenLSP.Structures.TextDocumentSyncClientCapabilities (gen\_lsp v0.6.0) =============================================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.TextDocumentSyncClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether text document synchronization supports dynamic registration. * will\_save: The client supports sending will save notifications. * will\_save\_wait\_until: The client supports sending a will save request and waits for a response providing text edits which will be applied to the document before it is saved. * did\_save: The client supports did save notifications. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_sync_client_capabilities.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.TextDocumentSyncClientCapabilities{ did_save: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, will_save: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, will_save_wait_until: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.TextDocumentSyncClientCapabilities{} ======================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_sync_client_capabilities.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether text document synchronization supports dynamic registration. * will\_save: The client supports sending will save notifications. * will\_save\_wait\_until: The client supports sending a will save request and waits for a response providing text edits which will be applied to the document before it is saved. * did\_save: The client supports did save notifications. GenLSP.Structures.TextDocumentSyncOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_sync_options.ex#L2 "View Source") GenLSP.Structures.TextDocumentSyncOptions (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.TextDocumentSyncOptions{}](#__struct__/0) Fields ------ * open\_close: Open and close notifications are sent to the server. If omitted open close notification should not be sent. * change: Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full and TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None. * will\_save: If present will save notifications are sent to the server. If omitted the notification should not be sent. * will\_save\_wait\_until: If present will save wait until requests are sent to the server. If omitted the request should not be sent. * save: If present save notifications are sent to the server. If omitted the notification should not be sent. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_sync_options.ex#L22 "View Source") ``` @type t() :: %GenLSP.Structures.TextDocumentSyncOptions{ change: [GenLSP.Enumerations.TextDocumentSyncKind.t](GenLSP.Enumerations.TextDocumentSyncKind.html#t:t/0)() | nil, open_close: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, save: ([boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [GenLSP.Structures.SaveOptions.t](GenLSP.Structures.SaveOptions.html#t:t/0)()) | nil, will_save: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, will_save_wait_until: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.TextDocumentSyncOptions{} ============================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_document_sync_options.ex#L22 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * open\_close: Open and close notifications are sent to the server. If omitted open close notification should not be sent. * change: Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full and TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None. * will\_save: If present will save notifications are sent to the server. If omitted the notification should not be sent. * will\_save\_wait\_until: If present will save wait until requests are sent to the server. If omitted the request should not be sent. * save: If present save notifications are sent to the server. If omitted the notification should not be sent. GenLSP.Structures.TextEdit β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_edit.ex#L2 "View Source") GenLSP.Structures.TextEdit (gen\_lsp v0.6.0) ======================================================================================================================================================================================== A text edit applicable to a text document. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.TextEdit{}](#__struct__/0) Fields ------ * range: The range of the text document to be manipulated. To insert text into a document create a range where start === end. * new\_text: The string to be inserted. For delete operations use an empty string. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_edit.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.TextEdit{ new_text: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.TextEdit{} ============================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/text_edit.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * range: The range of the text document to be manipulated. To insert text into a document create a range where start === end. * new\_text: The string to be inserted. For delete operations use an empty string. GenLSP.Structures.TypeDefinitionClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_definition_client_capabilities.ex#L2 "View Source") GenLSP.Structures.TypeDefinitionClientCapabilities (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================================== Since 3.6.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.TypeDefinitionClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether implementation supports dynamic registration. If this is set to `true` the client supports the new `TypeDefinitionRegistrationOptions` return value for the corresponding server capability as well. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_definition_client_capabilities.ex#L22 "View Source") ``` @type t() :: %GenLSP.Structures.TypeDefinitionClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, link_support: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.TypeDefinitionClientCapabilities{} ===================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_definition_client_capabilities.ex#L22 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether implementation supports dynamic registration. If this is set to `true` the client supports the new `TypeDefinitionRegistrationOptions` return value for the corresponding server capability as well. * link\_support: The client supports additional metadata in the form of definition links. Since 3.14.0 GenLSP.Structures.TypeDefinitionOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_definition_options.ex#L2 "View Source") GenLSP.Structures.TypeDefinitionOptions (gen\_lsp v0.6.0) =================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.TypeDefinitionOptions{}](#__struct__/0) Fields ------ * work\_done\_progress [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_definition_options.ex#L13 "View Source") ``` @type t() :: %GenLSP.Structures.TypeDefinitionOptions{ work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.TypeDefinitionOptions{} ========================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_definition_options.ex#L13 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_progress GenLSP.Structures.TypeDefinitionParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_definition_params.ex#L2 "View Source") GenLSP.Structures.TypeDefinitionParams (gen\_lsp v0.6.0) ================================================================================================================================================================================================================= [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.TypeDefinitionParams{}](#__struct__/0) Fields ------ * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. * text\_document: The text document. * position: The position inside the text document. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_definition_params.ex#L17 "View Source") ``` @type t() :: %GenLSP.Structures.TypeDefinitionParams{ partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, position: [GenLSP.Structures.Position.t](GenLSP.Structures.Position.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.TypeDefinitionParams{} ========================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_definition_params.ex#L17 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. * text\_document: The text document. * position: The position inside the text document. GenLSP.Structures.TypeDefinitionRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_definition_registration_options.ex#L2 "View Source") GenLSP.Structures.TypeDefinitionRegistrationOptions (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================================ [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.TypeDefinitionRegistrationOptions{}](#__struct__/0) Fields ------ * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_definition_registration_options.ex#L16 "View Source") ``` @type t() :: %GenLSP.Structures.TypeDefinitionRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil, id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.TypeDefinitionRegistrationOptions{} ====================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_definition_registration_options.ex#L16 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. GenLSP.Structures.TypeHierarchyClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_hierarchy_client_capabilities.ex#L2 "View Source") GenLSP.Structures.TypeHierarchyClientCapabilities (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================================== @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.TypeHierarchyClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Whether implementation supports dynamic registration. If this is set to `true` the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` return value for the corresponding server capability as well. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_hierarchy_client_capabilities.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.TypeHierarchyClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.TypeHierarchyClientCapabilities{} ==================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_hierarchy_client_capabilities.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Whether implementation supports dynamic registration. If this is set to `true` the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` return value for the corresponding server capability as well. GenLSP.Structures.TypeHierarchyItem β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_hierarchy_item.ex#L2 "View Source") GenLSP.Structures.TypeHierarchyItem (gen\_lsp v0.6.0) =========================================================================================================================================================================================================== @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.TypeHierarchyItem{}](#__struct__/0) Fields ------ * name: The name of this item. * kind: The kind of this item. * tags: Tags for this item. * detail: More detail for this item, e.g. the signature of a function. * uri: The resource identifier of this item. * range: The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code. * selection\_range: The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function. Must be contained by the {@link TypeHierarchyItem.range `range`}. * data: A data entry field that is preserved between a type hierarchy prepare and supertypes or subtypes requests. It could also be used to identify the type hierarchy in the server, helping improve the performance on resolving supertypes and subtypes. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_hierarchy_item.ex#L30 "View Source") ``` @type t() :: %GenLSP.Structures.TypeHierarchyItem{ data: [GenLSP.TypeAlias.LSPAny.t](GenLSP.TypeAlias.LSPAny.html#t:t/0)() | nil, detail: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, kind: [GenLSP.Enumerations.SymbolKind.t](GenLSP.Enumerations.SymbolKind.html#t:t/0)(), name: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)(), selection_range: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)(), tags: [[GenLSP.Enumerations.SymbolTag.t](GenLSP.Enumerations.SymbolTag.html#t:t/0)()] | nil, uri: [GenLSP.BaseTypes.document\_uri](GenLSP.BaseTypes.html#t:document_uri/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.TypeHierarchyItem{} ====================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_hierarchy_item.ex#L30 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * name: The name of this item. * kind: The kind of this item. * tags: Tags for this item. * detail: More detail for this item, e.g. the signature of a function. * uri: The resource identifier of this item. * range: The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code. * selection\_range: The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function. Must be contained by the {@link TypeHierarchyItem.range `range`}. * data: A data entry field that is preserved between a type hierarchy prepare and supertypes or subtypes requests. It could also be used to identify the type hierarchy in the server, helping improve the performance on resolving supertypes and subtypes. GenLSP.Structures.TypeHierarchyOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_hierarchy_options.ex#L2 "View Source") GenLSP.Structures.TypeHierarchyOptions (gen\_lsp v0.6.0) ================================================================================================================================================================================================================= Type hierarchy options used during static registration. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.TypeHierarchyOptions{}](#__struct__/0) Fields ------ * work\_done\_progress [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_hierarchy_options.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.TypeHierarchyOptions{ work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.TypeHierarchyOptions{} ========================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_hierarchy_options.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_progress GenLSP.Structures.TypeHierarchyPrepareParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_hierarchy_prepare_params.ex#L2 "View Source") GenLSP.Structures.TypeHierarchyPrepareParams (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================== The parameter of a `textDocument/prepareTypeHierarchy` request. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.TypeHierarchyPrepareParams{}](#__struct__/0) Fields ------ * work\_done\_token: An optional token that a server can use to report work done progress. * text\_document: The text document. * position: The position inside the text document. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_hierarchy_prepare_params.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.TypeHierarchyPrepareParams{ position: [GenLSP.Structures.Position.t](GenLSP.Structures.Position.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.TypeHierarchyPrepareParams{} =============================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_hierarchy_prepare_params.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_token: An optional token that a server can use to report work done progress. * text\_document: The text document. * position: The position inside the text document. GenLSP.Structures.TypeHierarchyRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_hierarchy_registration_options.ex#L2 "View Source") GenLSP.Structures.TypeHierarchyRegistrationOptions (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================================== Type hierarchy options used during static or dynamic registration. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.TypeHierarchyRegistrationOptions{}](#__struct__/0) Fields ------ * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_hierarchy_registration_options.ex#L22 "View Source") ``` @type t() :: %GenLSP.Structures.TypeHierarchyRegistrationOptions{ document_selector: [GenLSP.TypeAlias.DocumentSelector.t](GenLSP.TypeAlias.DocumentSelector.html#t:t/0)() | nil, id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.TypeHierarchyRegistrationOptions{} ===================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_hierarchy_registration_options.ex#L22 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * id: The id used to register the request. The id can be used to deregister the request again. See also Registration#id. * document\_selector: A document selector to identify the scope of the registration. If set to null the document selector provided on the client side will be used. GenLSP.Structures.TypeHierarchySubtypesParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_hierarchy_subtypes_params.ex#L2 "View Source") GenLSP.Structures.TypeHierarchySubtypesParams (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================ The parameter of a `typeHierarchy/subtypes` request. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.TypeHierarchySubtypesParams{}](#__struct__/0) Fields ------ * item * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_hierarchy_subtypes_params.ex#L22 "View Source") ``` @type t() :: %GenLSP.Structures.TypeHierarchySubtypesParams{ item: [GenLSP.Structures.TypeHierarchyItem.t](GenLSP.Structures.TypeHierarchyItem.html#t:t/0)(), partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.TypeHierarchySubtypesParams{} ================================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_hierarchy_subtypes_params.ex#L22 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * item * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. GenLSP.Structures.TypeHierarchySupertypesParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_hierarchy_supertypes_params.ex#L2 "View Source") GenLSP.Structures.TypeHierarchySupertypesParams (gen\_lsp v0.6.0) ==================================================================================================================================================================================================================================== The parameter of a `typeHierarchy/supertypes` request. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.TypeHierarchySupertypesParams{}](#__struct__/0) Fields ------ * item * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_hierarchy_supertypes_params.ex#L22 "View Source") ``` @type t() :: %GenLSP.Structures.TypeHierarchySupertypesParams{ item: [GenLSP.Structures.TypeHierarchyItem.t](GenLSP.Structures.TypeHierarchyItem.html#t:t/0)(), partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.TypeHierarchySupertypesParams{} ================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/type_hierarchy_supertypes_params.ex#L22 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * item * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. GenLSP.Structures.UnchangedDocumentDiagnosticReport β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/unchanged_document_diagnostic_report.ex#L2 "View Source") GenLSP.Structures.UnchangedDocumentDiagnosticReport (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================================ A diagnostic report indicating that the last returned report is still accurate. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.UnchangedDocumentDiagnosticReport{}](#__struct__/0) Fields ------ * kind: A document diagnostic report indicating no changes to the last result. A server can only return `unchanged` if result ids are provided. * result\_id: A result id which will be sent on the next diagnostic request for the same document. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/unchanged_document_diagnostic_report.ex#L25 "View Source") ``` @type t() :: %GenLSP.Structures.UnchangedDocumentDiagnosticReport{ kind: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), result_id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.UnchangedDocumentDiagnosticReport{} ====================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/unchanged_document_diagnostic_report.ex#L25 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * kind: A document diagnostic report indicating no changes to the last result. A server can only return `unchanged` if result ids are provided. * result\_id: A result id which will be sent on the next diagnostic request for the same document. GenLSP.Structures.Unregistration β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/unregistration.ex#L2 "View Source") GenLSP.Structures.Unregistration (gen\_lsp v0.6.0) =================================================================================================================================================================================================== General parameters to unregister a request or notification. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.Unregistration{}](#__struct__/0) Fields ------ * id: The id used to unregister the request or notification. Usually an id provided during the register request. * method: The method to unregister for. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/unregistration.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.Unregistration{id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), method: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.Unregistration{} =================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/unregistration.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * id: The id used to unregister the request or notification. Usually an id provided during the register request. * method: The method to unregister for. GenLSP.Structures.UnregistrationParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/unregistration_params.ex#L2 "View Source") GenLSP.Structures.UnregistrationParams (gen\_lsp v0.6.0) ================================================================================================================================================================================================================ [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.UnregistrationParams{}](#__struct__/0) Fields ------ * unregisterations [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/unregistration_params.ex#L13 "View Source") ``` @type t() :: %GenLSP.Structures.UnregistrationParams{ unregisterations: [[GenLSP.Structures.Unregistration.t](GenLSP.Structures.Unregistration.html#t:t/0)()] } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.UnregistrationParams{} ========================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/unregistration_params.ex#L13 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * unregisterations GenLSP.Structures.VersionedNotebookDocumentIdentifier β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/versioned_notebook_document_identifier.ex#L2 "View Source") GenLSP.Structures.VersionedNotebookDocumentIdentifier (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================================ A versioned notebook document identifier. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.VersionedNotebookDocumentIdentifier{}](#__struct__/0) Fields ------ * version: The version number of this notebook document. * uri: The notebook document's uri. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/versioned_notebook_document_identifier.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.VersionedNotebookDocumentIdentifier{ uri: [GenLSP.BaseTypes.uri](GenLSP.BaseTypes.html#t:uri/0)(), version: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.VersionedNotebookDocumentIdentifier{} ======================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/versioned_notebook_document_identifier.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * version: The version number of this notebook document. * uri: The notebook document's uri. GenLSP.Structures.VersionedTextDocumentIdentifier β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/versioned_text_document_identifier.ex#L2 "View Source") GenLSP.Structures.VersionedTextDocumentIdentifier (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================================== A text document identifier to denote a specific version of a text document. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.VersionedTextDocumentIdentifier{}](#__struct__/0) Fields ------ * version: The version number of this document. * uri: The text document's uri. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/versioned_text_document_identifier.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.VersionedTextDocumentIdentifier{ uri: [GenLSP.BaseTypes.document\_uri](GenLSP.BaseTypes.html#t:document_uri/0)(), version: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.VersionedTextDocumentIdentifier{} ==================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/versioned_text_document_identifier.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * version: The version number of this document. * uri: The text document's uri. GenLSP.Structures.WillSaveTextDocumentParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/will_save_text_document_params.ex#L2 "View Source") GenLSP.Structures.WillSaveTextDocumentParams (gen\_lsp v0.6.0) =============================================================================================================================================================================================================================== The parameters sent in a will save text document notification. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WillSaveTextDocumentParams{}](#__struct__/0) Fields ------ * text\_document: The document that will be saved. * reason: The 'TextDocumentSaveReason'. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/will_save_text_document_params.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.WillSaveTextDocumentParams{ reason: [GenLSP.Enumerations.TextDocumentSaveReason.t](GenLSP.Enumerations.TextDocumentSaveReason.html#t:t/0)(), text_document: [GenLSP.Structures.TextDocumentIdentifier.t](GenLSP.Structures.TextDocumentIdentifier.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WillSaveTextDocumentParams{} =============================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/will_save_text_document_params.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * text\_document: The document that will be saved. * reason: The 'TextDocumentSaveReason'. GenLSP.Structures.WindowClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/window_client_capabilities.ex#L2 "View Source") GenLSP.Structures.WindowClientCapabilities (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================= [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WindowClientCapabilities{}](#__struct__/0) Fields ------ * work\_done\_progress: It indicates whether the client supports server initiated progress using the `window/workDoneProgress/create` request. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/window_client_capabilities.ex#L27 "View Source") ``` @type t() :: %GenLSP.Structures.WindowClientCapabilities{ show_document: [GenLSP.Structures.ShowDocumentClientCapabilities.t](GenLSP.Structures.ShowDocumentClientCapabilities.html#t:t/0)() | nil, show_message: [GenLSP.Structures.ShowMessageRequestClientCapabilities.t](GenLSP.Structures.ShowMessageRequestClientCapabilities.html#t:t/0)() | nil, work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WindowClientCapabilities{} ============================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/window_client_capabilities.ex#L27 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_progress: It indicates whether the client supports server initiated progress using the `window/workDoneProgress/create` request. The capability also controls Whether client supports handling of progress notifications. If set servers are allowed to report a `workDoneProgress` property in the request specific server capabilities. @since 3.15.0 * show\_message: Capabilities specific to the showMessage request. @since 3.16.0 * show\_document: Capabilities specific to the showDocument request. @since 3.16.0 GenLSP.Structures.WorkDoneProgressBegin β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/work_done_progress_begin.ex#L2 "View Source") GenLSP.Structures.WorkDoneProgressBegin (gen\_lsp v0.6.0) ==================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WorkDoneProgressBegin{}](#__struct__/0) Fields ------ * kind [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/work_done_progress_begin.ex#L31 "View Source") ``` @type t() :: %GenLSP.Structures.WorkDoneProgressBegin{ cancellable: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, kind: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), message: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, percentage: [GenLSP.BaseTypes.uinteger](GenLSP.BaseTypes.html#t:uinteger/0)() | nil, title: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WorkDoneProgressBegin{} ========================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/work_done_progress_begin.ex#L31 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * kind * title: Mandatory title of the progress operation. Used to briefly inform about the kind of operation being performed. Examples: "Indexing" or "Linking dependencies". * cancellable: Controls if a cancel button should show to allow the user to cancel the long running operation. Clients that don't support cancellation are allowed to ignore the setting. * message: Optional, more detailed associated progress message. Contains complementary information to the `title`. Examples: "3/25 files", "project/src/module2", "node\_modules/some\_dep". If unset, the previous progress message (if any) is still valid. * percentage: Optional progress percentage to display (value 100 is considered 100%). If not provided infinite progress is assumed and clients are allowed to ignore the `percentage` value in subsequent in report notifications. The value should be steadily rising. Clients are free to ignore values that are not following this rule. The value range is [0, 100]. GenLSP.Structures.WorkDoneProgressCancelParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/work_done_progress_cancel_params.ex#L2 "View Source") GenLSP.Structures.WorkDoneProgressCancelParams (gen\_lsp v0.6.0) =================================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WorkDoneProgressCancelParams{}](#__struct__/0) Fields ------ * token: The token to be used to report progress. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/work_done_progress_cancel_params.ex#L13 "View Source") ``` @type t() :: %GenLSP.Structures.WorkDoneProgressCancelParams{ token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WorkDoneProgressCancelParams{} ================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/work_done_progress_cancel_params.ex#L13 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * token: The token to be used to report progress. GenLSP.Structures.WorkDoneProgressCreateParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/work_done_progress_create_params.ex#L2 "View Source") GenLSP.Structures.WorkDoneProgressCreateParams (gen\_lsp v0.6.0) =================================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WorkDoneProgressCreateParams{}](#__struct__/0) Fields ------ * token: The token to be used to report progress. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/work_done_progress_create_params.ex#L13 "View Source") ``` @type t() :: %GenLSP.Structures.WorkDoneProgressCreateParams{ token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WorkDoneProgressCreateParams{} ================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/work_done_progress_create_params.ex#L13 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * token: The token to be used to report progress. GenLSP.Structures.WorkDoneProgressEnd β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/work_done_progress_end.ex#L2 "View Source") GenLSP.Structures.WorkDoneProgressEnd (gen\_lsp v0.6.0) ================================================================================================================================================================================================================ [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WorkDoneProgressEnd{}](#__struct__/0) Fields ------ * kind * message: Optional, a final message indicating to for example indicate the outcome of the operation. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/work_done_progress_end.ex#L15 "View Source") ``` @type t() :: %GenLSP.Structures.WorkDoneProgressEnd{ kind: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), message: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WorkDoneProgressEnd{} ======================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/work_done_progress_end.ex#L15 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * kind * message: Optional, a final message indicating to for example indicate the outcome of the operation. GenLSP.Structures.WorkDoneProgressOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/work_done_progress_options.ex#L2 "View Source") GenLSP.Structures.WorkDoneProgressOptions (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WorkDoneProgressOptions{}](#__struct__/0) Fields ------ * work\_done\_progress [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/work_done_progress_options.ex#L13 "View Source") ``` @type t() :: %GenLSP.Structures.WorkDoneProgressOptions{ work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WorkDoneProgressOptions{} ============================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/work_done_progress_options.ex#L13 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_progress GenLSP.Structures.WorkDoneProgressParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/work_done_progress_params.ex#L2 "View Source") GenLSP.Structures.WorkDoneProgressParams (gen\_lsp v0.6.0) ====================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WorkDoneProgressParams{}](#__struct__/0) Fields ------ * work\_done\_token: An optional token that a server can use to report work done progress. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/work_done_progress_params.ex#L13 "View Source") ``` @type t() :: %GenLSP.Structures.WorkDoneProgressParams{ work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WorkDoneProgressParams{} =========================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/work_done_progress_params.ex#L13 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * work\_done\_token: An optional token that a server can use to report work done progress. GenLSP.Structures.WorkDoneProgressReport β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/work_done_progress_report.ex#L2 "View Source") GenLSP.Structures.WorkDoneProgressReport (gen\_lsp v0.6.0) ====================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WorkDoneProgressReport{}](#__struct__/0) Fields ------ * kind [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/work_done_progress_report.ex#L28 "View Source") ``` @type t() :: %GenLSP.Structures.WorkDoneProgressReport{ cancellable: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, kind: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), message: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, percentage: [GenLSP.BaseTypes.uinteger](GenLSP.BaseTypes.html#t:uinteger/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WorkDoneProgressReport{} =========================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/work_done_progress_report.ex#L28 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * kind * cancellable: Controls enablement state of a cancel button. Clients that don't support cancellation or don't support controlling the button's enablement state are allowed to ignore the property. * message: Optional, more detailed associated progress message. Contains complementary information to the `title`. Examples: "3/25 files", "project/src/module2", "node\_modules/some\_dep". If unset, the previous progress message (if any) is still valid. * percentage: Optional progress percentage to display (value 100 is considered 100%). If not provided infinite progress is assumed and clients are allowed to ignore the `percentage` value in subsequent in report notifications. The value should be steadily rising. Clients are free to ignore values that are not following this rule. The value range is [0, 100] GenLSP.Structures.WorkspaceClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_client_capabilities.ex#L2 "View Source") GenLSP.Structures.WorkspaceClientCapabilities (gen\_lsp v0.6.0) =============================================================================================================================================================================================================================== Workspace specific client capabilities. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WorkspaceClientCapabilities{}](#__struct__/0) Fields ------ * apply\_edit: The client supports applying batch edits to the workspace by supporting the request 'workspace/applyEdit' [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_client_capabilities.ex#L53 "View Source") ``` @type t() :: %GenLSP.Structures.WorkspaceClientCapabilities{ apply_edit: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, code_lens: [GenLSP.Structures.CodeLensWorkspaceClientCapabilities.t](GenLSP.Structures.CodeLensWorkspaceClientCapabilities.html#t:t/0)() | nil, configuration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, diagnostics: [GenLSP.Structures.DiagnosticWorkspaceClientCapabilities.t](GenLSP.Structures.DiagnosticWorkspaceClientCapabilities.html#t:t/0)() | nil, did_change_configuration: [GenLSP.Structures.DidChangeConfigurationClientCapabilities.t](GenLSP.Structures.DidChangeConfigurationClientCapabilities.html#t:t/0)() | nil, did_change_watched_files: [GenLSP.Structures.DidChangeWatchedFilesClientCapabilities.t](GenLSP.Structures.DidChangeWatchedFilesClientCapabilities.html#t:t/0)() | nil, execute_command: [GenLSP.Structures.ExecuteCommandClientCapabilities.t](GenLSP.Structures.ExecuteCommandClientCapabilities.html#t:t/0)() | nil, file_operations: [GenLSP.Structures.FileOperationClientCapabilities.t](GenLSP.Structures.FileOperationClientCapabilities.html#t:t/0)() | nil, inlay_hint: [GenLSP.Structures.InlayHintWorkspaceClientCapabilities.t](GenLSP.Structures.InlayHintWorkspaceClientCapabilities.html#t:t/0)() | nil, inline_value: [GenLSP.Structures.InlineValueWorkspaceClientCapabilities.t](GenLSP.Structures.InlineValueWorkspaceClientCapabilities.html#t:t/0)() | nil, semantic_tokens: [GenLSP.Structures.SemanticTokensWorkspaceClientCapabilities.t](GenLSP.Structures.SemanticTokensWorkspaceClientCapabilities.html#t:t/0)() | nil, symbol: [GenLSP.Structures.WorkspaceSymbolClientCapabilities.t](GenLSP.Structures.WorkspaceSymbolClientCapabilities.html#t:t/0)() | nil, workspace_edit: [GenLSP.Structures.WorkspaceEditClientCapabilities.t](GenLSP.Structures.WorkspaceEditClientCapabilities.html#t:t/0)() | nil, workspace_folders: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WorkspaceClientCapabilities{} ================================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_client_capabilities.ex#L53 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * apply\_edit: The client supports applying batch edits to the workspace by supporting the request 'workspace/applyEdit' * workspace\_edit: Capabilities specific to `WorkspaceEdit`s. * did\_change\_configuration: Capabilities specific to the `workspace/didChangeConfiguration` notification. * did\_change\_watched\_files: Capabilities specific to the `workspace/didChangeWatchedFiles` notification. * symbol: Capabilities specific to the `workspace/symbol` request. * execute\_command: Capabilities specific to the `workspace/executeCommand` request. * workspace\_folders: The client has support for workspace folders. @since 3.6.0 * configuration: The client supports `workspace/configuration` requests. @since 3.6.0 * semantic\_tokens: Capabilities specific to the semantic token requests scoped to the workspace. @since 3.16.0. * code\_lens: Capabilities specific to the code lens requests scoped to the workspace. @since 3.16.0. * file\_operations: The client has support for file notifications/requests for user operations on files. Since 3.16.0 * inline\_value: Capabilities specific to the inline values requests scoped to the workspace. @since 3.17.0. * inlay\_hint: Capabilities specific to the inlay hint requests scoped to the workspace. @since 3.17.0. * diagnostics: Capabilities specific to the diagnostic requests scoped to the workspace. @since 3.17.0. GenLSP.Structures.WorkspaceDiagnosticParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_diagnostic_params.ex#L2 "View Source") GenLSP.Structures.WorkspaceDiagnosticParams (gen\_lsp v0.6.0) =========================================================================================================================================================================================================================== Parameters of the workspace diagnostic request. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WorkspaceDiagnosticParams{}](#__struct__/0) Fields ------ * identifier: The additional identifier provided during registration. * previous\_result\_ids: The currently known diagnostic reports with their previous result ids. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_diagnostic_params.ex#L24 "View Source") ``` @type t() :: %GenLSP.Structures.WorkspaceDiagnosticParams{ identifier: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, previous_result_ids: [[GenLSP.Structures.PreviousResultId.t](GenLSP.Structures.PreviousResultId.html#t:t/0)()], work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WorkspaceDiagnosticParams{} ============================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_diagnostic_params.ex#L24 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * identifier: The additional identifier provided during registration. * previous\_result\_ids: The currently known diagnostic reports with their previous result ids. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. GenLSP.Structures.WorkspaceDiagnosticReport β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_diagnostic_report.ex#L2 "View Source") GenLSP.Structures.WorkspaceDiagnosticReport (gen\_lsp v0.6.0) =========================================================================================================================================================================================================================== A workspace diagnostic report. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WorkspaceDiagnosticReport{}](#__struct__/0) Fields ------ * items [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_diagnostic_report.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.WorkspaceDiagnosticReport{ items: [[GenLSP.TypeAlias.WorkspaceDocumentDiagnosticReport.t](GenLSP.TypeAlias.WorkspaceDocumentDiagnosticReport.html#t:t/0)()] } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WorkspaceDiagnosticReport{} ============================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_diagnostic_report.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * items GenLSP.Structures.WorkspaceDiagnosticReportPartialResult β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_diagnostic_report_partial_result.ex#L2 "View Source") GenLSP.Structures.WorkspaceDiagnosticReportPartialResult (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================================================= A partial result for a workspace diagnostic report. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WorkspaceDiagnosticReportPartialResult{}](#__struct__/0) Fields ------ * items [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_diagnostic_report_partial_result.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.WorkspaceDiagnosticReportPartialResult{ items: [[GenLSP.TypeAlias.WorkspaceDocumentDiagnosticReport.t](GenLSP.TypeAlias.WorkspaceDocumentDiagnosticReport.html#t:t/0)()] } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WorkspaceDiagnosticReportPartialResult{} =========================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_diagnostic_report_partial_result.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * items GenLSP.Structures.WorkspaceEdit β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_edit.ex#L2 "View Source") GenLSP.Structures.WorkspaceEdit (gen\_lsp v0.6.0) ================================================================================================================================================================================================== A workspace edit represents changes to many resources managed in the workspace. The edit should either provide `changes` or `documentChanges`. If documentChanges are present they are preferred over `changes` if the client can handle versioned document edits. Since version 3.13.0 a workspace edit can contain resource operations as well. If resource operations are present clients need to execute the operations in the order in which they are provided. So a workspace edit for example can consist of the following two changes: (1) a create file a.txt and (2) a text document edit which insert text into file a.txt. An invalid sequence (e.g. (1) delete file a.txt and (2) insert text into file a.txt) will cause failure of the operation. How the client recovers from the failure is described by the client capability: `workspace.workspaceEdit.failureHandling` [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WorkspaceEdit{}](#__struct__/0) Fields ------ * changes: Holds changes to existing resources. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_edit.ex#L44 "View Source") ``` @type t() :: %GenLSP.Structures.WorkspaceEdit{ change_annotations: %{ required([GenLSP.TypeAlias.ChangeAnnotationIdentifier.t](GenLSP.TypeAlias.ChangeAnnotationIdentifier.html#t:t/0)()) => [GenLSP.Structures.ChangeAnnotation.t](GenLSP.Structures.ChangeAnnotation.html#t:t/0)() } | nil, changes: %{ required([GenLSP.BaseTypes.document\_uri](GenLSP.BaseTypes.html#t:document_uri/0)()) => [ [GenLSP.Structures.TextEdit.t](GenLSP.Structures.TextEdit.html#t:t/0)() ] } | nil, document_changes: [ [GenLSP.Structures.TextDocumentEdit.t](GenLSP.Structures.TextDocumentEdit.html#t:t/0)() | [GenLSP.Structures.CreateFile.t](GenLSP.Structures.CreateFile.html#t:t/0)() | [GenLSP.Structures.RenameFile.t](GenLSP.Structures.RenameFile.html#t:t/0)() | [GenLSP.Structures.DeleteFile.t](GenLSP.Structures.DeleteFile.html#t:t/0)() ] | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WorkspaceEdit{} ================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_edit.ex#L44 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * changes: Holds changes to existing resources. * document\_changes: Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes are either an array of `TextDocumentEdit`s to express changes to n different text documents where each text document edit addresses a specific version of a text document. Or it can contain above `TextDocumentEdit`s mixed with create, rename and delete file / folder operations. Whether a client supports versioned document edits is expressed via `workspace.workspaceEdit.documentChanges` client capability. If a client neither supports `documentChanges` nor `workspace.workspaceEdit.resourceOperations` then only plain `TextEdit`s using the `changes` property are supported. * change\_annotations: A map of change annotations that can be referenced in `AnnotatedTextEdit`s or create, rename and delete file / folder operations. Whether clients honor this property depends on the client capability `workspace.changeAnnotationSupport`. @since 3.16.0 GenLSP.Structures.WorkspaceEditClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_edit_client_capabilities.ex#L2 "View Source") GenLSP.Structures.WorkspaceEditClientCapabilities (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WorkspaceEditClientCapabilities{}](#__struct__/0) Fields ------ * document\_changes: The client supports versioned document changes in `WorkspaceEdit`s [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_edit_client_capabilities.ex#L32 "View Source") ``` @type t() :: %GenLSP.Structures.WorkspaceEditClientCapabilities{ change_annotation_support: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil, document_changes: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, failure_handling: [GenLSP.Enumerations.FailureHandlingKind.t](GenLSP.Enumerations.FailureHandlingKind.html#t:t/0)() | nil, normalizes_line_endings: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, resource_operations: [[GenLSP.Enumerations.ResourceOperationKind.t](GenLSP.Enumerations.ResourceOperationKind.html#t:t/0)()] | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WorkspaceEditClientCapabilities{} ==================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_edit_client_capabilities.ex#L32 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * document\_changes: The client supports versioned document changes in `WorkspaceEdit`s * resource\_operations: The resource operations the client supports. Clients should at least support 'create', 'rename' and 'delete' files and folders. @since 3.13.0 * failure\_handling: The failure handling strategy of a client if applying the workspace edit fails. @since 3.13.0 * normalizes\_line\_endings: Whether the client normalizes line endings to the client specific setting. If set to `true` the client will normalize line ending characters in a workspace edit to the client-specified new line character. @since 3.16.0 * change\_annotation\_support: Whether the client in general supports change annotations on text edits, create file, rename file and delete file changes. @since 3.16.0 GenLSP.Structures.WorkspaceFolder β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_folder.ex#L2 "View Source") GenLSP.Structures.WorkspaceFolder (gen\_lsp v0.6.0) ====================================================================================================================================================================================================== A workspace folder inside a client. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WorkspaceFolder{}](#__struct__/0) Fields ------ * uri: The associated URI for this workspace folder. * name: The name of the workspace folder. Used to refer to this workspace folder in the user interface. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_folder.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.WorkspaceFolder{ name: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), uri: [GenLSP.BaseTypes.uri](GenLSP.BaseTypes.html#t:uri/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WorkspaceFolder{} ==================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_folder.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * uri: The associated URI for this workspace folder. * name: The name of the workspace folder. Used to refer to this workspace folder in the user interface. GenLSP.Structures.WorkspaceFoldersChangeEvent β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_folders_change_event.ex#L2 "View Source") GenLSP.Structures.WorkspaceFoldersChangeEvent (gen\_lsp v0.6.0) ================================================================================================================================================================================================================================ The workspace folder change event. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WorkspaceFoldersChangeEvent{}](#__struct__/0) Fields ------ * added: The array of added workspace folders * removed: The array of the removed workspace folders [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_folders_change_event.ex#L18 "View Source") ``` @type t() :: %GenLSP.Structures.WorkspaceFoldersChangeEvent{ added: [[GenLSP.Structures.WorkspaceFolder.t](GenLSP.Structures.WorkspaceFolder.html#t:t/0)()], removed: [[GenLSP.Structures.WorkspaceFolder.t](GenLSP.Structures.WorkspaceFolder.html#t:t/0)()] } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WorkspaceFoldersChangeEvent{} ================================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_folders_change_event.ex#L18 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * added: The array of added workspace folders * removed: The array of the removed workspace folders GenLSP.Structures.WorkspaceFoldersInitializeParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_folders_initialize_params.ex#L2 "View Source") GenLSP.Structures.WorkspaceFoldersInitializeParams (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WorkspaceFoldersInitializeParams{}](#__struct__/0) Fields ------ * workspace\_folders: The workspace folders configured in the client when the server starts. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_folders_initialize_params.ex#L19 "View Source") ``` @type t() :: %GenLSP.Structures.WorkspaceFoldersInitializeParams{ workspace_folders: ([[GenLSP.Structures.WorkspaceFolder.t](GenLSP.Structures.WorkspaceFolder.html#t:t/0)()] | nil) | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WorkspaceFoldersInitializeParams{} ===================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_folders_initialize_params.ex#L19 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * workspace\_folders: The workspace folders configured in the client when the server starts. This property is only available if the client supports workspace folders. It can be `null` if the client supports workspace folders but none are configured. @since 3.6.0 GenLSP.Structures.WorkspaceFoldersServerCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_folders_server_capabilities.ex#L2 "View Source") GenLSP.Structures.WorkspaceFoldersServerCapabilities (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WorkspaceFoldersServerCapabilities{}](#__struct__/0) Fields ------ * supported: The server has support for workspace folders [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_folders_server_capabilities.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.WorkspaceFoldersServerCapabilities{ change_notifications: ([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) | nil, supported: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WorkspaceFoldersServerCapabilities{} ======================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_folders_server_capabilities.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * supported: The server has support for workspace folders * change\_notifications: Whether the server wants to receive workspace folder change notifications. If a string is provided the string is treated as an ID under which the notification is registered on the client side. The ID can be used to unregister for these events using the `client/unregisterCapability` request. GenLSP.Structures.WorkspaceFullDocumentDiagnosticReport β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_full_document_diagnostic_report.ex#L2 "View Source") GenLSP.Structures.WorkspaceFullDocumentDiagnosticReport (gen\_lsp v0.6.0) ===================================================================================================================================================================================================================================================== A full document diagnostic report for a workspace diagnostic result. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WorkspaceFullDocumentDiagnosticReport{}](#__struct__/0) Fields ------ * uri: The URI for which diagnostic information is reported. * version: The version number for which the diagnostics are reported. If the document is not marked as open `null` can be provided. * kind: A full document diagnostic report. * result\_id: An optional result id. If provided it will be sent on the next diagnostic request for the same document. * items: The actual items. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_full_document_diagnostic_report.ex#L26 "View Source") ``` @type t() :: %GenLSP.Structures.WorkspaceFullDocumentDiagnosticReport{ items: [[GenLSP.Structures.Diagnostic.t](GenLSP.Structures.Diagnostic.html#t:t/0)()], kind: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), result_id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, uri: [GenLSP.BaseTypes.document\_uri](GenLSP.BaseTypes.html#t:document_uri/0)(), version: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WorkspaceFullDocumentDiagnosticReport{} ========================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_full_document_diagnostic_report.ex#L26 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * uri: The URI for which diagnostic information is reported. * version: The version number for which the diagnostics are reported. If the document is not marked as open `null` can be provided. * kind: A full document diagnostic report. * result\_id: An optional result id. If provided it will be sent on the next diagnostic request for the same document. * items: The actual items. GenLSP.Structures.WorkspaceSymbol β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_symbol.ex#L2 "View Source") GenLSP.Structures.WorkspaceSymbol (gen\_lsp v0.6.0) ====================================================================================================================================================================================================== A special workspace symbol that supports locations without a range. See also SymbolInformation. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WorkspaceSymbol{}](#__struct__/0) Fields ------ * location: The location of the symbol. Whether a server is allowed to return a location without a range depends on the client capability `workspace.symbol.resolveSupport`. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_symbol.ex#L36 "View Source") ``` @type t() :: %GenLSP.Structures.WorkspaceSymbol{ container_name: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, data: [GenLSP.TypeAlias.LSPAny.t](GenLSP.TypeAlias.LSPAny.html#t:t/0)() | nil, kind: [GenLSP.Enumerations.SymbolKind.t](GenLSP.Enumerations.SymbolKind.html#t:t/0)(), location: [GenLSP.Structures.Location.t](GenLSP.Structures.Location.html#t:t/0)() | [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), name: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), tags: [[GenLSP.Enumerations.SymbolTag.t](GenLSP.Enumerations.SymbolTag.html#t:t/0)()] | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WorkspaceSymbol{} ==================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_symbol.ex#L36 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * location: The location of the symbol. Whether a server is allowed to return a location without a range depends on the client capability `workspace.symbol.resolveSupport`. See SymbolInformation#location for more details. * data: A data entry field that is preserved on a workspace symbol between a workspace symbol request and a workspace symbol resolve request. * name: The name of this symbol. * kind: The kind of this symbol. * tags: Tags for this symbol. @since 3.16.0 * container\_name: The name of the symbol containing this symbol. This information is for user interface purposes (e.g. to render a qualifier in the user interface if necessary). It can't be used to re-infer a hierarchy for the document symbols. GenLSP.Structures.WorkspaceSymbolClientCapabilities β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_symbol_client_capabilities.ex#L2 "View Source") GenLSP.Structures.WorkspaceSymbolClientCapabilities (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================================ Client capabilities for a {@link WorkspaceSymbolRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WorkspaceSymbolClientCapabilities{}](#__struct__/0) Fields ------ * dynamic\_registration: Symbol request supports dynamic registration. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_symbol_client_capabilities.ex#L27 "View Source") ``` @type t() :: %GenLSP.Structures.WorkspaceSymbolClientCapabilities{ dynamic_registration: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, resolve_support: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil, symbol_kind: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil, tag_support: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WorkspaceSymbolClientCapabilities{} ====================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_symbol_client_capabilities.ex#L27 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * dynamic\_registration: Symbol request supports dynamic registration. * symbol\_kind: Specific capabilities for the `SymbolKind` in the `workspace/symbol` request. * tag\_support: The client supports tags on `SymbolInformation`. Clients supporting tags have to handle unknown tags gracefully. @since 3.16.0 * resolve\_support: The client support partial workspace symbols. The client will send the request `workspaceSymbol/resolve` to the server to resolve additional properties. @since 3.17.0 GenLSP.Structures.WorkspaceSymbolOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_symbol_options.ex#L2 "View Source") GenLSP.Structures.WorkspaceSymbolOptions (gen\_lsp v0.6.0) ===================================================================================================================================================================================================================== Server capabilities for a {@link WorkspaceSymbolRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WorkspaceSymbolOptions{}](#__struct__/0) Fields ------ * resolve\_provider: The server provides support to resolve additional information for a workspace symbol. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_symbol_options.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.WorkspaceSymbolOptions{ resolve_provider: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, work_done_progress: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WorkspaceSymbolOptions{} =========================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_symbol_options.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * resolve\_provider: The server provides support to resolve additional information for a workspace symbol. @since 3.17.0 * work\_done\_progress GenLSP.Structures.WorkspaceSymbolParams β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_symbol_params.ex#L2 "View Source") GenLSP.Structures.WorkspaceSymbolParams (gen\_lsp v0.6.0) =================================================================================================================================================================================================================== The parameters of a {@link WorkspaceSymbolRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WorkspaceSymbolParams{}](#__struct__/0) Fields ------ * query: A query string to filter symbols by. Clients may send an empty string here to request all symbols. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_symbol_params.ex#L21 "View Source") ``` @type t() :: %GenLSP.Structures.WorkspaceSymbolParams{ partial_result_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil, query: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), work_done_token: [GenLSP.TypeAlias.ProgressToken.t](GenLSP.TypeAlias.ProgressToken.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WorkspaceSymbolParams{} ========================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_symbol_params.ex#L21 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * query: A query string to filter symbols by. Clients may send an empty string here to request all symbols. * work\_done\_token: An optional token that a server can use to report work done progress. * partial\_result\_token: An optional token that a server can use to report partial results (e.g. streaming) to the client. GenLSP.Structures.WorkspaceSymbolRegistrationOptions β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_symbol_registration_options.ex#L2 "View Source") GenLSP.Structures.WorkspaceSymbolRegistrationOptions (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================================== Registration options for a {@link WorkspaceSymbolRequest}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WorkspaceSymbolRegistrationOptions{}](#__struct__/0) Fields ------ * resolve\_provider: The server provides support to resolve additional information for a workspace symbol. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_symbol_registration_options.ex#L20 "View Source") ``` @type t() :: %GenLSP.Structures.WorkspaceSymbolRegistrationOptions{ resolve_provider: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WorkspaceSymbolRegistrationOptions{} ======================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_symbol_registration_options.ex#L20 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * resolve\_provider: The server provides support to resolve additional information for a workspace symbol. @since 3.17.0 GenLSP.Structures.WorkspaceUnchangedDocumentDiagnosticReport β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_unchanged_document_diagnostic_report.ex#L2 "View Source") GenLSP.Structures.WorkspaceUnchangedDocumentDiagnosticReport (gen\_lsp v0.6.0) =============================================================================================================================================================================================================================================================== An unchanged document diagnostic report for a workspace diagnostic result. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%GenLSP.Structures.WorkspaceUnchangedDocumentDiagnosticReport{}](#__struct__/0) Fields ------ * uri: The URI for which diagnostic information is reported. * version: The version number for which the diagnostics are reported. If the document is not marked as open `null` can be provided. * kind: A document diagnostic report indicating no changes to the last result. A server can only return `unchanged` if result ids are provided. * result\_id: A result id which will be sent on the next diagnostic request for the same document. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_unchanged_document_diagnostic_report.ex#L27 "View Source") ``` @type t() :: %GenLSP.Structures.WorkspaceUnchangedDocumentDiagnosticReport{ kind: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), result_id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), uri: [GenLSP.BaseTypes.document\_uri](GenLSP.BaseTypes.html#t:document_uri/0)(), version: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %GenLSP.Structures.WorkspaceUnchangedDocumentDiagnosticReport{} =============================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/structures/workspace_unchanged_document_diagnostic_report.ex#L27 "View Source") (struct) [fields](#__struct__/0-fields) Fields --------------------------------------- * uri: The URI for which diagnostic information is reported. * version: The version number for which the diagnostics are reported. If the document is not marked as open `null` can be provided. * kind: A document diagnostic report indicating no changes to the last result. A server can only return `unchanged` if result ids are provided. * result\_id: A result id which will be sent on the next diagnostic request for the same document. GenLSP.Test β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/test.ex#L1 "View Source") GenLSP.Test (gen\_lsp v0.6.0) ================================================================================================================================================ Conveniences for testing GenLSP processes. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [client()](#t:client/0) The test client data structure. [server()](#t:server/0) The test server data structure. [Functions](#functions) ------------------------ [alive?(map)](#alive?/1) Simple helper to determine whether the LSP process is alive. [assert\_error(id, pattern, timeout \\ Application.get\_env(:ex\_unit, :assert\_receive\_timeout))](#assert_error/3) Assert on the error response of a request that was sent with [`GenLSP.Test.request/2`](#request/2). [assert\_notification(method, pattern, timeout \\ Application.get\_env(:ex\_unit, :assert\_receive\_timeout))](#assert_notification/3) Assert on a notification that was sent from the server. [assert\_request(client, method, timeout \\ Application.get\_env(:ex\_unit, :assert\_receive\_timeout), callback)](#assert_request/4) Assert on a request that was sent from the server. [assert\_result(id, pattern, timeout \\ Application.get\_env(:ex\_unit, :assert\_receive\_timeout))](#assert_result/3) Assert on the successful response of a request that was sent with [`GenLSP.Test.request/2`](#request/2). [client(server)](#client/1) Starts a new LSP client for the given server. [notify(map, body)](#notify/2) Send a notification from the client to the server. [request(map, body)](#request/2) Send a request from the client to the server. [server(mod, opts \\ [])](#server/2) Starts a new server. [Link to this section](#types) Types ===================================== [Link to this opaque](#t:client/0 "Link to this opaque") client() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/test.ex#L18 "View Source") (opaque) ``` @opaque client() ``` The test client data structure. [Link to this opaque](#t:server/0 "Link to this opaque") server() ======== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/test.ex#L13 "View Source") (opaque) ``` @opaque server() ``` The test server data structure. [Link to this section](#functions) Functions ============================================= [Link to this function](#alive?/1 "Link to this function") alive?(map) =========== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/test.ex#L141 "View Source") ``` @spec alive?([server](#t:server/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Simple helper to determine whether the LSP process is alive. [Link to this macro](#assert_error/3 "Link to this macro") assert\_error(id, pattern, timeout \\ Application.get\_env(:ex\_unit, :assert\_receive\_timeout)) ================================================================================================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/test.ex#L222 "View Source") (macro) Assert on the error response of a request that was sent with [`GenLSP.Test.request/2`](#request/2). The second argument is a pattern, similar to [`ExUnit.Assertions.assert_receive/3`](https://hexdocs.pm/ex_unit/ExUnit.Assertions.html#assert_receive/3). [usage](#assert_error/3-usage) Usage -------------------------------------- ``` import GenLSP.Test id = 3 request(client, %{ method: "textDocument/documentSymbol", id: id, jsonrpc: "2.0", params: %{ textDocument: %{ uri: "file://file/doesnt/matter.ex" } } }) assert\_error(^id, %{ "code" => -32601, "message" => "Method Not Found" }) ``` [Link to this macro](#assert_notification/3 "Link to this macro") assert\_notification(method, pattern, timeout \\ Application.get\_env(:ex\_unit, :assert\_receive\_timeout)) ============================================================================================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/test.ex#L255 "View Source") (macro) Assert on a notification that was sent from the server. The second argument is a pattern, similar to [`ExUnit.Assertions.assert_receive/3`](https://hexdocs.pm/ex_unit/ExUnit.Assertions.html#assert_receive/3). [usage](#assert_notification/3-usage) Usage --------------------------------------------- ``` import GenLSP.Test notify(client, %{method: "initialized", jsonrpc: "2.0", params: %{}}) assert\_notification("window/logMessage", %{ "message" => "[MyLSP] LSP Initialized!", "type" => 4 }) ``` [Link to this macro](#assert_request/4 "Link to this macro") assert\_request(client, method, timeout \\ Application.get\_env(:ex\_unit, :assert\_receive\_timeout), callback) ================================================================================================================ [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/test.ex#L297 "View Source") (macro) Assert on a request that was sent from the server. [usage](#assert_request/4-usage) Usage ---------------------------------------- ``` assert\_request(client, "client/registerCapability", 1000, fn params -> assert params == %{ "registrations" => [ %{ "id" => "file-watching", "method" => "workspace/didChangeWatchedFiles", "registerOptions" => %{ "watchers" => [ %{ "globPattern" => "{lib|test}/\*\*/\*.{ex|exs|heex|eex|leex|surface}" } ] } } ] } nil end) ``` [Link to this macro](#assert_result/3 "Link to this macro") assert\_result(id, pattern, timeout \\ Application.get\_env(:ex\_unit, :assert\_receive\_timeout)) ================================================================================================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/test.ex#L178 "View Source") (macro) Assert on the successful response of a request that was sent with [`GenLSP.Test.request/2`](#request/2). The second argument is a pattern, similar to [`ExUnit.Assertions.assert_receive/3`](https://hexdocs.pm/ex_unit/ExUnit.Assertions.html#assert_receive/3). [usage](#assert_result/3-usage) Usage --------------------------------------- ``` import GenLSP.Test id = 1 request(client, %{ method: "initialize", id: id, jsonrpc: "2.0", params: %{capabilities: %{}, rootUri: "file://#{root\_path}"} }) assert\_result(^id, %{ "capabilities" => %{ "textDocumentSync" => %{ "openClose" => true, "save" => %{ "includeText" => true }, "change" => 1 } }, "serverInfo" => %{"name" => "Credo"} }) ``` [Link to this function](#client/1 "Link to this function") client(server) ============== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/test.ex#L58 "View Source") ``` @spec client([server](#t:server/0)()) :: [client](#t:client/0)() ``` Starts a new LSP client for the given server. The "client" is equivalent to a text editor. [usage](#client/1-usage) Usage -------------------------------- ``` import GenLSP.Test server = server(MyLSP, some\_arg: some\_arg) client = client(server) ``` [Link to this function](#notify/2 "Link to this function") notify(map, body) ================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/test.ex#L133 "View Source") ``` @spec notify([client](#t:client/0)(), [Jason.Encoder.t](https://hexdocs.pm/jason/1.3.0/Jason.Encoder.html#t:t/0)()) :: :ok ``` Send a notification from the client to the server. [usage](#notify/2-usage) Usage -------------------------------- ``` import GenLSP.Test notify(client, %{ method: "initialized", jsonrpc: "2.0", params: %{} }) ``` [Link to this function](#request/2 "Link to this function") request(map, body) ================== [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/test.ex#L113 "View Source") ``` @spec request([client](#t:client/0)(), [Jason.Encoder.t](https://hexdocs.pm/jason/1.3.0/Jason.Encoder.html#t:t/0)()) :: {:ok, [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} | {:error, :closed | {:timeout, [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | [:inet.posix](https://www.erlang.org/doc/man/inet.html#type-posix)()} ``` Send a request from the client to the server. The response from the server will be sent as a message to the current process and can be asserted on using [`GenLSP.Test.assert_result/3`](#assert_result/3). [usage](#request/2-usage) Usage --------------------------------- ``` import GenLSP.Test request(client, %{ method: "initialize", id: 1, jsonrpc: "2.0", params: %{capabilities: %{}, rootUri: "file://#{root\_path}"} }) ``` [Link to this function](#server/2 "Link to this function") server(mod, opts \\ []) ======================= [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/test.ex#L32 "View Source") Starts a new server. [usage](#server/2-usage) Usage -------------------------------- ``` import GenLSP.Test server = server(MyLSP, some\_arg: some\_arg) ``` GenLSP.TypeAlias.ChangeAnnotationIdentifier β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/change_annotation_identifier.ex#L2 "View Source") GenLSP.TypeAlias.ChangeAnnotationIdentifier (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================== An identifier to refer to a change annotation stored with a workspace edit. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/change_annotation_identifier.ex#L9 "View Source") ``` @type t() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` GenLSP.TypeAlias.Declaration β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/declaration.ex#L2 "View Source") GenLSP.TypeAlias.Declaration (gen\_lsp v0.6.0) ============================================================================================================================================================================================== The declaration of a symbol representation as one or many {@link Location locations}. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/declaration.ex#L9 "View Source") ``` @type t() :: [GenLSP.Structures.Location.t](GenLSP.Structures.Location.html#t:t/0)() | [[GenLSP.Structures.Location.t](GenLSP.Structures.Location.html#t:t/0)()] ``` GenLSP.TypeAlias.DeclarationLink β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/declaration_link.ex#L2 "View Source") GenLSP.TypeAlias.DeclarationLink (gen\_lsp v0.6.0) ======================================================================================================================================================================================================= Information about where a symbol is declared. Provides additional metadata over normal {@link Location location} declarations, including the range of the declaring symbol. Servers should prefer returning `DeclarationLink` over `Declaration` if supported by the client. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/declaration_link.ex#L15 "View Source") ``` @type t() :: [GenLSP.Structures.LocationLink.t](GenLSP.Structures.LocationLink.html#t:t/0)() ``` GenLSP.TypeAlias.Definition β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/definition.ex#L2 "View Source") GenLSP.TypeAlias.Definition (gen\_lsp v0.6.0) ============================================================================================================================================================================================ The definition of a symbol represented as one or many {@link Location locations}. For most programming languages there is only one location at which a symbol is defined. Servers should prefer returning `DefinitionLink` over `Definition` if supported by the client. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/definition.ex#L14 "View Source") ``` @type t() :: [GenLSP.Structures.Location.t](GenLSP.Structures.Location.html#t:t/0)() | [[GenLSP.Structures.Location.t](GenLSP.Structures.Location.html#t:t/0)()] ``` GenLSP.TypeAlias.DefinitionLink β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/definition_link.ex#L2 "View Source") GenLSP.TypeAlias.DefinitionLink (gen\_lsp v0.6.0) ===================================================================================================================================================================================================== Information about where a symbol is defined. Provides additional metadata over normal {@link Location location} definitions, including the range of the defining symbol [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/definition_link.ex#L12 "View Source") ``` @type t() :: [GenLSP.Structures.LocationLink.t](GenLSP.Structures.LocationLink.html#t:t/0)() ``` GenLSP.TypeAlias.DocumentDiagnosticReport β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/document_diagnostic_report.ex#L2 "View Source") GenLSP.TypeAlias.DocumentDiagnosticReport (gen\_lsp v0.6.0) ========================================================================================================================================================================================================================== The result of a document diagnostic pull request. A report can either be a full report containing all diagnostics for the requested document or an unchanged report indicating that nothing has changed in terms of diagnostics in comparison to the last pull request. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/document_diagnostic_report.ex#L15 "View Source") ``` @type t() :: [GenLSP.Structures.RelatedFullDocumentDiagnosticReport.t](GenLSP.Structures.RelatedFullDocumentDiagnosticReport.html#t:t/0)() | [GenLSP.Structures.RelatedUnchangedDocumentDiagnosticReport.t](GenLSP.Structures.RelatedUnchangedDocumentDiagnosticReport.html#t:t/0)() ``` GenLSP.TypeAlias.DocumentFilter β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/document_filter.ex#L2 "View Source") GenLSP.TypeAlias.DocumentFilter (gen\_lsp v0.6.0) ===================================================================================================================================================================================================== A document filter describes a top level text document or a notebook cell document. @since 3.17.0 - proposed support for NotebookCellTextDocumentFilter. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/document_filter.ex#L12 "View Source") ``` @type t() :: [GenLSP.TypeAlias.TextDocumentFilter.t](GenLSP.TypeAlias.TextDocumentFilter.html#t:t/0)() | [GenLSP.Structures.NotebookCellTextDocumentFilter.t](GenLSP.Structures.NotebookCellTextDocumentFilter.html#t:t/0)() ``` GenLSP.TypeAlias.DocumentSelector β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/document_selector.ex#L2 "View Source") GenLSP.TypeAlias.DocumentSelector (gen\_lsp v0.6.0) ========================================================================================================================================================================================================= A document selector is the combination of one or many document filters. @sample `let sel:DocumentSelector = [{ language: 'typescript' }, { language: 'json', pattern: '**βˆ•tsconfig.json' }]`; The use of a string as a document filter is deprecated @since 3.16.0. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/document_selector.ex#L13 "View Source") ``` @type t() :: [[GenLSP.TypeAlias.DocumentFilter.t](GenLSP.TypeAlias.DocumentFilter.html#t:t/0)()] ``` GenLSP.TypeAlias.GlobPattern β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/glob_pattern.ex#L2 "View Source") GenLSP.TypeAlias.GlobPattern (gen\_lsp v0.6.0) =============================================================================================================================================================================================== The glob pattern. Either a string pattern or a relative pattern. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/glob_pattern.ex#L11 "View Source") ``` @type t() :: [GenLSP.TypeAlias.Pattern.t](GenLSP.TypeAlias.Pattern.html#t:t/0)() | [GenLSP.Structures.RelativePattern.t](GenLSP.Structures.RelativePattern.html#t:t/0)() ``` GenLSP.TypeAlias.InlineValue β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/inline_value.ex#L2 "View Source") GenLSP.TypeAlias.InlineValue (gen\_lsp v0.6.0) =============================================================================================================================================================================================== Inline value information can be provided by different means: * directly as a text value (class InlineValueText). * as a name to use for a variable lookup (class InlineValueVariableLookup) * as an evaluatable expression (class InlineValueEvaluatableExpression) The InlineValue types combines all inline value types into one type. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/inline_value.ex#L15 "View Source") ``` @type t() :: [GenLSP.Structures.InlineValueText.t](GenLSP.Structures.InlineValueText.html#t:t/0)() | [GenLSP.Structures.InlineValueVariableLookup.t](GenLSP.Structures.InlineValueVariableLookup.html#t:t/0)() | [GenLSP.Structures.InlineValueEvaluatableExpression.t](GenLSP.Structures.InlineValueEvaluatableExpression.html#t:t/0)() ``` GenLSP.TypeAlias.LSPAny β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/lsp_any.ex#L2 "View Source") GenLSP.TypeAlias.LSPAny (gen\_lsp v0.6.0) ===================================================================================================================================================================================== The LSP any type. Please note that strictly speaking a property with the value `undefined` can't be converted into JSON preserving the property name. However for convenience it is allowed and assumed that all these properties are optional as well. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/lsp_any.ex#L14 "View Source") ``` @type t() :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` GenLSP.TypeAlias.LSPArray β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/lsp_array.ex#L2 "View Source") GenLSP.TypeAlias.LSPArray (gen\_lsp v0.6.0) ========================================================================================================================================================================================= LSP arrays. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/lsp_array.ex#L10 "View Source") ``` @type t() :: [[any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()] ``` GenLSP.TypeAlias.LSPObject β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/lsp_object.ex#L2 "View Source") GenLSP.TypeAlias.LSPObject (gen\_lsp v0.6.0) =========================================================================================================================================================================================== LSP object definition. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/lsp_object.ex#L10 "View Source") ``` @type t() :: %{required([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) => [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` GenLSP.TypeAlias.MarkedString β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/marked_string.ex#L2 "View Source") GenLSP.TypeAlias.MarkedString (gen\_lsp v0.6.0) ================================================================================================================================================================================================= MarkedString can be used to render human readable text. It is either a markdown string or a code-block that provides a language and a code snippet. The language identifier is semantically equal to the optional language identifier in fenced code blocks in GitHub issues. See <https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting> The pair of a language and a value is an equivalent to markdown: ``` ${value} ``` Note that markdown strings will be sanitized - that means html will be escaped. @deprecated use MarkupContent instead. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/marked_string.ex#L20 "View Source") ``` @type t() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` GenLSP.TypeAlias.NotebookDocumentFilter β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/notebook_document_filter.ex#L2 "View Source") GenLSP.TypeAlias.NotebookDocumentFilter (gen\_lsp v0.6.0) ====================================================================================================================================================================================================================== A notebook document filter denotes a notebook document by different properties. The properties will be match against the notebook's URI (same as with documents) @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/notebook_document_filter.ex#L13 "View Source") ``` @type t() :: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` GenLSP.TypeAlias.Pattern β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/pattern.ex#L2 "View Source") GenLSP.TypeAlias.Pattern (gen\_lsp v0.6.0) ====================================================================================================================================================================================== The glob pattern to watch relative to the base path. Glob patterns can have the following syntax: * `*` to match one or more characters in a path segment * `?` to match on one character in a path segment * `**` to match any number of path segments, including none * `{}` to group conditions (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files) * `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) * `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/pattern.ex#L17 "View Source") ``` @type t() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` GenLSP.TypeAlias.PrepareRenameResult β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/prepare_rename_result.ex#L2 "View Source") GenLSP.TypeAlias.PrepareRenameResult (gen\_lsp v0.6.0) ================================================================================================================================================================================================================ [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/prepare_rename_result.ex#L5 "View Source") ``` @type t() :: [GenLSP.Structures.Range.t](GenLSP.Structures.Range.html#t:t/0)() | [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` GenLSP.TypeAlias.ProgressToken β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/progress_token.ex#L2 "View Source") GenLSP.TypeAlias.ProgressToken (gen\_lsp v0.6.0) =================================================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/progress_token.ex#L5 "View Source") ``` @type t() :: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` GenLSP.TypeAlias.TextDocumentContentChangeEvent β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/text_document_content_change_event.ex#L2 "View Source") GenLSP.TypeAlias.TextDocumentContentChangeEvent (gen\_lsp v0.6.0) ======================================================================================================================================================================================================================================== An event describing a change to a text document. If only a text is provided it is considered to be the full content of the document. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/text_document_content_change_event.ex#L10 "View Source") ``` @type t() :: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` GenLSP.TypeAlias.TextDocumentFilter β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/text_document_filter.ex#L2 "View Source") GenLSP.TypeAlias.TextDocumentFilter (gen\_lsp v0.6.0) ============================================================================================================================================================================================================== A document filter denotes a document by different properties like the {@link TextDocument.languageId language}, the {@link Uri.scheme scheme} of its resource, or a glob-pattern that is applied to the {@link TextDocument.fileName path}. Glob patterns can have the following syntax: * `*` to match one or more characters in a path segment * `?` to match on one character in a path segment * `**` to match any number of path segments, including none * `{}` to group sub patterns into an OR expression. (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files) * `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) * `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) @sample A language filter that applies to typescript files on disk: `{ language: 'typescript', scheme: 'file' }` @sample A language filter that applies to all package.json paths: `{ language: 'json', pattern: '**package.json' }` @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/text_document_filter.ex#L24 "View Source") ``` @type t() :: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` GenLSP.TypeAlias.WorkspaceDocumentDiagnosticReport β€” gen\_lsp v0.6.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/workspace_document_diagnostic_report.ex#L2 "View Source") GenLSP.TypeAlias.WorkspaceDocumentDiagnosticReport (gen\_lsp v0.6.0) ============================================================================================================================================================================================================================================= A workspace diagnostic document report. @since 3.17.0 [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/elixir-tools/gen_lsp/blob/main/lib/gen_lsp/protocol/type_aliases/workspace_document_diagnostic_report.ex#L11 "View Source") ``` @type t() :: [GenLSP.Structures.WorkspaceFullDocumentDiagnosticReport.t](GenLSP.Structures.WorkspaceFullDocumentDiagnosticReport.html#t:t/0)() | [GenLSP.Structures.WorkspaceUnchangedDocumentDiagnosticReport.t](GenLSP.Structures.WorkspaceUnchangedDocumentDiagnosticReport.html#t:t/0)() ```
waffle_ecto
hex
Waffle.Ecto β€” waffle\_ecto v0.0.12 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings Waffle.Ecto (waffle\_ecto v0.0.12) =============================================== Waffle.Ecto provides an integration with [`Waffle`](https://hexdocs.pm/waffle/1.1.6/Waffle.html) and [`Ecto`](https://hexdocs.pm/ecto/3.9.4/Ecto.html). Waffle attachments should be stored in a string column, with a name indicative of the attachment. ``` create table :users do add :avatar, :string end ``` [how-to-add-waffle\_ecto-to-your-project](#module-how-to-add-waffle_ecto-to-your-project) How to add `waffle_ecto` to your project ------------------------------------------------------------------------------------------------------------------------------------ * add [Schema](Waffle.Ecto.Schema.html) to the model * configure [Definition](Waffle.Ecto.Definition.html) for uploader [pages](#module-pages) Pages ------------------------------ * [How to use `:id` in filepath](filepath-with-id.html) [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === ``` @type t() :: %{file_name: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), updated_at: [DateTime.t](https://hexdocs.pm/elixir/DateTime.html#t:t/0)()} ``` Waffle.Ecto.Definition β€” waffle\_ecto v0.0.12 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings Waffle.Ecto.Definition (waffle\_ecto v0.0.12) ========================================================== Provides a set of functions to ease integration with Waffle and Ecto. In particular: * Definition of a custom Ecto Type responsible for storing the images * URL generation with a cache-busting timestamp query parameter [example](#module-example) Example ------------------------------------ ``` defmodule MyApp.Uploaders.AvatarUploader do use Waffle.Definition use Waffle.Ecto.Definition # ... end ``` [url-generation](#module-url-generation) URL generation --------------------------------------------------------- Both public and signed urls will include the timestamp for cache busting, and are retrieved the exact same way as using Waffle directly. ``` user = Repo.get(User, 1) # To receive a single rendition: MyApp.Uploaders.AvatarUploader.url({user.avatar, user}, :thumb) #=> "https://bucket.s3.amazonaws.com/uploads/avatars/1/thumb.png?v=63601457477" # To receive all renditions: MyApp.Uploaders.AvatarUploader.urls({user.avatar, user}) #=> %{original: "https://.../original.png?v=1234", thumb: "https://.../thumb.png?v=1234"} # To receive a signed url: MyApp.Uploaders.AvatarUploader.url({user.avatar, user}, signed: true) MyApp.Uploaders.AvatarUploader.url({user.avatar, user}, :thumb, signed: true) ``` Waffle.Ecto.Schema β€” waffle\_ecto v0.0.12 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings Waffle.Ecto.Schema (waffle\_ecto v0.0.12) ====================================================== Defines helpers to work with changeset. Add a using statement `use Waffle.Ecto.Schema` to the top of your ecto schema, and specify the type of the column in your schema as `MyApp.Avatar.Type`. Attachments can subsequently be passed to Waffle's storage though a Changeset [`cast_attachments/3`](#cast_attachments/3) function, following the syntax of `cast/3`. [example](#module-example) Example ------------------------------------ ``` defmodule MyApp.User do use MyApp.Web, :model use Waffle.Ecto.Schema schema "users" do field :name, :string field :avatar, MyApp.Uploaders.AvatarUploader.Type end def changeset(user, params \\ :invalid) do user |> cast(params, [:name]) |> cast\_attachments(params, [:avatar]) |> validate\_required([:name, :avatar]) end end ``` [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [cast\_attachments(changeset\_or\_data, params, allowed, options \\ [])](#cast_attachments/4) Extracts attachments from params and converts it to the accepted format. [check\_and\_apply\_scope(params, scope, options)](#check_and_apply_scope/3) [convert\_params\_to\_binary(params)](#convert_params_to_binary/1) [do\_apply\_changes(changeset)](#do_apply_changes/1) [Link to this section](#functions) Functions ============================================= [Link to this macro](#cast_attachments/4 "Link to this macro") cast\_attachments(changeset\_or\_data, params, allowed, options \\ []) ====================================================================== (macro) Extracts attachments from params and converts it to the accepted format. [options](#cast_attachments/4-options) Options ------------------------------------------------ * `:allow_urls` β€” fetches remote file if the string matches `~r/^https?:\/\//` * `:allow_paths` β€” accepts any local path as file destination [examples](#cast_attachments/4-examples) Examples --------------------------------------------------- ``` cast\_attachments(changeset, params, [:fetched\_remote\_file], allow\_urls: true) ``` [Link to this function](#check_and_apply_scope/3 "Link to this function") check\_and\_apply\_scope(params, scope, options) ================================================ [Link to this function](#convert_params_to_binary/1 "Link to this function") convert\_params\_to\_binary(params) =================================== [Link to this function](#do_apply_changes/1 "Link to this function") do\_apply\_changes(changeset) ============================= Waffle.Ecto.Type β€” waffle\_ecto v0.0.12 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings Waffle.Ecto.Type (waffle\_ecto v0.0.12) ==================================================== Provides implementation for custom Ecto.Type behaviour. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [cast(definition, args)](#cast/2) [dump(definition, map)](#dump/2) [load(definition, value)](#load/2) [type()](#type/0) [Link to this section](#functions) Functions ============================================= [Link to this function](#cast/2 "Link to this function") cast(definition, args) ====================== [Link to this function](#dump/2 "Link to this function") dump(definition, map) ===================== [Link to this function](#load/2 "Link to this function") load(definition, value) ======================= [Link to this function](#type/0 "Link to this function") type() ====== How to use :id in filepath β€” waffle\_ecto v0.0.12 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings How to use `:id` in filepath ========================================= In order to use `:id` attribute within file's path, we should separate creation stage on two steps: * persist the resource * upload the file It needs to be done because `:id` not yet exist on creation stage. [example](#example) Example ----------------------------- To implement this we should define `storage_dir/2` inside uploader ``` def storage\_dir(\_version, {\_file, scope}) do "uploads/avatar/#{scope.id}" end ``` Then define two separate `changeset`s inside our resource ``` def changeset(user, attrs) do user |> cast(attrs, [:name]) |> validate\_required([:name]) end def avatar\_changeset(user, attrs) do user |> cast\_attachments(attrs, [:avatar]) |> validate\_required([:avatar]) end ``` Finally, we can combine two stages into one action ``` Ecto.Multi.new() |> Ecto.Multi.insert(:user, User.changeset(user, attrs)) |> Ecto.Multi.update(:user\_with\_avatar, &User.avatar\_changeset(&1.user, attrs)) |> Repo.transaction() ``` This can be used in a Phoenix app context like ``` defmodule Accounts do # ... def create\_user(attrs \\ %{}) do Ecto.Multi.new() |> Ecto.Multi.insert(:user, User.changeset(%User{}, attrs)) |> Ecto.Multi.update(:user\_with\_avatar, &User.avatar\_changeset(&1.user, attrs)) |> Repo.transaction() |> case do {:ok, %{user\_with\_avatar: user}} -> {:ok, user} {:error, \_, changeset, \_} -> {:error, changeset} end def update\_user(%User{} = user, attrs) do user |> User.changeset(attrs) |> User.avatar\_changeset(attrs) |> Repo.update() end def change\_user(%User{} = user, attrs \\ %{}) do user |> User.changeset(attrs) |> User.avatar\_changeset(attrs) end # ... end ``` [← Previous Page API Reference](api-reference.html)
noether
hex
Noether β€” noether v0.2.4 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings Noether (noether v0.2.4) ===================================== Noether aims to ease common data manipulation tasks by introducing simple algebraic functions and other utilities. Functions and names are inspired (sometimes taken as-is) from Haskell. The [`Noether.Maybe`](Noether.Maybe.html) module introduces operations on nullable values. The [`Noether.Either`](Noether.Either.html) module introduces operations on `{:ok, _} | {:error, _}` values. The [`Noether.List`](Noether.List.html) module introduces operations on lists. The root module has a few simple functions one might find of use. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [fun1()](#t:fun1/0) [fun2()](#t:fun2/0) [Functions](#functions) ------------------------ [curry(arg, f)](#curry/2) Takes a tuple and a function of arity 2. It applies the two values in the tuple to the function. [flip(f)](#flip/1) Takes a function of arity 2 and returns the same function with its arguments in reverse order, i.e., "flipped". Please note that if a function of different arity is given, a function of arity 2 is returned where the two arguments will be applied to the given function. [uncurry(a, b, f)](#uncurry/3) Takes two values and applies them to a function or arity 1 in form of a tuple. [Link to this section](#types) Types ===================================== [Link to this type](#t:fun1/0 "Link to this type") fun1() ====== ``` @type fun1() :: ([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() -> [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) ``` [Link to this type](#t:fun2/0 "Link to this type") fun2() ====== ``` @type fun2() :: ([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() -> [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#curry/2 "Link to this function") curry(arg, f) ============= ``` @spec curry([tuple](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [fun2](#t:fun2/0)()) :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Takes a tuple and a function of arity 2. It applies the two values in the tuple to the function. [examples](#curry/2-examples) Examples ---------------------------------------- ``` iex> curry({1, 2}, &Kernel.+/2) 3 ``` [Link to this function](#flip/1 "Link to this function") flip(f) ======= ``` @spec flip([fun2](#t:fun2/0)()) :: [fun2](#t:fun2/0)() ``` Takes a function of arity 2 and returns the same function with its arguments in reverse order, i.e., "flipped". Please note that if a function of different arity is given, a function of arity 2 is returned where the two arguments will be applied to the given function. [examples](#flip/1-examples) Examples --------------------------------------- ``` iex> flip(&Kernel.-/2).(3, 4) 1 ``` [Link to this function](#uncurry/3 "Link to this function") uncurry(a, b, f) ================ ``` @spec uncurry([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [fun1](#t:fun1/0)()) :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Takes two values and applies them to a function or arity 1 in form of a tuple. [examples](#uncurry/3-examples) Examples ------------------------------------------ ``` iex> uncurry(1, 2, &(&1)) {1, 2} ``` Noether.Either β€” noether v0.2.4 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings Noether.Either (noether v0.2.4) ============================================ This module hosts several utility functions to work with `{:ok, _} | {:error, _}` values. These type of values will be then called `Either`. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [either()](#t:either/0) [fun0()](#t:fun0/0) [fun1()](#t:fun1/0) [Functions](#functions) ------------------------ [bind(a, f)](#bind/2) Given an `{:ok, value}` and a function that returns an Either value, it applies the function on the `value`. It effectively "squashes" an `{:ok, {:ok, v}}` or `{:ok, {:error, _}}` to its most appropriate representation. If an `{:error, _}` is given, it is returned as-is. [cat\_either(a, f)](#cat_either/2) Given a list of Either, the function is mapped only on the elements of type `{:ok, _}`. Other values will be discarded. A list of the results is returned outside of the tuple. [choose(a, f, g)](#choose/3) Given a value and two functions that return an Either, it applies the first one and returns the result if it matches `{:ok, _}`. Otherwise the second function is applied. [either(a, f, g)](#either/3) Given an Either and two functions, it applies the first or second one on the second value of the tuple, depending if the value is `{:ok, _}` or `{:error, _}` respectively. [error?(a)](#error?/1) It returns `true` only if the value given matches a `{:error, value}` type. [flat\_map(either, f)](#flat_map/2) Alias for [`bind/2`](#bind/2) [flatten(either)](#flatten/1) Alias for [`join/1`](#join/1). [join(a)](#join/1) Given an `{:ok, {:ok, value}}` it flattens the ok unwrapping the `value` and returning `{:ok, value}`. If an `{:error, _}` is given, it is returned as-is. [map(a, f)](#map/2) Given an `{:ok, value}` and a function, it applies the function on the `value` returning `{:ok, f.(value)}`. If an `{:error, _}` is given, it is returned as-is. [map\_all(values, f)](#map_all/2) Given a list of values and a function returning `{:ok, any}` or `{:error, any}`, it applies the function on every `value` returning `{:ok, values}` if every `f.(v)` results in `{:ok, v}`; returning `{:error, _}` if `f.(v) results in an`. [map\_error(a, f)](#map_error/2) Given an Either and one function, it applies the function to the `{:error, _}` tuple. [ok?(a)](#ok?/1) It returns `true` only if the value given matches a `{:ok, value}` type. [or\_else(a, f)](#or_else/2) Given an Either and a function, it returns the value as-is when it's ok, or executes the function and returns its result. [try(value, f)](#try/2) Given a `value` and a function, it applies the function on the `value` returning `{:ok, f.(value)}`. If the function throws an exception `e` then it is wrapped into an `{:error, e}`. [unwrap(a, b \\ nil)](#unwrap/2) It returns the value of an `{:ok, value}` only if such a tuple is given. If not, the default value (`nil` if not provided) is returned. [wrap(a)](#wrap/1) Given any value, it makes sure the result is an Either type. [wrap\_err(a)](#wrap_err/1) Given any value, it makes sure the result is an Either type. [Link to this section](#types) Types ===================================== [Link to this type](#t:either/0 "Link to this type") either() ======== ``` @type either() :: {:ok, [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} | {:error, [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` [Link to this type](#t:fun0/0 "Link to this type") fun0() ====== ``` @type fun0() :: (() -> [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) ``` [Link to this type](#t:fun1/0 "Link to this type") fun1() ====== ``` @type fun1() :: ([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() -> [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#bind/2 "Link to this function") bind(a, f) ========== ``` @spec bind([either](#t:either/0)(), [fun1](#t:fun1/0)()) :: [either](#t:either/0)() ``` Given an `{:ok, value}` and a function that returns an Either value, it applies the function on the `value`. It effectively "squashes" an `{:ok, {:ok, v}}` or `{:ok, {:error, _}}` to its most appropriate representation. If an `{:error, _}` is given, it is returned as-is. [examples](#bind/2-examples) Examples --------------------------------------- ``` iex> bind({:ok, 1}, fn a -> {:ok, a + 1} end) {:ok, 2} iex> bind({:ok, 1}, fn \_ -> {:error, 5} end) {:error, 5} iex> bind({:error, 1}, fn \_ -> {:ok, 45} end) {:error, 1} ``` [Link to this function](#cat_either/2 "Link to this function") cat\_either(a, f) ================= ``` @spec cat_either([[either](#t:either/0)()], [fun1](#t:fun1/0)()) :: [[any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()] ``` Given a list of Either, the function is mapped only on the elements of type `{:ok, _}`. Other values will be discarded. A list of the results is returned outside of the tuple. [examples](#cat_either/2-examples) Examples --------------------------------------------- ``` iex> cat\_either([{:ok, 1}], &(&1 + 1)) [2] iex> cat\_either([{:ok, 1}, {:error, 2}, {:ok, 3}], &(&1 + 1)) [2, 4] ``` [Link to this function](#choose/3 "Link to this function") choose(a, f, g) =============== ``` @spec choose([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [fun1](#t:fun1/0)(), [fun1](#t:fun1/0)()) :: [either](#t:either/0)() ``` Given a value and two functions that return an Either, it applies the first one and returns the result if it matches `{:ok, _}`. Otherwise the second function is applied. [examples](#choose/3-examples) Examples ----------------------------------------- ``` iex> choose(0, fn a -> {:ok, a + 1} end, fn b -> {:ok, b + 2} end) {:ok, 1} iex> choose(0, fn \_ -> {:error, 1} end, fn b -> {:ok, b + 2} end) {:ok, 2} iex> choose(0, fn \_ -> {:error, 1} end, fn \_ -> {:error, 2} end) {:error, 2} ``` [Link to this function](#either/3 "Link to this function") either(a, f, g) =============== ``` @spec either([either](#t:either/0)(), [fun1](#t:fun1/0)(), [fun1](#t:fun1/0)()) :: [either](#t:either/0)() ``` Given an Either and two functions, it applies the first or second one on the second value of the tuple, depending if the value is `{:ok, _}` or `{:error, _}` respectively. [examples](#either/3-examples) Examples ----------------------------------------- ``` iex> either({:ok, 1}, &(&1 + 1), &(&1 + 2)) {:ok, 2} iex> either({:error, 1}, &(&1 + 1), &(&1 + 2)) {:error, 3} ``` [Link to this function](#error?/1 "Link to this function") error?(a) ========= ``` @spec error?([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` It returns `true` only if the value given matches a `{:error, value}` type. [examples](#error?/1-examples) Examples ----------------------------------------- ``` iex> error?({:ok, 1}) false iex> error?({:error, 2}) true iex> error?(3) false ``` [Link to this function](#flat_map/2 "Link to this function") flat\_map(either, f) ==================== ``` @spec flat_map([either](#t:either/0)(), [fun1](#t:fun1/0)()) :: [either](#t:either/0)() ``` Alias for [`bind/2`](#bind/2) [examples](#flat_map/2-examples) Examples ------------------------------------------- ``` iex> flat\_map({:ok, 1}, fn a -> {:ok, a + 1} end) {:ok, 2} iex> flat\_map({:ok, 1}, fn \_ -> {:error, 5} end) {:error, 5} iex> flat\_map({:error, 1}, fn \_ -> {:ok, 45} end) {:error, 1} ``` [Link to this function](#flatten/1 "Link to this function") flatten(either) =============== ``` @spec flatten([either](#t:either/0)()) :: [either](#t:either/0)() ``` Alias for [`join/1`](#join/1). [examples](#flatten/1-examples) Examples ------------------------------------------ ``` iex> flatten({:ok, {:ok, 1}}) {:ok, 1} iex> flatten({:ok, 1}) \*\* (FunctionClauseError) no function clause matching in Noether.Either.join/1 iex> flatten({:error, "Value not found"}) {:error, "Value not found"} ``` [Link to this function](#join/1 "Link to this function") join(a) ======= ``` @spec join([either](#t:either/0)()) :: [either](#t:either/0)() ``` Given an `{:ok, {:ok, value}}` it flattens the ok unwrapping the `value` and returning `{:ok, value}`. If an `{:error, _}` is given, it is returned as-is. [examples](#join/1-examples) Examples --------------------------------------- ``` iex> join({:ok, {:ok, 1}}) {:ok, 1} iex> join({:ok, 1}) \*\* (FunctionClauseError) no function clause matching in Noether.Either.join/1 iex> join({:error, "Value not found"}) {:error, "Value not found"} ``` [Link to this function](#map/2 "Link to this function") map(a, f) ========= ``` @spec map([either](#t:either/0)(), [fun1](#t:fun1/0)()) :: [either](#t:either/0)() ``` Given an `{:ok, value}` and a function, it applies the function on the `value` returning `{:ok, f.(value)}`. If an `{:error, _}` is given, it is returned as-is. [examples](#map/2-examples) Examples -------------------------------------- ``` iex> map({:ok, -1}, &Kernel.abs/1) {:ok, 1} iex> map({:error, "Value not found"}, &Kernel.abs/1) {:error, "Value not found"} ``` [Link to this function](#map_all/2 "Link to this function") map\_all(values, f) =================== ``` @spec map_all([[any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()], ([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() -> [either](#t:either/0)())) :: {:ok, [[any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()]} | {:error, [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` Given a list of values and a function returning `{:ok, any}` or `{:error, any}`, it applies the function on every `value` returning `{:ok, values}` if every `f.(v)` results in `{:ok, v}`; returning `{:error, _}` if `f.(v) results in an`. [examples](#map_all/2-examples) Examples ------------------------------------------ ``` iex> map\_all(["23:50:07.0123456", "23:50:07.123Z"], &Time.from\_iso8601/1) {:ok, [~T[23:50:07.012345], ~T[23:50:07.123]]} iex> map\_all(["23:50:61", "23:50:07.123Z"], &Time.from\_iso8601/1) {:error, :invalid\_time} ``` [Link to this function](#map_error/2 "Link to this function") map\_error(a, f) ================ ``` @spec map_error([either](#t:either/0)(), [fun1](#t:fun1/0)()) :: [either](#t:either/0)() ``` Given an Either and one function, it applies the function to the `{:error, _}` tuple. [examples](#map_error/2-examples) Examples -------------------------------------------- ``` iex> map\_error({:ok, 1}, &(&1 + 1)) {:ok, 1} iex> map\_error({:error, 1}, &(&1 + 1)) {:error, 2} ``` [Link to this function](#ok?/1 "Link to this function") ok?(a) ====== ``` @spec ok?([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` It returns `true` only if the value given matches a `{:ok, value}` type. [examples](#ok?/1-examples) Examples -------------------------------------- ``` iex> ok?({:ok, 1}) true iex> ok?({:error, 2}) false iex> ok?(3) false ``` [Link to this function](#or_else/2 "Link to this function") or\_else(a, f) ============== ``` @spec or_else([either](#t:either/0)(), [fun1](#t:fun1/0)()) :: [either](#t:either/0)() ``` Given an Either and a function, it returns the value as-is when it's ok, or executes the function and returns its result. [examples](#or_else/2-examples) Examples ------------------------------------------ ``` iex> or\_else({:ok, 1}, fn \_ -> {:ok, 2} end) {:ok, 1} iex> or\_else({:error, 1}, fn \_ -> {:ok, 2} end) {:ok, 2} iex> or\_else({:error, 1}, fn x -> {:ok, x + 2} end) {:ok, 3} ``` [Link to this function](#try/2 "Link to this function") try(value, f) ============= ``` @spec try([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [fun1](#t:fun1/0)()) :: [either](#t:either/0)() ``` Given a `value` and a function, it applies the function on the `value` returning `{:ok, f.(value)}`. If the function throws an exception `e` then it is wrapped into an `{:error, e}`. [examples](#try/2-examples) Examples -------------------------------------- ``` iex> try("42", &String.to\_integer/1) {:ok, 42} iex> try("nan", &String.to\_integer/1) {:error, %ArgumentError{message: "errors were found at the given arguments:\n\n \* 1st argument: not a textual representation of an integer\n"}} ``` [Link to this function](#unwrap/2 "Link to this function") unwrap(a, b \\ nil) =================== It returns the value of an `{:ok, value}` only if such a tuple is given. If not, the default value (`nil` if not provided) is returned. [examples](#unwrap/2-examples) Examples ----------------------------------------- ``` iex> unwrap({:ok, 1}) 1 iex> unwrap(2) nil iex> unwrap({:ok, 1}, :default\_value) 1 iex> unwrap(2, :default\_value) :default\_value ``` [Link to this function](#wrap/1 "Link to this function") wrap(a) ======= ``` @spec wrap([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [either](#t:either/0)() ``` Given any value, it makes sure the result is an Either type. [examples](#wrap/1-examples) Examples --------------------------------------- ``` iex> wrap({:ok, 1}) {:ok, 1} iex> wrap({:error, 2}) {:error, 2} iex> wrap(3) {:ok, 3} ``` [Link to this function](#wrap_err/1 "Link to this function") wrap\_err(a) ============ ``` @spec wrap_err([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [either](#t:either/0)() ``` Given any value, it makes sure the result is an Either type. [examples](#wrap_err/1-examples) Examples ------------------------------------------- ``` iex> wrap\_err({:ok, 1}) {:ok, 1} iex> wrap\_err({:error, 2}) {:error, 2} iex> wrap\_err(3) {:error, 3} ``` Noether.List β€” noether v0.2.4 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings Noether.List (noether v0.2.4) ========================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [fun1()](#t:fun1/0) [fun2()](#t:fun2/0) [Functions](#functions) ------------------------ [sequence(a)](#sequence/1) Given a list, it returns `{:ok, list}` if every element of the list is different from nil or `{:error, _}`. Otherwise `{:error, :nil_found}` is returned. [until(p, f, a)](#until/3) Given a predicate, a function of arity 1, and a value, the function is applied repeatedly until the predicate applied to the value returns either `nil`, `false`, or `{:error, _}`. The list of results is returned. [zip\_with(a, b, f)](#zip_with/3) Given two lists and a function of arity 2, the lists are first zipped and then each tuple is applied (curried) to the function. [Link to this section](#types) Types ===================================== [Link to this type](#t:fun1/0 "Link to this type") fun1() ====== ``` @type fun1() :: ([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() -> [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) ``` [Link to this type](#t:fun2/0 "Link to this type") fun2() ====== ``` @type fun2() :: ([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() -> [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#sequence/1 "Link to this function") sequence(a) =========== ``` @spec sequence([[any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()]) :: {:ok, [[any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()]} | {:error, [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` Given a list, it returns `{:ok, list}` if every element of the list is different from nil or `{:error, _}`. Otherwise `{:error, :nil_found}` is returned. [examples](#sequence/1-examples) Examples ------------------------------------------- ``` iex> sequence([1, 2]) {:ok, [1, 2]} iex> sequence([1, nil, 3]) {:error, :nil\_found} iex> sequence([{:ok, 1}, {:ok, 2}]) {:ok, [1, 2]} iex> sequence([{:ok, 1}, {:error, 2}, {:ok, 3}]) {:error, 2} iex> sequence([{:error, 1}, {:error, 2}]) {:error, 1} ``` [Link to this function](#until/3 "Link to this function") until(p, f, a) ============== ``` @spec until([fun1](#t:fun1/0)(), [fun1](#t:fun1/0)(), [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [[any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()] ``` Given a predicate, a function of arity 1, and a value, the function is applied repeatedly until the predicate applied to the value returns either `nil`, `false`, or `{:error, _}`. The list of results is returned. [examples](#until/3-examples) Examples ---------------------------------------- ``` iex> until(fn a -> a < 10 end, &(&1 + 1), 0) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ``` [Link to this function](#zip_with/3 "Link to this function") zip\_with(a, b, f) ================== ``` @spec zip_with([[any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()], [[any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()], [fun2](#t:fun2/0)()) :: [[any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()] ``` Given two lists and a function of arity 2, the lists are first zipped and then each tuple is applied (curried) to the function. [examples](#zip_with/3-examples) Examples ------------------------------------------- ``` iex> zip\_with([1, 2, 3], [4, 5, 6], &Kernel.+/2) [5, 7, 9] ``` Noether.Maybe β€” noether v0.2.4 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings Noether.Maybe (noether v0.2.4) =========================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [fun1()](#t:fun1/0) [Functions](#functions) ------------------------ [cat\_maybe(a, f)](#cat_maybe/2) Given a list of values, the function is mapped only on the elements different from `nil`. `nil` values will be discarded. A list of the results is returned. [choose(a, f, g)](#choose/3) Given a value and two functions, it applies the first one and returns the result if it's different from nil. Otherwise the second function is applied. [map(a, f)](#map/2) Given a value and a function, the function is applied only if the value is different from `nil`. `nil` is returned otherwise. [maybe(a, f, default)](#maybe/3) Given a value, a function, and a default, it applies the function on the value if the latter is different from `nil`. It returns the default otherwise. [required(a, default)](#required/2) Given a value and a default, `{:ok, value}` is returned only if the value is different from `nil`. `{:error, default}` is returned otherwise. [Link to this section](#types) Types ===================================== [Link to this type](#t:fun1/0 "Link to this type") fun1() ====== ``` @type fun1() :: ([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() -> [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#cat_maybe/2 "Link to this function") cat\_maybe(a, f) ================ ``` @spec cat_maybe([[any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()], [fun1](#t:fun1/0)()) :: [[any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()] ``` Given a list of values, the function is mapped only on the elements different from `nil`. `nil` values will be discarded. A list of the results is returned. [examples](#cat_maybe/2-examples) Examples -------------------------------------------- ``` iex> cat\_maybe([1], &(&1 + 1)) [2] iex> cat\_maybe([1, nil, 3], &(&1 + 1)) [2, 4] ``` [Link to this function](#choose/3 "Link to this function") choose(a, f, g) =============== ``` @spec choose([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [fun1](#t:fun1/0)(), [fun1](#t:fun1/0)()) :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Given a value and two functions, it applies the first one and returns the result if it's different from nil. Otherwise the second function is applied. [examples](#choose/3-examples) Examples ----------------------------------------- ``` iex> choose(0, fn a -> a + 1 end, fn b -> b + 2 end) 1 iex> choose(0, fn \_ -> nil end, fn b -> b + 2 end) 2 iex> choose(0, fn \_ -> nil end, fn \_ -> nil end) nil ``` [Link to this function](#map/2 "Link to this function") map(a, f) ========= ``` @spec map([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [fun1](#t:fun1/0)()) :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Given a value and a function, the function is applied only if the value is different from `nil`. `nil` is returned otherwise. [examples](#map/2-examples) Examples -------------------------------------- ``` iex> map(nil, &Kernel.abs/1) nil iex> map(-1, &Kernel.abs/1) 1 ``` [Link to this function](#maybe/3 "Link to this function") maybe(a, f, default) ==================== ``` @spec maybe([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [fun1](#t:fun1/0)(), [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Given a value, a function, and a default, it applies the function on the value if the latter is different from `nil`. It returns the default otherwise. [examples](#maybe/3-examples) Examples ---------------------------------------- ``` iex> maybe(-1, &Kernel.abs/1, :hello) 1 iex> maybe(nil, &Kernel.abs/1, :hello) :hello ``` [Link to this function](#required/2 "Link to this function") required(a, default) ==================== ``` @spec required([any](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [Noether.Either.either](Noether.Either.html#t:either/0)() ``` Given a value and a default, `{:ok, value}` is returned only if the value is different from `nil`. `{:error, default}` is returned otherwise. [examples](#required/2-examples) Examples ------------------------------------------- ``` iex> required(nil, :hello) {:error, :hello} iex> required(1, :hello) {:ok, 1} ```
envio
hex
Envío β€” envio v0.10.2 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/stuff/envio.md#L1 "View Source") Envío Logo Β Β Envío ================================================================================================================================ **Envío** is basically a `GenEventΒ²`, the modern idiomatic pub-sub implementation of event passing. In a nutshell, **Envío** is a set of handy tools to simplify dealing with Elixir [`Registry`](https://hexdocs.pm/elixir/master/Registry.html). It includes the instance of [`Registry`](https://hexdocs.pm/elixir/Registry.html) to be used out of the box, scaffolds for producing *publishers* and *subscribers*. It is built using β€œconvention over configuration” approach, preserving the whole low-level control over the registry entries. Just add the application `:envio` into your list of *extra* applications and the default `Envio.Registry` will be started and managed automagically. ``` def application do [ mod: {MyApplication, []}, extra\_applications: ~w|envio ...|a ] end ``` ### [creating-a-publisher](#creating-a-publisher) Creating a publisher To create a publisher just `use Envio.Publisher` in the module that should publish messages to the subscribers. Once `use Envio.Publisher` is used, `broadcast/2` function becomes available. If the optional `channel:` argument is passed to `use Envio.Publisher`, this channel is considered the default one and `broadcast/1` function appears to publish directly to the default channel. ``` defmodule MyPub do use Envio.Publisher, channel: :main def publish(channel, what), do: broadcast(channel, what) def publish(what), do: broadcast(what) end ``` Another option that might be passed to `use Envio.Publisher` is `manager:`, that might be either `:registry` (default,) or `:phoenix_pub_sub` to use [`Phoenix.PubSub`](https://hexdocs.pm/phoenix_pubsub) for distributed message broadcasting. ### [creating-a-subscriber](#creating-a-subscriber) Creating a subscriber #### β–Ά [`:dispatch`](https://hexdocs.pm/elixir/master/Registry.html#module-using-as-a-dispatcher) Simply register the handler anywhere in the code: ``` Envio.register( {MySub, :on\_envio}, # the function of arity 2 must exist dispatch: %Envio.Channel{source: MyPub, name: :main} ) ``` As `MyPub` publishes to the `:main` channel, `MySub.on_envio/2` will be called with a message passed as parameter. #### β–Ά [`:pub_sub`](https://hexdocs.pm/elixir/master/Registry.html#module-using-as-a-pubsub) Use [`Envio.Subscriber`](Envio.Subscriber.html) helper to scaffold the registry subscriber. Implement `handle_envio/2` for custom message handling. The default implementation collects last `10` messages in it’s state. This amount might be adjusted by changing `:envio, :subscriber_queue_size` application environment setting. The implementation below subscribes to `:main` channel provided by `MyPub` publisher and prints out each subsequent incoming message to standard output. ``` defmodule PubSucker do use Envio.Subscriber, channels: [{MyPub, :main}] def handle\_envio(message, state) do {:noreply, state} = super(message, state) IO.inspect({message, state}, label: "Received") {:noreply, state} end end ``` #### β–Ά [`:phoenix_pub_sub`](https://hexdocs.pm/phoenix_pubsub) Use `manager: :phoenix_pub_sub` for distributed message broadcasting. The implementation below subscribes to `"main"` channel in the distributed OTP environment and prints out each subsequent incoming message to standard output. ``` defmodule Pg2Sucker do use Envio.Subscriber, channels: ["main"], manager: :phoenix\_pub\_sub def handle\_envio(message, state) do {:noreply, state} = super(message, state) IO.inspect({message, state}, label: "Received") {:noreply, state} end end ``` The publisher this subscriber might be listening to would look like ``` defmodule Pg2Spitter do use Envio.Publisher, manager: :phoenix\_pub\_sub, channel: "main" def spit(channel, what), do: broadcast(channel, what) def spit(what), do: broadcast(what) end ``` [← Previous Page API Reference](api-reference.html) [Next Page β†’ Backends](backends.html) Envio β€” envio v0.10.2 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/lib/envio.ex#L1 "View Source") Envio (envio v0.10.2) =============================================================================================================================== Main interface to Envio. Provides handy functions to publish messages, subscribe to messages, etc. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [register(host, channels)](#register/2) [Link to this section](#functions) Functions ============================================= [Link to this function](#register/2 "Link to this function") register(host, channels) ======================== [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/lib/envio.ex#L10 "View Source") ``` @spec register([atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | {[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()}, [{[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [Envio.Channel.t](Envio.Channel.html#t:t/0)()}]) :: :ok | {:error, {:already_registered, [Envio.Channel.t](Envio.Channel.html#t:t/0)()}} ``` Envio.Backend β€” envio v0.10.2 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/lib/envio/backends/backend.ex#L1 "View Source") Envio.Backend behaviour (envio v0.10.2) ================================================================================================================================================================== The behaviour to be implemented for all the backends. [Link to this section](#summary) Summary ========================================== [Callbacks](#callbacks) ------------------------ [on\_envio(message, meta)](#c:on_envio/2) The callback when the envio is received. [Link to this section](#callbacks) Callbacks ============================================= [Link to this callback](#c:on_envio/2 "Link to this callback") on\_envio(message, meta) ======================== [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/lib/envio/backends/backend.ex#L12 "View Source") ``` @callback on_envio( message :: %{atom: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}, meta :: %{atom: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ) :: {:ok, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` The callback when the envio is received. Envio.Channel β€” envio v0.10.2 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/lib/envio/data/channel.ex#L1 "View Source") Envio.Channel (envio v0.10.2) ==================================================================================================================================================== Channel description. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) Channel data stored as a struct [Functions](#functions) ------------------------ [fq\_name(arg1)](#fq_name/1) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/lib/envio/data/channel.ex#L9 "View Source") ``` @type t() :: %Envio.Channel{name: [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), source: [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` Channel data stored as a struct [Link to this section](#functions) Functions ============================================= [Link to this function](#fq_name/1 "Link to this function") fq\_name(arg1) ============== [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/lib/envio/data/channel.ex#L15 "View Source") ``` @spec fq_name({[binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} | [t](#t:t/0)()) :: [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Envio.Channels β€” envio v0.10.2 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/lib/envio/channels.ex#L1 "View Source") Envio.Channels (envio v0.10.2) ================================================================================================================================================= Channels storage. It manages all the channels currently existing in the system. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [child\_spec(init\_arg)](#child_spec/1) Returns a specification to start this module under a supervisor. [init(state)](#init/1) Default initialization callback (noop.) [register(host, channels)](#register/2) Registers new channel. [start\_link(opts \\ [])](#start_link/1) Starts a new channels bucket. [state()](#state/0) Get list of active subscriptions. [Link to this section](#functions) Functions ============================================= [Link to this function](#child_spec/1 "Link to this function") child\_spec(init\_arg) ====================== [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/lib/envio/channels.ex#L8 "View Source") Returns a specification to start this module under a supervisor. See [`Supervisor`](https://hexdocs.pm/elixir/Supervisor.html). [Link to this function](#init/1 "Link to this function") init(state) =========== [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/lib/envio/channels.ex#L23 "View Source") Default initialization callback (noop.) [Link to this function](#register/2 "Link to this function") register(host, channels) ======================== [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/lib/envio/channels.ex#L36 "View Source") ``` @spec register([atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | {[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)()}, [{[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [Envio.Channel.t](Envio.Channel.html#t:t/0)()}]) :: :ok | {:error, {:already_registered, [Envio.Channel.t](Envio.Channel.html#t:t/0)()}} ``` Registers new channel. [Link to this function](#start_link/1 "Link to this function") start\_link(opts \\ []) ======================= [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/lib/envio/channels.ex#L17 "View Source") Starts a new channels bucket. [Link to this function](#state/0 "Link to this function") state() ======= [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/lib/envio/channels.ex#L29 "View Source") ``` @spec state() :: [Envio.State.t](Envio.State.html#t:t/0)() ``` Get list of active subscriptions. Envio.InconsistentUsing β€” envio v0.10.2 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/lib/envio/errors/inconsistent_using.ex#L1 "View Source") Envio.InconsistentUsing exception (envio v0.10.2) ===================================================================================================================================================================================== An exception to be thrown when an attempt to use scaffolding is inconsistent. For instance, whether the call to `use Envio.Subscriber/1` has no valid [`GenServer`](https://hexdocs.pm/elixir/GenServer.html) defined. Envio.Publisher β€” envio v0.10.2 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/lib/envio/publisher.ex#L1 "View Source") Envio.Publisher behaviour (envio v0.10.2) ============================================================================================================================================================= Publisher helper scaffold. Simply `use Envio.Publisher` in the module that should publish messages. The `broadcast/2` function becomes available. If the optional `channel:` argument is passed to `use Envio.Publisher`, this channel is considered the default one and `broadcast/1` function appears to publish directly to the default channel. The ready-to-copy-paste example of usage would be: ``` defmodule MyPub do use Envio.Publisher, channel: :main def publish(channel, what), do: broadcast(channel, what) def publish(what), do: broadcast(what) end ``` All the *subscribers* of the particular channel the message was published to, will either receive a message (in the case of [`:pub_sub`](https://hexdocs.pm/elixir/master/Registry.html#module-using-as-a-pubsub)) or called back with the function provided on subscription ([`:dispatch`](https://hexdocs.pm/elixir/master/Registry.html#module-using-as-a-dispatcher)). Since `v0.8.0` `Envío` supports [`Phoenix.PubSub`](https://hexdocs.pm/phoenix_pubsub) for distributed message broadcasting. The publisher does not wrap [`:via`](https://hexdocs.pm/elixir/master/Registry.html#module-using-in-via) functionality since it makes not much sense. For how to subscribe, see [`Envio.Subscriber`](Envio.Subscriber.html). [Link to this section](#summary) Summary ========================================== [Callbacks](#callbacks) ------------------------ [broadcast(channel, message)](#c:broadcast/2) The callback to publish stuff to [`Envio`](Envio.html). [Link to this section](#callbacks) Callbacks ============================================= [Link to this callback](#c:broadcast/2 "Link to this callback") broadcast(channel, message) =========================== [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/lib/envio/publisher.ex#L39 "View Source") ``` @callback broadcast(channel :: [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), message :: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: :ok ``` The callback to publish stuff to [`Envio`](Envio.html). Envio.State β€” envio v0.10.2 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/lib/envio/data/state.ex#L1 "View Source") Envio.State (envio v0.10.2) ================================================================================================================================================ Global Envio state. Contains subscriptions, messages that were not yet processed and options. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) Internal state of everything amongst Envío. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/lib/envio/data/state.ex#L8 "View Source") ``` @type t() :: %Envio.State{ messages: [[term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()], options: [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), pid: [pid](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), subscriptions: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() } ``` Internal state of everything amongst Envío. Envio.Subscriber β€” envio v0.10.2 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/lib/envio/subscriber.ex#L1 "View Source") Envio.Subscriber behaviour (envio v0.10.2) =============================================================================================================================================================== Subscriber helper scaffold. To easy register the `pub_sub` consumer in `Envio.Registry`, one might use this helper to scaffold the registering/unregistering code. It turns the module into the [`GenServer`](https://hexdocs.pm/elixir/GenServer.html) and provides the handy wrapper for the respective `handle_info/2`. One might override `handle_envio` to implement custom handling. The typical usage would be: ``` defmodule PubSubscriber do use Envio.Subscriber, channels: [{PubPublisher, :foo}] def handle\_envio(message, state) do with {:noreply, state} <- super(message, state) do IO.inspect({message, state}, label: "Received message") {:noreply, state} end end end ``` If channels are not specified as a parameter in call to `use Envio.Subscriber`, this module might subscribe to any publisher later with `subscribe/1`: ``` PubSubscriber.subscribe(%Envio.Channel{source: PubPublisher, name: :foo}) ``` For how to publish, see [`Envio.Publisher`](Envio.Publisher.html). [Link to this section](#summary) Summary ========================================== [Callbacks](#callbacks) ------------------------ [handle\_envio(message, state)](#c:handle_envio/2) The callback to subscribe stuff to [`Envio`](Envio.html). [Link to this section](#callbacks) Callbacks ============================================= [Link to this callback](#c:handle_envio/2 "Link to this callback") handle\_envio(message, state) ============================= [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/lib/envio/subscriber.ex#L39 "View Source") ``` @callback handle_envio(message :: :timeout | [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), state :: [Envio.State.t](Envio.State.html#t:t/0)()) :: {:noreply, new_state} | {:noreply, new_state, [timeout](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | :hibernate | {:continue, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}} | {:stop, reason :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), new_state} when new_state: [Envio.State.t](Envio.State.html#t:t/0)() ``` The callback to subscribe stuff to [`Envio`](Envio.html). Envio.Utils β€” envio v0.10.2 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/lib/envio/utils.ex#L1 "View Source") Envio.Utils (envio v0.10.2) =========================================================================================================================================== Multipurpose utils, required for the *Envío* proper functioning, like: * `fq_name` to construct fully-qualified names for channels to prevent clashes [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [config\_value(var)](#config_value/1) Returns the anonymous function that either loads the system environment variable or simply returns the value statically loaded from config file. [fq\_name(namespace\_or\_name, name\_or\_nil \\ nil)](#fq_name/2) Produces a fully-qualified name out of namespace in a form of a module name atom and a method name (atom or binary.) [get\_delete(input, key, default \\ nil)](#get_delete/3) Fetches the value from the map by given key *and* returns both the value and the map without this key. [smart\_to\_binary(list)](#smart_to_binary/1) Safely converts any term to binary. [Link to this section](#functions) Functions ============================================= [Link to this function](#config_value/1 "Link to this function") config\_value(var) ================== [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/lib/envio/utils.ex#L60 "View Source") ``` @spec config_value(input :: [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | {:system, [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}) :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Returns the anonymous function that either loads the system environment variable or simply returns the value statically loaded from config file. [examples](#config_value/1-examples) Examples ----------------------------------------------- ``` iex> # config :envio, :binary\_value, "FOO" iex> Envio.Utils.config\_value(Application.get\_env(:envio, :binary\_value)).() "FOO" iex> # config :envio, :env\_value, {:system, "FOO"} iex> System.put\_env("FOO", "42") iex> Envio.Utils.config\_value(Application.get\_env(:envio, :env\_value)).() "42" ``` [Link to this function](#fq_name/2 "Link to this function") fq\_name(namespace\_or\_name, name\_or\_nil \\ nil) =================================================== [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/lib/envio/utils.ex#L29 "View Source") ``` @spec fq_name( [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | {[atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}, nil | [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ) :: [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Produces a fully-qualified name out of namespace in a form of a module name atom and a method name (atom or binary.) [examples](#fq_name/2-examples) Examples ------------------------------------------ ``` iex> Envio.Utils.fq\_name("foo") "foo" iex> Envio.Utils.fq\_name({Foo.Bar, "baz"}) "foo/bar.baz" iex> Envio.Utils.fq\_name(Foo.Bar, "baz") "foo/bar.baz" iex> Envio.Utils.fq\_name(Foo.Bar, :baz) "foo/bar.baz" iex> Envio.Utils.fq\_name("Foo.Bar", "baz") "Foo.Bar.baz" ``` [Link to this function](#get_delete/3 "Link to this function") get\_delete(input, key, default \\ nil) ======================================= [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/lib/envio/utils.ex#L81 "View Source") ``` @spec get_delete(input :: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), key :: [atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), default :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Fetches the value from the map by given key *and* returns both the value and the map without this key. [examples](#get_delete/3-examples) Examples --------------------------------------------- ``` iex> Envio.Utils.get\_delete(%{foo: :bar, baz: 42}, :foo) {:bar, %{baz: 42}} iex> Envio.Utils.get\_delete(%{baz: 42}, :foo) {nil, %{baz: 42}} iex> Envio.Utils.get\_delete(%{baz: 42}, :foo, :bar) {:bar, %{baz: 42}} ``` [Link to this function](#smart_to_binary/1 "Link to this function") smart\_to\_binary(list) ======================= [View Source](https://github.com/am-kantox/envio/blob/v0.10.2/lib/envio/utils.ex#L105 "View Source") ``` @spec smart_to_binary(input :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Safely converts any term to binary. [examples](#smart_to_binary/1-examples) Examples -------------------------------------------------- ``` iex> Envio.Utils.smart\_to\_binary("foo") "foo" iex> Envio.Utils.smart\_to\_binary(42) "42" iex> Envio.Utils.smart\_to\_binary(%{foo: :bar, baz: 42}) "%{baz: 42, foo: :bar}" iex> Envio.Utils.smart\_to\_binary([foo: :bar, baz: 42]) "[foo: :bar, baz: 42]" ```
castore
hex
API Reference β€” CAStore v1.0.4 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings API Reference CAStore v1.0.4 ========================================= [modules](#modules) Modules ----------------------------- [CAStore](CAStore.html) Functionality to retrieve the up-to-date CA certificate store. [mix-tasks](#mix-tasks) Mix Tasks ----------------------------------- [mix certdata](Mix.Tasks.Certdata.html) Fetches an up-to-date version of the CA certificate store. CAStore β€” CAStore v1.0.4 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-mint/castore/blob/v1.0.4/lib/castore.ex#L1 "View Source") CAStore (CAStore v1.0.4) ======================================================================================================================================= Functionality to retrieve the up-to-date CA certificate store. The only purpose of this library is to keep an up-to-date CA certificate store file. This is why this module only provides one function, [`file_path/0`](#file_path/0), to access the path of the CA certificate store file. You can then read this file and use its contents for your own purposes. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [file\_path()](#file_path/0) Returns the path to the CA certificate store PEM file. [Link to this section](#functions) Functions ============================================= [Link to this function](#file_path/0 "Link to this function") file\_path() ============ [View Source](https://github.com/elixir-mint/castore/blob/v1.0.4/lib/castore.ex#L21 "View Source") ``` @spec file_path() :: [Path.t](https://hexdocs.pm/elixir/Path.html#t:t/0)() ``` Returns the path to the CA certificate store PEM file. [examples](#file_path/0-examples) Examples -------------------------------------------- ``` CAStore.file\_path() #=> /Users/me/castore/\_build/dev/lib/castore/priv/cacerts.pem" ``` mix certdata β€” CAStore v1.0.4 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/elixir-mint/castore/blob/v1.0.4/lib/mix/tasks/certdata.ex#L1 "View Source") mix certdata (CAStore v1.0.4) ======================================================================================================================================================= Fetches an up-to-date version of the CA certificate store. The certificate store is then stored in the private storage of this library. The path to the CA certificate store can be retrieved through [`CAStore.file_path/0`](CAStore.html#file_path/0). [usage](#module-usage) Usage ------------------------------ You can use this task to fetch an up-to-date version of the CA certificate store. ``` mix certdata ``` You can also use this task to verify if the currently stored certificate store is up to date. To do that, use the `--check-outdated` option. ``` mix certdata --check-outdated ```
srly
hex
Overview β€” srly v0.6.5 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/msantos/srly/blob/v0.6.5/README.md#L1 "View Source") Overview =========================================================================================================== srly is a native interface to serial devices for Erlang, known to work on Mac OS X, FreeBSD and Linux. The C component of srly simply provides a wrapper to the system serial interface. Data structures used as arguments to the native C functions (such as struct termios) are provided as Erlang binaries, allowing low level control of the serial device. [compiling](#compiling) COMPILING ----------------------------------- ``` rebar3 compile ``` [usage](#usage) USAGE ----------------------- *serctl* is the interface to the native system C libraries and follows the system C interface. ``` serctl:open(Path) -> {ok, FD} | {error, posix()} Types Path = iodata() | {fd, FD} FD = resource() Open a serial device. A serial device is a character device such as /dev/ttyUSB0. A previously opened file descriptor can also be used. The fd should be opened with the O\_NONBLOCK|O\_NOCTTY flags. serctl:close(FD) -> ok | {error, posix()} Types FD = resource() Explicitly close a serial device. The device is automatically closed if the process holding open the serial device exits. serctl:read(FD, Size) -> {ok, Data} | {error, posix()} Types FD = resource() Size = integer() Data = binary() Read from a serial device. Size is an unsigned long. serctl:readx(FD, Size) -> {ok, Data} | {error, posix()} serctl:readx(FD, Size, Timeout) -> {ok, Data} | {error, posix()} Types FD = resource() Size = integer() Data = binary() Timeout = infinity | integer() Read the specified number of bytes from a serial device. readx/2 will block forever. readx/3 accepts a timeout value. The behaviour of readx/3 when the timeout is reached is to throw away any buffered data and return {error, eintr} to the caller, e.g., the caller will not be returned the contents of a partial read. (The justification for this behaviour: the caller has stated they require a fixed number of bytes so the contents of a partial read represents unspecified behaviour.) serctl:write(FD, Data) -> ok | {ok, NBytes} | {error, posix()} Types FD = resource() Data = binary() NBytes = long() Write data to a serial device. Partial writes return the number of bytes written. serctl:ioctl(FD, Request, In) -> {ok, Out} | {error, posix()} Types FD = resource() Request = ulong() In = binary() Out = binary() Perform operations controlling a serial device. The In argument is a binary holding the input parameter to the device request. The Out parameter will hold the result of the request if the ioctl is in/out. ``` The low level interface follows the C library (see tcgetattr(3), tcsetattr(3), cfsetispeed(3) and cfsetospeed(3) for details). For convenience, atoms may be used in places where C has defined macros for integers and Erlang records can be used as arguments instead of binaries. To use Erlang records to represent the C struct termios (e.g., when converting binaries using serctl:termios/1) include their definition: ``` -include("serctl.hrl"). serctl:tcgetattr(FD) -> {ok, Termios} | {error, posix()} Types FD = resource() Termios = binary() Get the terminal attributes of a serial device. Returns the contents of the system struct termios as a binary. serctl:tcsetattr(FD, Action, Termios) -> ok | {error, posix() | unsupported} Types FD = resource() Action = integer() | Option | Options Options = [Option] Option = tcsanow | tcsadrain | tcsaflush | tcsasoft Termios = binary() | #termios{} Sets the terminal attributes of a serial device. 'tcsasoft' is a non-portable, BSD action. tcsetattr/3 will return {error,unsupported} on other platforms. Warning: the contents of Termios are passed directly to tcsettr(3). If the system tcsettr(3) does not perform any validation of the structure, it is possible the Erlang VM may crash. serctl:cfsetispeed(Termios, Speed) -> Termios1 Types Termios = binary() | #termios{} Speed = integer() | atom() Termios1 = binary() Set the input speed of a serial device. See the warning for tcsetattr/2. Failure: badarg if Speed is an invalid atom. serctl:cfsetospeed(Termios, Speed) -> Termios1 Types Termios = binary() | #termios{} Speed = integer() | atom() Termios1 = binary() Set the input speed of the serial device. See the warning for tcsetattr/2. Failure: badarg if Speed is an invalid atom. serctl:getfd(FD) -> integer() Types FD = resource() Returns the file descriptor associated with the NIF resource. The file descriptor can be used with erlang:open\_port/2. serctl:constant() -> Constants serctl:constant(Attr) -> integer() | undefined Types Constants = [{Attr, integer()}] Attr = tiocm\_rts | tiocm\_dtr | tiocmset | tiocmget | tiocmbis | tiocmbic | tcsaflush | tcsadrain | tcsanow | tcioflush | tcoflush | tciflush | tcion | tcioff | tcoon | tcooff | iexten | tostop | noflsh | echonl | echoke | echok | echoe | echo | icanon | isig | crtscts | b1152000 | b1000000 | b921600 | b576000 | b500000 | b460800 | b230400 | b115200 | b57600 | clocal | hupcl | parodd | parenb | cread | cstopb | cs8 | cs7 | cs6 | cs5 | csize | b38400 | b19200 | b9600 | b4800 | b2400 | b1800 | b1200 | b600 | b300 | b200 | b150 | b134 | b110 | b75 | b50 | b0 | ofdel | ofill | onlret | onocr | ocrnl | onlcr | olcuc | opost | iutf8 | imaxbel | ixoff | ixany | ixon | iuclc | icrnl | igncr | inlcr | istrip | inpck | parmrk | ignpar | brkint | ignbrk | veol2 | vlnext | vwerase | vdiscard | vreprint | veol | vsusp | vstop | vstart | vswtc | vmin | vtime | veof | vkill | verase | vquit | vintr | nccs Map of atoms representing terminal attribute constants to integers. Varies across platforms. ``` serctl has a higher level interface for manipulating the C data structures that takes care of portability. The structures are represented as Erlang records. These functions only retrieve or modify values within the termios structure and do not have side effects when used with the record format (when binaries are used as arguments, they are first converted to record format based on a runtime platform check). To modify the serial device, the attributes must be written out using serctl:tcsetattr/3. ``` serctl:flow(Termios) -> true | false serctl:flow(Termios, Bool) -> #termios{} Types Termios = binary() | #termios{} Bool = true | false Get/set serial device flow control. flow/1 indicates whether flow control is enabled in a serial device's terminal attributes. flow/2 returns a termios structure that can be used for setting a serial device's flow control. serctl:mode(Mode) -> #termios{} Types Mode = raw Returns an Erlang termios record with attributes that can be used to put the serial device into raw mode. serctl:getflag(Termios, Flag, Opt) -> true | false Types Termios = binary() | #termios{} Flag = cflag | lflag | iflag | oflag Opt = atom() Returns whether a flag is enabled. Opt is one of the atoms returned using serctl:constant/0. serctl:setflag(Termios, Opt) -> #termios{} Types Termios = #termios{} Opt = [Param] Param = {Flag, [Val]} Flag = cflag | lflag | iflag | oflag Val = {atom(), Bool} Bool = true | false Returns an Erlang termios record which can be used for setting the attributes of a serial device. For example, to create attributes that can be used to enable hardware flow control on a serial device: {ok, FD} = serctl:open("/dev/ttyUSB0"), {ok, Termios} = serctl:tcgetattr(FD), Termios1 = serctl:setflag(Termios, [{cflag, [{crtscts, true}]}]), ok = serctl:tcsetattr(FD, tcsanow, Termios1). serctl:ispeed(Termios) -> integer() serctl:ispeed(Termios, Speed) -> #termios{} | binary() serctl:ospeed(Termios) -> integer() serctl:ospeed(Termios, Speed) -> #termios{} | binary() Types Termios = #termios{} Speed = integer() | atom() ispeed/1 and ospeed/1 return the input and output speed of the serial device. Note the speed returned is the constant defined for the system and may differ between platforms. ispeed/2 and ospeed/2 return an Erlang termios record that can be used for setting the input and output speed of the serial device. Failure: badarg if Speed is an invalid atom. serctl:baud(Speed) -> integer() Types Speed = 115200 | 19200 | 9600 | ... Return the constant defined for the baud rate for the platform. serctl:termios(Termios) -> #termios{} | binary() Types Termios = #termios{} | binary() Convert between a C struct termios and an Erlang record. ``` [examples](#examples) EXAMPLES -------------------------------- * Connect to an Arduino at 9600 ``` % Open the serial device {ok, FD} = serctl:open("/dev/ttyUSB0"), % Set the terminal attributes to: % raw, no hardware flow control, 9600 Termios = lists:foldl( fun(Fun, Acc) -> Fun(Acc) end, serctl:mode(raw), [ fun(N) -> serctl:flow(N, false) end, fun(N) -> serctl:ispeed(N, b9600) end, fun(N) -> serctl:ospeed(N, b9600) end ] ), ok = serctl:tcsetattr(FD, tcsanow, Termios), % Write 1 byte to the arduino ok = serctl:write(FD, <<1:8>>), % Read 2 bytes from the arduino (little-endian integer) {ok, <<Data:2/little-integer-unit:8>>} = serctl:read(FD, 2). ``` * Resetting DTR/RTS ``` TIOCMGET = serctl:constant(tiocmget), TIOCMSET = serctl:constant(tiocmset), TIOCM\_DTR = serctl:constant(tiocm\_dtr), TIOCM\_RTS = serctl:constant(tiocm\_rts), % Get the current device settings {ok, <<Ctl:4/native-unsigned-integer-unit:8>>} = serctl:ioctl( FD, TIOCMGET, <<0:32>> ), Off = Ctl band bnot ( TIOCM\_DTR bor TIOCM\_RTS ), {ok, <<Ctl1:4/native-unsigned-integer-unit:8>>} = serctl:ioctl( FD, TIOCMSET, <<Off:4/native-unsigned-integer-unit:8>> ), On = Ctl1 bor ( TIOCM\_DTR bor TIOCM\_RTS ), serctl:ioctl( FD, TIOCMSET, <<On:4/native-unsigned-integer-unit:8>> ). ``` * See the examples directory. The code here is adapted from: <http://blog.listincomprehension.com/2010/04/accessing-arduino-from-erlang.html> + examples/strobe Serially turn on/off a row of LEDs. + examples/ldr Read values from an LDR. [todo](#todo) TODO -------------------- * document srly * test if the system C interface can actually be crashed! * srly should be a well behaved OTP application that can deal with the addition and removal of USB serial ports [← Previous Page API Reference](api-reference.html) [Next Page β†’ LICENSE](license.html) serctl β€” srly v0.6.5 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L31 "View Source") serctl (srly v0.6.5) ============================================================================================================================= [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [dev/0](#t:dev/0) [errno/0](#t:errno/0) [fd/0](#t:fd/0) [termios/0](#t:termios/0) [Functions](#functions) ------------------------ [baud(Speed)](#baud/1) Return the constant defined for the baud rate for the platform [cfsetispeed(Termios, Speed)](#cfsetispeed/2) Set the input speed of a serial device [cfsetospeed(Termios, Speed)](#cfsetospeed/2) Set the input speed of the serial device. [close(\_)](#close/1) Explicitly close a serial device [constant()](#constant/0) Map of atoms representing terminal attribute constants to integers [constant(\_)](#constant/1) [flow(Termios)](#flow/1) Get/set serial device flow control [flow(Termios, Bool)](#flow/2) [getfd(\_)](#getfd/1) Returns the file descriptor associated with the NIF resource [getflag(Termios, Flag, Opt)](#getflag/3) Returns whether a flag is enabled [init()](#init/0) [ioctl(\_, \_, \_)](#ioctl/3) Perform operations controlling a serial device [ispeed(Speed)](#ispeed/1) return the input speed of a serial device [ispeed(Termios, Speed)](#ispeed/2) [mode(\_)](#mode/1) Enable raw mode [offset(Cc, \_)](#offset/2) [open(Dev)](#open/1) Open a serial device [ospeed(Speed)](#ospeed/1) return the output speed of a serial device [ospeed(Termios, Speed)](#ospeed/2) [read(\_, \_)](#read/2) Read from a serial device [readx(FD, N)](#readx/2) Read the specified number of bytes from a serial device [readx(FD, N, Timeout)](#readx/3) [setflag(Termios, Opt)](#setflag/2) Returns an Erlang termios record used for setting the attributes of a serial device [tcflush(FD, Discard)](#tcflush/2) discards data written but not transmitted or received but not read [tcgetattr(\_)](#tcgetattr/1) Get the terminal attributes of a serial device [tcsetattr(FD, Action, Termios)](#tcsetattr/3) Sets the terminal attributes of a serial device [termios(Termios)](#termios/1) [wordalign(Offset)](#wordalign/1) [wordalign(Offset, Align)](#wordalign/2) [write(FD, Buf)](#write/2) Write data to a serial device [Link to this section](#types) Types ===================================== [Link to this type](#t:dev/0 "Link to this type") dev/0 ===== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L74 "View Source") ``` -type dev() :: iodata() | {fd, integer()}. ``` [Link to this type](#t:errno/0 "Link to this type") errno/0 ======= [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L75 "View Source") ``` -type errno() :: {error, [file:posix](https://www.erlang.org/doc/man/file.html#type-posix)()}. ``` [Link to this type](#t:fd/0 "Link to this type") fd/0 ==== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L73 "View Source") ``` -type fd() :: any(). ``` [Link to this type](#t:termios/0 "Link to this type") termios/0 ========= [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L76 "View Source") ``` -type termios() :: #termios{} | binary(). ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#baud/1 "Link to this function") baud(Speed) =========== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L499 "View Source") Return the constant defined for the baud rate for the platform [Link to this function](#cfsetispeed/2 "Link to this function") cfsetispeed(Termios, Speed) =========================== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L212 "View Source") ``` -spec cfsetispeed([termios](#t:termios/0)(), atom() | integer()) -> binary(). ``` Set the input speed of a serial device See the warning for tcsetattr/2. Failure: badarg if Speed is an invalid atom. [Link to this function](#cfsetospeed/2 "Link to this function") cfsetospeed(Termios, Speed) =========================== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L233 "View Source") ``` -spec cfsetospeed([termios](#t:termios/0)(), atom() | integer()) -> binary(). ``` Set the input speed of the serial device. See the warning for tcsetattr/2. Failure: badarg if Speed is an invalid atom. [Link to this function](#close/1 "Link to this function") close(\_) ========= [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L114 "View Source") ``` -spec close([fd](#t:fd/0)()) -> {ok, [fd](#t:fd/0)()} | [errno](#t:errno/0)(). ``` Explicitly close a serial device The device is automatically closed if the process holding open the serial device exits. [Link to this function](#constant/0 "Link to this function") constant() ========== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L280 "View Source") ``` -spec constant() -> [proplists:proplist](https://www.erlang.org/doc/man/proplists.html#type-proplist)(). ``` Map of atoms representing terminal attribute constants to integers Varies across platforms. [Link to this function](#constant/1 "Link to this function") constant(\_) ============ [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L284 "View Source") ``` -spec constant(atom()) -> integer() | undefined. ``` [Link to this function](#flow/1 "Link to this function") flow(Termios) ============= [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L405 "View Source") ``` -spec flow(<<_:64, _:_*8>> | #termios{}) -> boolean(). ``` Get/set serial device flow control flow/1 indicates whether flow control is enabled in a serial device's terminal attributes. flow/2 returns a termios structure that can be used for setting a serial device's flow control. [Link to this function](#flow/2 "Link to this function") flow(Termios, Bool) =================== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L409 "View Source") ``` -spec flow(<<_:64, _:_*8>> | #termios{}, boolean()) -> #termios{}. ``` [Link to this function](#getfd/1 "Link to this function") getfd(\_) ========= [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L291 "View Source") ``` -spec getfd([fd](#t:fd/0)()) -> integer(). ``` Returns the file descriptor associated with the NIF resource The file descriptor can be used with erlang:open\_port/2. [Link to this function](#getflag/3 "Link to this function") getflag(Termios, Flag, Opt) =========================== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L379 "View Source") ``` -spec getflag(<<_:64, _:_*8>> | #termios{}, cflag | iflag | lflag | oflag, atom()) -> boolean(). ``` Returns whether a flag is enabled Opt is one of the atoms returned using serctl:constant/0. [Link to this function](#init/0 "Link to this function") init() ====== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L85 "View Source") [Link to this function](#ioctl/3 "Link to this function") ioctl(\_, \_, \_) ================= [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L273 "View Source") ``` -spec ioctl([fd](#t:fd/0)(), integer(), binary()) -> {ok, binary()} | [errno](#t:errno/0)(). ``` Perform operations controlling a serial device The In argument is a binary holding the input parameter to the device request. The Out parameter will hold the result of the request if the ioctl is in/out. ioctl/3 can be used for implementing most serial operations. ### [examples](#ioctl/3-examples) Examples ``` -define(TCXONC, 16#540A). tcflow(FD, Action) when is\_atom(Action) -> case serctl:constant(Action) of undefined -> {error, unsupported}; N -> serctl:ioctl( fd, ?TCFLSH, <<N:4/native-unsigned-integer-unit:8>> ) end. ``` [Link to this function](#ispeed/1 "Link to this function") ispeed(Speed) ============= [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L452 "View Source") ``` -spec ispeed(binary() | #termios{}) -> non_neg_integer(). ``` return the input speed of a serial device Note the speed returned is the constant defined for the system and may differ between platforms. ispeed/2 returns an Erlang termios record that can be used for setting the input speed of the serial device. Failure: badarg if Speed is an invalid atom. [Link to this function](#ispeed/2 "Link to this function") ispeed(Termios, Speed) ====================== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L458 "View Source") ``` -spec ispeed(<<_:64, _:_*8>> | #termios{}, atom() | integer()) -> <<_:8, _:_*8>> | #termios{}. ``` [Link to this function](#mode/1 "Link to this function") mode(\_) ======== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L416 "View Source") Enable raw mode Returns an Erlang termios record with attributes that can be used to put the serial device into raw mode. [Link to this function](#offset/2 "Link to this function") offset(Cc, \_) ============== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L872 "View Source") [Link to this function](#open/1 "Link to this function") open(Dev) ========= [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L98 "View Source") ``` -spec open([dev](#t:dev/0)()) -> {ok, [fd](#t:fd/0)()} | [errno](#t:errno/0)(). ``` Open a serial device A serial device is a character device such as /dev/ttyUSB0. A previously opened file descriptor can also be used. The fd should be opened with the O\_NONBLOCK|O\_NOCTTY flags. [Link to this function](#ospeed/1 "Link to this function") ospeed(Speed) ============= [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L480 "View Source") ``` -spec ospeed(binary() | #termios{}) -> non_neg_integer(). ``` return the output speed of a serial device Note the speed returned is the constant defined for the system and may differ between platforms. ospeed/2 returns an Erlang termios record that can be used for setting the output speed of the serial device. Failure: badarg if Speed is an invalid atom. [Link to this function](#ospeed/2 "Link to this function") ospeed(Termios, Speed) ====================== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L486 "View Source") ``` -spec ospeed(<<_:64, _:_*8>> | #termios{}, atom() | integer()) -> <<_:8, _:_*8>> | #termios{}. ``` [Link to this function](#read/2 "Link to this function") read(\_, \_) ============ [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L121 "View Source") ``` -spec read([fd](#t:fd/0)(), non_neg_integer()) -> {ok, binary()} | [errno](#t:errno/0)(). ``` Read from a serial device Size is an unsigned long. [Link to this function](#readx/2 "Link to this function") readx(FD, N) ============ [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L308 "View Source") ``` -spec readx([fd](#t:fd/0)(), non_neg_integer()) -> {ok, binary()} | [errno](#t:errno/0)(). ``` Read the specified number of bytes from a serial device readx/2 will block forever. readx/3 accepts a timeout value. The behaviour of readx/3 when the timeout is reached is to throw away any buffered data and return {error, eintr} to the caller, e.g., the caller will not be returned the contents of a partial read. (The justification for this behaviour: the caller has stated they require a fixed number of bytes so the contents of a partial read represents unspecified behaviour.) [Link to this function](#readx/3 "Link to this function") readx(FD, N, Timeout) ===================== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L312 "View Source") ``` -spec readx([fd](#t:fd/0)(), non_neg_integer(), timeout()) -> {ok, binary()} | [errno](#t:errno/0)(). ``` [Link to this function](#setflag/2 "Link to this function") setflag(Termios, Opt) ===================== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L336 "View Source") ``` -spec setflag(binary() | #termios{}, [proplists:proplist](https://www.erlang.org/doc/man/proplists.html#type-proplist)()) -> #termios{}. ``` Returns an Erlang termios record used for setting the attributes of a serial device For example, to create attributes that can be used to enable hardware flow control on a serial device: ``` {ok, FD} = serctl:open("/dev/ttyUSB0"), {ok, Termios} = serctl:tcgetattr(FD), Termios1 = serctl:setflag(Termios, [{cflag, [{crtscts, true}]}]), ok = serctl:tcsetattr(FD, tcsanow, Termios1). ``` [Link to this function](#tcflush/2 "Link to this function") tcflush(FD, Discard) ==================== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L195 "View Source") ``` -spec tcflush([fd](#t:fd/0)(), atom()) -> ok | [errno](#t:errno/0)() | {error, unsupported}. ``` discards data written but not transmitted or received but not read The second argument determines whether to flush input, output, or both [Link to this function](#tcgetattr/1 "Link to this function") tcgetattr(\_) ============= [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L144 "View Source") ``` -spec tcgetattr([fd](#t:fd/0)()) -> {ok, binary()} | [errno](#t:errno/0)(). ``` Get the terminal attributes of a serial device Returns the contents of the system struct termios as a binary. [Link to this function](#tcsetattr/3 "Link to this function") tcsetattr(FD, Action, Termios) ============================== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L156 "View Source") ``` -spec tcsetattr([fd](#t:fd/0)(), [atom()] | atom() | integer(), [termios](#t:termios/0)()) -> ok | [errno](#t:errno/0)() | {error, unsupported}. ``` Sets the terminal attributes of a serial device 'tcsasoft' is a non-portable, BSD action. tcsetattr/3 will return `{error,unsupported}` on other platforms. Warning: the contents of Termios are passed directly to tcsettr(3). If the system tcsettr(3) does not perform any validation of the structure, it is possible the Erlang VM may crash. [Link to this function](#termios/1 "Link to this function") termios(Termios) ================ [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L571 "View Source") ``` -spec termios(binary() | #termios{}) -> binary() | #termios{}. ``` [Link to this function](#wordalign/1 "Link to this function") wordalign(Offset) ================= [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L867 "View Source") [Link to this function](#wordalign/2 "Link to this function") wordalign(Offset, Align) ======================== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L869 "View Source") [Link to this function](#write/2 "Link to this function") write(FD, Buf) ============== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/serctl.erl#L128 "View Source") ``` -spec write([fd](#t:fd/0)(), iodata()) -> ok | {ok, non_neg_integer()} | [errno](#t:errno/0)(). ``` Write data to a serial device Partial writes return the number of bytes written. srly β€” srly v0.6.5 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/srly.erl#L30 "View Source") srly (srly v0.6.5) ========================================================================================================================= [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [close(Ref)](#close/1) [code\_change(OldVsn, State, Extra)](#code_change/3) [controlling\_process(Ref, Pid)](#controlling_process/2) [getfd(Ref)](#getfd/1) [handle\_call(\_, From, State)](#handle_call/3) [handle\_cast(Msg, State)](#handle_cast/2) [handle\_info(Info, State)](#handle_info/2) [init(\_)](#init/1) [open(Dev)](#open/1) [open(Dev, Opt)](#open/2) [read(FD, Len)](#read/2) [send(Ref, Data)](#send/2) [start\_link(Dev, Opt)](#start_link/2) [terminate(Reason, State)](#terminate/2) [write(FD, Data)](#write/2) [Link to this section](#functions) Functions ============================================= [Link to this function](#close/1 "Link to this function") close(Ref) ========== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/srly.erl#L77 "View Source") [Link to this function](#code_change/3 "Link to this function") code\_change(OldVsn, State, Extra) ================================== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/srly.erl#L187 "View Source") [Link to this function](#controlling_process/2 "Link to this function") controlling\_process(Ref, Pid) ============================== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/srly.erl#L94 "View Source") [Link to this function](#getfd/1 "Link to this function") getfd(Ref) ========== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/srly.erl#L81 "View Source") [Link to this function](#handle_call/3 "Link to this function") handle\_call(\_, From, State) ============================= [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/srly.erl#L145 "View Source") [Link to this function](#handle_cast/2 "Link to this function") handle\_cast(Msg, State) ======================== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/srly.erl#L164 "View Source") [Link to this function](#handle_info/2 "Link to this function") handle\_info(Info, State) ========================= [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/srly.erl#L170 "View Source") [Link to this function](#init/1 "Link to this function") init(\_) ======== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/srly.erl#L105 "View Source") [Link to this function](#open/1 "Link to this function") open(Dev) ========= [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/srly.erl#L71 "View Source") [Link to this function](#open/2 "Link to this function") open(Dev, Opt) ============== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/srly.erl#L74 "View Source") [Link to this function](#read/2 "Link to this function") read(FD, Len) ============= [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/srly.erl#L84 "View Source") [Link to this function](#send/2 "Link to this function") send(Ref, Data) =============== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/srly.erl#L90 "View Source") [Link to this function](#start_link/2 "Link to this function") start\_link(Dev, Opt) ===================== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/srly.erl#L98 "View Source") [Link to this function](#terminate/2 "Link to this function") terminate(Reason, State) ======================== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/srly.erl#L181 "View Source") [Link to this function](#write/2 "Link to this function") write(FD, Data) =============== [View Source](https://github.com/msantos/srly/blob/v0.6.5/src/srly.erl#L87 "View Source")
ratatouille
hex
API Reference β€” Ratatouille v0.5.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Ratatouille v0.5.1 API Reference ================================== Modules ---------- [Ratatouille](Ratatouille.html) Ratatouille is a framework for building terminal UIs. [Ratatouille.App](Ratatouille.App.html) Defines the [`Ratatouille.App`](#content) behaviour. It provides the structure for architecting both large and small terminal applications. This structure allows you to render views and update them over time or in response to user input. [Ratatouille.Constants](Ratatouille.Constants.html) A convenience wrapper of [`ExTermbox.Constants`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html). [Ratatouille.EventManager](Ratatouille.EventManager.html) A wrapper of [`ExTermbox.EventManager`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.EventManager.html) so that Ratatouille applications don't need to use or depend on ex\_termbox directly. [Ratatouille.Renderer](Ratatouille.Renderer.html) Logic to render a view tree. [Ratatouille.Renderer.Attributes](Ratatouille.Renderer.Attributes.html) Functions for working with element attributes [Ratatouille.Renderer.Border](Ratatouille.Renderer.Border.html) Primitives for rendering borders [Ratatouille.Renderer.Box](Ratatouille.Renderer.Box.html) This defines the internal representation of a rectangular region---a box---for rendering, as well as logic for transforming these boxes. [Ratatouille.Renderer.Canvas](Ratatouille.Renderer.Canvas.html) A canvas represents a terminal window, a subvision of it for rendering, and a sparse mapping of positions to cells. [Ratatouille.Renderer.Cells](Ratatouille.Renderer.Cells.html) Functions for working with canvas cells. [Ratatouille.Renderer.Line](Ratatouille.Renderer.Line.html) Primitives for rendering lines [Ratatouille.Renderer.Text](Ratatouille.Renderer.Text.html) Primitives for rendering text [Ratatouille.Runtime](Ratatouille.Runtime.html) A runtime for apps implementing the [`Ratatouille.App`](Ratatouille.App.html) behaviour. See [`Ratatouille.App`](Ratatouille.App.html) for details on how to build apps. [Ratatouille.Runtime.Command](Ratatouille.Runtime.Command.html) Commands provide a way to start an expensive call in the background and get the result back via [`Ratatouille.App.update/2`](Ratatouille.App.html#c:update/2). [Ratatouille.Runtime.State](Ratatouille.Runtime.State.html) Defines a struct to store the runtime loop's state. [Ratatouille.Runtime.Subscription](Ratatouille.Runtime.Subscription.html) Subscriptions provide a way for the app to be notified via [`Ratatouille.App.update/2`](Ratatouille.App.html#c:update/2) when something interesting happens. [Ratatouille.Runtime.Supervisor](Ratatouille.Runtime.Supervisor.html) A supervisor to run the application runtime and its dependencies. [Ratatouille.View](Ratatouille.View.html) In Ratatouille, a view is simply a tree of elements. Each element in the tree holds an attributes map and a list of zero or more child nodes. Visually, it looks like something this [Ratatouille.Window](Ratatouille.Window.html) A GenServer to manage the terminal window, along with a client API to perform updates and retrieve window information. Ratatouille β€” Ratatouille v0.5.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Ratatouille v0.5.1 Ratatouille [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille.ex#L1 "View Source") ======================================================================================================================================== Ratatouille is a framework for building terminal UIs. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [run(application, opts \\ [])](#run/2) Starts an application under a supervised runtime, given a module implementing the `Ratatouille.Application` behaviour. This call blocks until the application is quit (or it crashes). [Link to this section](#functions) Functions ============================================= [Link to this function](#run/2 "Link to this function") run(application, opts \\ []) ============================ [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille.ex#L45 "View Source") Starts an application under a supervised runtime, given a module implementing the `Ratatouille.Application` behaviour. This call blocks until the application is quit (or it crashes). This is intended as a way to easily run simple apps and examples. For more complex apps depending on other processes, it's recommended to define an OTP application and start the [`Ratatouille.Runtime.Supervisor`](Ratatouille.Runtime.Supervisor.html) as a child of your application supervisor. ### Example ``` defmodule Counter do @behaviour Ratatouille.App import Ratatouille.View def init(\_context), do: 0 def update(model, msg) do case msg do {:event, %{ch: ?+}} -> model + 1 {:event, %{ch: ?-}} -> model - 1 \_ -> model end end def render(model) do view do label(content: "Counter is #{model} (+/-)") end end end Ratatouille.run(Counter) ``` Ratatouille.App β€” Ratatouille v0.5.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Ratatouille v0.5.1 Ratatouille.App behaviour [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/app.ex#L1 "View Source") ========================================================================================================================================================== Defines the [`Ratatouille.App`](#content) behaviour. It provides the structure for architecting both large and small terminal applications. This structure allows you to render views and update them over time or in response to user input. A Simple Example ------------------- ``` defmodule Counter.App do @behaviour Ratatouille.App def model(\_context), do: 0 def update(model, msg) do case msg do {:event, %{ch: ?+}} -> model + 1 {:event, %{ch: ?-}} -> model - 1 \_ -> model end end def render(model) do view do label(content: "Counter is #{model} (+/-)") end end end ``` Architecture --------------- You may have recognized this pattern from [the Elm Architecture](https://guide.elm-lang.org/architecture/). That's because [`Ratatouille.App`](#content) is just a close translation of this architecture to Elixir. Because Elixir and Elm are both functional programming languages, the pattern also works very well in Elixir. It helps to centralize state, The architecture cleanly separates logic into the following three parts: * **Model:** the state of your application * **Update:** a way to update your state * **View:** a way to view your state as a `%Ratatouille.Element{}` tree (think HTML). The behaviour callbacks map to these three parts: * [`init/1`](#c:init/1) defines your initial model, using provided context if needed. * [`update/2`](#c:update/2) handles a message and retuns a new model. * [`render/1`](#c:render/1) receives a model and builds a view (an element tree) to view it. See the documentation for each callback below for additional details. Runtime ---------- As long as you implement the behaviour callbacks, Ratatouille can handle the rest. It provides a runtime ([`Ratatouille.Runtime`](Ratatouille.Runtime.html)), which will handle actually running your application. That means setting up the window, rendering the view, subscribing to events and passing these on to the application's `update/2` callback, and making sure the view is always re-rendered when the application's model changes. Fetching Data & Other Expensive Calls ---------------------------------------- A good rule of thumb for developing responsive UIs in any language is to never block the UI thread. Here, we have a runtime process, but the same rule applies. In Ratatouille, your application should use [`Ratatouille.Runtime.Command`](Ratatouille.Runtime.Command.html) in order to start asynchronous tasks and get the result in the `update/2` callback once finished. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [context()](#t:context/0) [model()](#t:model/0) [msg()](#t:msg/0) [Callbacks](#callbacks) ------------------------ [init(context)](#c:init/1) The `init/1` callback defines the initial model. This model can be defined based on the runtime context. See the "Runtime Context" section under [`Ratatouille.Runtime`](Ratatouille.Runtime.html) for details on what context is provided. [render(model)](#c:render/1) The `render/1` callback defines how to render the model as a view. [subscribe(model)](#c:subscribe/1) The optional `subscribe/1` callback defines a subscription for the application given the initial model. Subscriptions are fulfilled via the `update/2` callback. [update(model, msg)](#c:update/2) The `update/2` callback defines how to update the model in reaction to a message (for example, an event or a tick). [Link to this section](#types) Types ===================================== [Link to this type](#t:context/0 "Link to this type") context() ========= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/app.ex#L78 "View Source") ``` context() :: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` [Link to this type](#t:model/0 "Link to this type") model() ======= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/app.ex#L79 "View Source") ``` model() :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this type](#t:msg/0 "Link to this type") msg() ===== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/app.ex#L80 "View Source") ``` msg() :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this section](#callbacks) Callbacks ============================================= [Link to this callback](#c:init/1 "Link to this callback") init(context) ============= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/app.ex#L87 "View Source") ``` init([context](#t:context/0)()) :: [model](#t:model/0)() | {[model](#t:model/0)(), Command.t()} ``` The `init/1` callback defines the initial model. This model can be defined based on the runtime context. See the "Runtime Context" section under [`Ratatouille.Runtime`](Ratatouille.Runtime.html) for details on what context is provided. [Link to this callback](#c:render/1 "Link to this callback") render(model) ============= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/app.ex#L136 "View Source") ``` render([model](#t:model/0)()) :: Ratatouille.Renderer.Element.t() ``` The `render/1` callback defines how to render the model as a view. It should return a `%Ratatouille.Element{}` with the `:view` tag. For example: ``` @impl true def render(model) do view do label(content: "Hello, #{model.name}!") end end ``` [Link to this callback](#c:subscribe/1 "Link to this callback") subscribe(model) ================ [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/app.ex#L121 "View Source") (optional) ``` subscribe([model](#t:model/0)()) :: Subscription.t() ``` The optional `subscribe/1` callback defines a subscription for the application given the initial model. Subscriptions are fulfilled via the `update/2` callback. For example, a subscription can be used to update the view every second (see [`Ratatouille.Runtime.Subscription.interval/2`](Ratatouille.Runtime.Subscription.html#interval/2)): ``` @impl true def subscribe(\_model) do Subscription.interval(1\_000, :tick) end ``` It's also possible to subscribe to multiple things via [`Ratatouille.Runtime.Subscription.batch/1`](Ratatouille.Runtime.Subscription.html#batch/1). See [`Ratatouille.Runtime.Subscription`](Ratatouille.Runtime.Subscription.html) for more details. [Link to this callback](#c:update/2 "Link to this callback") update(model, msg) ================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/app.ex#L102 "View Source") ``` update([model](#t:model/0)(), [msg](#t:msg/0)()) :: [model](#t:model/0)() | {[model](#t:model/0)(), Command.t()} ``` The `update/2` callback defines how to update the model in reaction to a message (for example, an event or a tick). The following messages are currently passed to `update/2` by the runtime: * `{:event, event}` - A keyboard or click event. * `{:refresh, event}` - A resize event. The callback should always return the model. It can be the same model or an updated one. If the model changes, the runtime will know to re-render the model and update the window. Ratatouille.Constants β€” Ratatouille v0.5.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Ratatouille v0.5.1 Ratatouille.Constants [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/constants.ex#L1 "View Source") ============================================================================================================================================================ A convenience wrapper of [`ExTermbox.Constants`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html). [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [attribute(name)](#attribute/1) See [`ExTermbox.Constants.attribute/1`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#attribute/1). [attributes()](#attributes/0) See [`ExTermbox.Constants.attributes/0`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#attributes/0). [color(name)](#color/1) See [`ExTermbox.Constants.color/1`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#color/1). [colors()](#colors/0) See [`ExTermbox.Constants.colors/0`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#colors/0). [error\_code(name)](#error_code/1) See [`ExTermbox.Constants.error_code/1`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#error_code/1). [error\_codes()](#error_codes/0) See [`ExTermbox.Constants.error_codes/0`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#error_codes/0). [event\_type(name)](#event_type/1) See [`ExTermbox.Constants.event_type/1`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#event_type/1). [event\_types()](#event_types/0) See [`ExTermbox.Constants.event_types/0`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#event_types/0). [input\_mode(name)](#input_mode/1) See [`ExTermbox.Constants.input_mode/1`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#input_mode/1). [input\_modes()](#input_modes/0) See [`ExTermbox.Constants.input_modes/0`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#input_modes/0). [key(name)](#key/1) See [`ExTermbox.Constants.key/1`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#key/1). [keys()](#keys/0) See [`ExTermbox.Constants.keys/0`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#keys/0). [output\_mode(name)](#output_mode/1) See [`ExTermbox.Constants.output_mode/1`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#output_mode/1). [output\_modes()](#output_modes/0) See [`ExTermbox.Constants.output_modes/0`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#output_modes/0). [Link to this section](#functions) Functions ============================================= [Link to this function](#attribute/1 "Link to this function") attribute(name) =============== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/constants.ex#L22 "View Source") See [`ExTermbox.Constants.attribute/1`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#attribute/1). [Link to this function](#attributes/0 "Link to this function") attributes() ============ [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/constants.ex#L27 "View Source") See [`ExTermbox.Constants.attributes/0`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#attributes/0). [Link to this function](#color/1 "Link to this function") color(name) =========== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/constants.ex#L22 "View Source") See [`ExTermbox.Constants.color/1`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#color/1). [Link to this function](#colors/0 "Link to this function") colors() ======== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/constants.ex#L27 "View Source") See [`ExTermbox.Constants.colors/0`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#colors/0). [Link to this function](#error_code/1 "Link to this function") error\_code(name) ================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/constants.ex#L22 "View Source") See [`ExTermbox.Constants.error_code/1`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#error_code/1). [Link to this function](#error_codes/0 "Link to this function") error\_codes() ============== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/constants.ex#L27 "View Source") See [`ExTermbox.Constants.error_codes/0`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#error_codes/0). [Link to this function](#event_type/1 "Link to this function") event\_type(name) ================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/constants.ex#L22 "View Source") See [`ExTermbox.Constants.event_type/1`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#event_type/1). [Link to this function](#event_types/0 "Link to this function") event\_types() ============== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/constants.ex#L27 "View Source") See [`ExTermbox.Constants.event_types/0`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#event_types/0). [Link to this function](#input_mode/1 "Link to this function") input\_mode(name) ================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/constants.ex#L22 "View Source") See [`ExTermbox.Constants.input_mode/1`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#input_mode/1). [Link to this function](#input_modes/0 "Link to this function") input\_modes() ============== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/constants.ex#L27 "View Source") See [`ExTermbox.Constants.input_modes/0`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#input_modes/0). [Link to this function](#key/1 "Link to this function") key(name) ========= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/constants.ex#L22 "View Source") See [`ExTermbox.Constants.key/1`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#key/1). [Link to this function](#keys/0 "Link to this function") keys() ====== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/constants.ex#L27 "View Source") See [`ExTermbox.Constants.keys/0`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#keys/0). [Link to this function](#output_mode/1 "Link to this function") output\_mode(name) ================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/constants.ex#L22 "View Source") See [`ExTermbox.Constants.output_mode/1`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#output_mode/1). [Link to this function](#output_modes/0 "Link to this function") output\_modes() =============== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/constants.ex#L27 "View Source") See [`ExTermbox.Constants.output_modes/0`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Constants.html#output_modes/0). Ratatouille.EventManager β€” Ratatouille v0.5.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Ratatouille v0.5.1 Ratatouille.EventManager [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/event_manager.ex#L1 "View Source") =================================================================================================================================================================== A wrapper of [`ExTermbox.EventManager`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.EventManager.html) so that Ratatouille applications don't need to use or depend on ex\_termbox directly. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [child\_spec(opts)](#child_spec/1) Provides a child specification to use when starting the event manager under a supervisor. [start\_link(opts \\ [])](#start_link/1) Starts the [`ExTermbox.EventManager`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.EventManager.html) gen\_server. [stop(pid \\ \_\_MODULE\_\_)](#stop/1) Stops the event manager server. [subscribe(pid \\ \_\_MODULE\_\_, subscriber\_pid)](#subscribe/2) Subscribes the given pid to future event notifications. [Link to this section](#functions) Functions ============================================= [Link to this function](#child_spec/1 "Link to this function") child\_spec(opts) ================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/event_manager.ex#L33 "View Source") Provides a child specification to use when starting the event manager under a supervisor. [Link to this function](#start_link/1 "Link to this function") start\_link(opts \\ []) ======================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/event_manager.ex#L11 "View Source") ``` start_link([Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: [GenServer.on\_start](https://hexdocs.pm/elixir/GenServer.html#t:on_start/0)() ``` Starts the [`ExTermbox.EventManager`](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.EventManager.html) gen\_server. [Link to this function](#stop/1 "Link to this function") stop(pid \\ \_\_MODULE\_\_) =========================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/event_manager.ex#L26 "View Source") Stops the event manager server. [Link to this function](#subscribe/2 "Link to this function") subscribe(pid \\ \_\_MODULE\_\_, subscriber\_pid) ================================================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/event_manager.ex#L20 "View Source") Subscribes the given pid to future event notifications. Ratatouille.Renderer β€” Ratatouille v0.5.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Ratatouille v0.5.1 Ratatouille.Renderer behaviour [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer.ex#L1 "View Source") ==================================================================================================================================================================== Logic to render a view tree. This API is still under development. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [child\_element()](#t:child_element/0) [child\_tag()](#t:child_tag/0) [root\_element()](#t:root_element/0) [Functions](#functions) ------------------------ [render(canvas, root)](#render/2) Renders a view tree to canvas, given a canvas and a root element (an element with the `:view` tag). [render\_tree(canvas, elements)](#render_tree/2) [validate\_tree(element)](#validate_tree/1) Validates the hierarchy of a view tree given the root element. [Callbacks](#callbacks) ------------------------ [render(arg1, arg2, function)](#c:render/3) [Link to this section](#types) Types ===================================== [Link to this type](#t:child_element/0 "Link to this type") child\_element() ================ [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer.ex#L31 "View Source") ``` child_element() :: %Ratatouille.Renderer.Element{ attributes: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), children: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), tag: [child\_tag](#t:child_tag/0)() } ``` [Link to this type](#t:child_tag/0 "Link to this type") child\_tag() ============ [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer.ex#L15 "View Source") ``` child_tag() :: :bar | :chart | :column | :label | :overlay | :panel | :row | :sparkline | :table | :table_cell | :table_row | :text | :tree | :tree_node ``` [Link to this type](#t:root_element/0 "Link to this type") root\_element() =============== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer.ex#L10 "View Source") ``` root_element() :: %Ratatouille.Renderer.Element{ attributes: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), children: [[child\_element](#t:child_element/0)()], tag: :view } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#render/2 "Link to this function") render(canvas, root) ==================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer.ex#L51 "View Source") ``` render([Ratatouille.Renderer.Canvas.t](Ratatouille.Renderer.Canvas.html#t:t/0)(), [root\_element](#t:root_element/0)()) :: {:ok, [Ratatouille.Renderer.Canvas.t](Ratatouille.Renderer.Canvas.html#t:t/0)()} | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` Renders a view tree to canvas, given a canvas and a root element (an element with the `:view` tag). The tree is rendered by recursively rendering each element in the hierarchy. The canvas serves as both the accumulator for rendered cells at each stage and as the box representing available space for rendering, which shrinks as this space is consumed. [Link to this function](#render_tree/2 "Link to this function") render\_tree(canvas, elements) ============================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer.ex#L58 "View Source") ``` render_tree( [Ratatouille.Renderer.Canvas.t](Ratatouille.Renderer.Canvas.html#t:t/0)(), Ratatouille.Renderer.Element.t() | [Ratatouille.Renderer.Element.t()] ) :: [Ratatouille.Renderer.Canvas.t](Ratatouille.Renderer.Canvas.html#t:t/0)() ``` [Link to this function](#validate_tree/1 "Link to this function") validate\_tree(element) ======================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer.ex#L83 "View Source") ``` validate_tree(Ratatouille.Renderer.Element.t()) :: :ok | {:error, [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()} ``` Validates the hierarchy of a view tree given the root element. Used by the render/2 function to prevent strange errors that may otherwise occur when processing invalid view trees. [Link to this section](#callbacks) Callbacks ============================================= [Link to this callback](#c:render/3 "Link to this callback") render(arg1, arg2, function) ============================ [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer.ex#L33 "View Source") ``` render( [Ratatouille.Renderer.Canvas.t](Ratatouille.Renderer.Canvas.html#t:t/0)(), Ratatouille.Renderer.Element.t(), ([Ratatouille.Renderer.Canvas.t](Ratatouille.Renderer.Canvas.html#t:t/0)(), Ratatouille.Renderer.Element.t() -> [Ratatouille.Renderer.Canvas.t](Ratatouille.Renderer.Canvas.html#t:t/0)()) ) :: [Ratatouille.Renderer.Canvas.t](Ratatouille.Renderer.Canvas.html#t:t/0)() ``` Ratatouille.Renderer.Attributes β€” Ratatouille v0.5.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Ratatouille v0.5.1 Ratatouille.Renderer.Attributes [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/attributes.ex#L1 "View Source") ================================================================================================================================================================================ Functions for working with element attributes [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [to\_terminal\_attribute(code)](#to_terminal_attribute/1) [to\_terminal\_color(code)](#to_terminal_color/1) [Link to this section](#functions) Functions ============================================= [Link to this function](#to_terminal_attribute/1 "Link to this function") to\_terminal\_attribute(code) ============================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/attributes.ex#L20 "View Source") [Link to this function](#to_terminal_color/1 "Link to this function") to\_terminal\_color(code) ========================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/attributes.ex#L11 "View Source") Ratatouille.Renderer.Border β€” Ratatouille v0.5.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Ratatouille v0.5.1 Ratatouille.Renderer.Border [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/border.ex#L1 "View Source") ======================================================================================================================================================================== Primitives for rendering borders [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [render(canvas)](#render/1) [Link to this section](#functions) Functions ============================================= [Link to this function](#render/1 "Link to this function") render(canvas) ============== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/border.ex#L19 "View Source") Ratatouille.Renderer.Box β€” Ratatouille v0.5.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Ratatouille v0.5.1 Ratatouille.Renderer.Box [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/box.ex#L1 "View Source") ================================================================================================================================================================== This defines the internal representation of a rectangular region---a box---for rendering, as well as logic for transforming these boxes. Boxes live on a coordinate plane. The y-axis is inverted so that the y values increase as the box's height grows. ``` --------------> x | | \_\_\_\_\_\_\_\_ | | | | |\_\_\_\_\_\_| v y ``` A `Box` struct stores the coordinates for two corners of the box---the top-left and bottom-right corners--from which the remaining attributes (height, width, other corners) can be computed. ``` \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ | | | A | | | | | | | | B | |\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_| A: top-left corner, e.g. (0, 0) B: bottom-right corner, e.g. (10, 10) ``` For rendering purposes, the outermost box will typically have a top-left corner (0, 0) and a bottom-right corner (x, y) where x is the number of rows and y is the number of columns on the terminal. This outermost box can then be subdivided as necessary to render different elements of the view. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [bottom\_left(box)](#bottom_left/1) [bottom\_right(box)](#bottom_right/1) [consume(box, dx, dy)](#consume/3) [contains?(box, position)](#contains?/2) [from\_dimensions(width, height, origin \\ %Position{x: 0, y: 0})](#from_dimensions/3) [head(box, n)](#head/2) Given a box, returns a slice of the y axis with `n` rows from the top. [height(box)](#height/1) [padded(box, size)](#padded/2) [positions(box)](#positions/1) [tail(box, n)](#tail/2) Given a box, returns a slice of the y axis with `n` rows from the bottom. [top\_left(box)](#top_left/1) [top\_right(box)](#top_right/1) [translate(box, dx, dy)](#translate/3) [width(box)](#width/1) [Link to this section](#functions) Functions ============================================= [Link to this function](#bottom_left/1 "Link to this function") bottom\_left(box) ================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/box.ex#L111 "View Source") [Link to this function](#bottom_right/1 "Link to this function") bottom\_right(box) ================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/box.ex#L114 "View Source") [Link to this function](#consume/3 "Link to this function") consume(box, dx, dy) ==================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/box.ex#L61 "View Source") [Link to this function](#contains?/2 "Link to this function") contains?(box, position) ======================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/box.ex#L122 "View Source") [Link to this function](#from_dimensions/3 "Link to this function") from\_dimensions(width, height, origin \\ %Position{x: 0, y: 0}) ================================================================ [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/box.ex#L132 "View Source") [Link to this function](#head/2 "Link to this function") head(box, n) ============ [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/box.ex#L89 "View Source") Given a box, returns a slice of the y axis with `n` rows from the top. [Link to this function](#height/1 "Link to this function") height(box) =========== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/box.ex#L119 "View Source") [Link to this function](#padded/2 "Link to this function") padded(box, size) ================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/box.ex#L72 "View Source") [Link to this function](#positions/1 "Link to this function") positions(box) ============== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/box.ex#L79 "View Source") [Link to this function](#tail/2 "Link to this function") tail(box, n) ============ [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/box.ex#L99 "View Source") Given a box, returns a slice of the y axis with `n` rows from the bottom. [Link to this function](#top_left/1 "Link to this function") top\_left(box) ============== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/box.ex#L106 "View Source") [Link to this function](#top_right/1 "Link to this function") top\_right(box) =============== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/box.ex#L108 "View Source") [Link to this function](#translate/3 "Link to this function") translate(box, dx, dy) ====================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/box.ex#L47 "View Source") [Link to this function](#width/1 "Link to this function") width(box) ========== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/box.ex#L116 "View Source") Ratatouille.Renderer.Canvas β€” Ratatouille v0.5.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Ratatouille v0.5.1 Ratatouille.Renderer.Canvas [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/canvas.ex#L1 "View Source") ======================================================================================================================================================================== A canvas represents a terminal window, a subvision of it for rendering, and a sparse mapping of positions to cells. A `%Canvas{}` struct can be rendered to different output formats. This includes the primary use-case of rendering to the termbox-managed window, but also rendering to strings, which is useful for testing. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [consume(canvas, dx, dy)](#consume/3) Copies the canvas to a new one with the render box consumed by the given `dx` and `dy`. [consume\_columns(canvas, n)](#consume_columns/2) Creates a new canvas with `n` columns (from the left) consumed. [consume\_rows(canvas, n)](#consume_rows/2) Creates a new canvas with `n` rows (from the top) consumed. [fill\_background(canvas)](#fill_background/1) [from\_dimensions(x, y)](#from_dimensions/2) Creates an empty canvas with the given dimensions. [merge\_cells(canvas, cells)](#merge_cells/2) Merges a list of cells into the canvas, provided that the cells are located within the canvas's rendering box. Returns a new canvas with the merged cells. [padded(canvas, size)](#padded/2) Copies the canvas to a new one with the render box padded on each side (top, left, bottom, right) by `size`. Pass a negative size to remove padding. [put\_box(canvas, render\_box)](#put_box/2) [render\_to\_string(canvas)](#render_to_string/1) [render\_to\_strings(canvas)](#render_to_strings/1) [render\_to\_termbox(bindings, canvas)](#render_to_termbox/2) [translate(canvas, dx, dy)](#translate/3) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/canvas.ex#L16 "View Source") ``` t() :: %Ratatouille.Renderer.Canvas{ cells: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), outer_box: [Ratatouille.Renderer.Box.t](Ratatouille.Renderer.Box.html#t:t/0)(), render_box: [Ratatouille.Renderer.Box.t](Ratatouille.Renderer.Box.html#t:t/0)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#consume/3 "Link to this function") consume(canvas, dx, dy) ======================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/canvas.ex#L86 "View Source") ``` consume([t](#t:t/0)(), [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [t](#t:t/0)() ``` Copies the canvas to a new one with the render box consumed by the given `dx` and `dy`. The render box is used to indicate the empty, renderable space on the canvas, so this might be called with a `dy` of 1 after rendering a line of text. The box is consumed left-to-right and top-to-bottom. [Link to this function](#consume_columns/2 "Link to this function") consume\_columns(canvas, n) =========================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/canvas.ex#L100 "View Source") ``` consume_columns([t](#t:t/0)(), [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [t](#t:t/0)() ``` Creates a new canvas with `n` columns (from the left) consumed. [Link to this function](#consume_rows/2 "Link to this function") consume\_rows(canvas, n) ======================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/canvas.ex#L94 "View Source") ``` consume_rows([t](#t:t/0)(), [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [t](#t:t/0)() ``` Creates a new canvas with `n` rows (from the top) consumed. [Link to this function](#fill_background/1 "Link to this function") fill\_background(canvas) ======================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/canvas.ex#L57 "View Source") [Link to this function](#from_dimensions/2 "Link to this function") from\_dimensions(x, y) ====================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/canvas.ex#L43 "View Source") ``` from_dimensions([non\_neg\_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [non\_neg\_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [t](#t:t/0)() ``` Creates an empty canvas with the given dimensions. Examples ----------- ``` iex> Canvas.from\_dimensions(10, 20) %Canvas{ outer\_box: %Ratatouille.Renderer.Box{ top\_left: %ExTermbox.Position{x: 0, y: 0}, bottom\_right: %ExTermbox.Position{x: 9, y: 19} }, render\_box: %Ratatouille.Renderer.Box{ top\_left: %ExTermbox.Position{x: 0, y: 0}, bottom\_right: %ExTermbox.Position{x: 9, y: 19} }, cells: %{} } ``` [Link to this function](#merge_cells/2 "Link to this function") merge\_cells(canvas, cells) =========================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/canvas.ex#L107 "View Source") ``` merge_cells([t](#t:t/0)(), [[ExTermbox.Cell.t](https://hexdocs.pm/ex_termbox/1.0.2/ExTermbox.Cell.html#t:t/0)()]) :: [t](#t:t/0)() ``` Merges a list of cells into the canvas, provided that the cells are located within the canvas's rendering box. Returns a new canvas with the merged cells. [Link to this function](#padded/2 "Link to this function") padded(canvas, size) ==================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/canvas.ex#L73 "View Source") ``` padded([t](#t:t/0)(), [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [t](#t:t/0)() ``` Copies the canvas to a new one with the render box padded on each side (top, left, bottom, right) by `size`. Pass a negative size to remove padding. [Link to this function](#put_box/2 "Link to this function") put\_box(canvas, render\_box) ============================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/canvas.ex#L51 "View Source") ``` put_box([t](#t:t/0)(), [Ratatouille.Renderer.Box.t](Ratatouille.Renderer.Box.html#t:t/0)()) :: [t](#t:t/0)() ``` [Link to this function](#render_to_string/1 "Link to this function") render\_to\_string(canvas) ========================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/canvas.ex#L151 "View Source") ``` render_to_string([t](#t:t/0)()) :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` [Link to this function](#render_to_strings/1 "Link to this function") render\_to\_strings(canvas) =========================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/canvas.ex#L126 "View Source") ``` render_to_strings([t](#t:t/0)()) :: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] ``` [Link to this function](#render_to_termbox/2 "Link to this function") render\_to\_termbox(bindings, canvas) ===================================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/canvas.ex#L155 "View Source") ``` render_to_termbox([module](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [t](#t:t/0)()) :: :ok ``` [Link to this function](#translate/3 "Link to this function") translate(canvas, dx, dy) ========================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/canvas.ex#L121 "View Source") ``` translate([t](#t:t/0)(), [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [t](#t:t/0)() ``` Ratatouille.Renderer.Cells β€” Ratatouille v0.5.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Ratatouille v0.5.1 Ratatouille.Renderer.Cells [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/cells.ex#L1 "View Source") ====================================================================================================================================================================== Functions for working with canvas cells. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [background(attrs)](#background/1) Computes a cell's background given a standardized attributes map. [foreground(attrs)](#foreground/1) Computes a cell's foreground given a standardized attributes map. [generator(position, orientation, template \\ Cell.empty())](#generator/3) Given a starting position, orientation and cell template, returns a cell generator which can be used to iteratively generate a row or column of cells. [Link to this section](#functions) Functions ============================================= [Link to this function](#background/1 "Link to this function") background(attrs) ================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/cells.ex#L32 "View Source") Computes a cell's background given a standardized attributes map. [Link to this function](#foreground/1 "Link to this function") foreground(attrs) ================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/cells.ex#L18 "View Source") Computes a cell's foreground given a standardized attributes map. The foreground value is computed by taking the color's integer value and the integer values of any styling attributes (e.g., bold, underline) and computing the bitwise OR of all the values. [Link to this function](#generator/3 "Link to this function") generator(position, orientation, template \\ Cell.empty()) ========================================================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/cells.ex#L40 "View Source") Given a starting position, orientation and cell template, returns a cell generator which can be used to iteratively generate a row or column of cells. Ratatouille.Renderer.Line β€” Ratatouille v0.5.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Ratatouille v0.5.1 Ratatouille.Renderer.Line [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/line.ex#L1 "View Source") ==================================================================================================================================================================== Primitives for rendering lines [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [render(canvas, orientation, position, ch, len)](#render/5) [render\_horizontal(canvas, position, ch, len)](#render_horizontal/4) [render\_vertical(canvas, position, ch, len)](#render_vertical/4) [Link to this section](#functions) Functions ============================================= [Link to this function](#render/5 "Link to this function") render(canvas, orientation, position, ch, len) ============================================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/line.ex#L15 "View Source") [Link to this function](#render_horizontal/4 "Link to this function") render\_horizontal(canvas, position, ch, len) ============================================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/line.ex#L9 "View Source") [Link to this function](#render_vertical/4 "Link to this function") render\_vertical(canvas, position, ch, len) =========================================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/line.ex#L12 "View Source") Ratatouille.Renderer.Text β€” Ratatouille v0.5.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Ratatouille v0.5.1 Ratatouille.Renderer.Text [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/text.ex#L1 "View Source") ==================================================================================================================================================================== Primitives for rendering text [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [render(canvas, position, text, attrs \\ %{})](#render/4) [render\_group(canvas, text\_elements, attrs \\ %{})](#render_group/3) [Link to this section](#functions) Functions ============================================= [Link to this function](#render/4 "Link to this function") render(canvas, position, text, attrs \\ %{}) ============================================ [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/text.ex#L9 "View Source") [Link to this function](#render_group/3 "Link to this function") render\_group(canvas, text\_elements, attrs \\ %{}) =================================================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/renderer/text.ex#L23 "View Source") Ratatouille.Runtime β€” Ratatouille v0.5.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Ratatouille v0.5.1 Ratatouille.Runtime [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/runtime.ex#L1 "View Source") ======================================================================================================================================================== A runtime for apps implementing the [`Ratatouille.App`](Ratatouille.App.html) behaviour. See [`Ratatouille.App`](Ratatouille.App.html) for details on how to build apps. Runtime Context ------------------ The runtime provides a map with additional context to the app's [`Ratatouille.App.init/1`](Ratatouille.App.html#c:init/1) callback. This can be used, for example, to get information about the terminal window. Currently, the following attributes are provided via the map: * `:window`: A map with `:height` and `:width` keys. Shutdown Options ------------------- When a quit event is received (by default, "q", "Q" or ctrl-c), the runtime will carry out the configured shutdown strategy. The default strategy (`:self`) just stops the runtime process itself. In certain cases, it may be desirable to stop an OTP application or the system itself, so a few other strategies are provided: * `:supervisor` - Stops the runtime supervisor, which will terminate the runtime process and other dependencies. The VM will still be running afterwards unless stopped by other means. * `{:application, name}` - Stops the named application. The VM will still be running afterwards unless stopped by other means. * `:system`: Gracefully stops the system (calls [`:init.stop/0`](http://www.erlang.org/doc/man/init.html#stop-0)). Gracefully shutting down the VM ensures that all applications are stopped. There will be some lag between sending the quit event and the OS process actually exiting, as the VM needs about a second to stop this way. See the note below if this is a problem. If the `:system` option is too slow, it's possible to halt the system manually with [`System.halt/0`](https://hexdocs.pm/elixir/System.html#halt/0). It's just important to ensure that the system is only halted after the terminal was restored to its original state. Otherwise, there may be rendering artifacts or issues with the cursor. The `:supervisor` option can be used to properly halt the system by monitoring the runtime supervisor and halting once it has exited. Alternatively, use the `:application` option to stop an application that runs the runtime supervisor and halt in the application's `stop/1` callback. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [child\_spec(arg)](#child_spec/1) Returns a specification to start this module under a supervisor. [run(state)](#run/1) [start\_link(config)](#start_link/1) Starts the application runtime given a module defining a Ratatouille terminal application. [Link to this section](#functions) Functions ============================================= [Link to this function](#child_spec/1 "Link to this function") child\_spec(arg) ================ [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/runtime.ex#L44 "View Source") Returns a specification to start this module under a supervisor. `arg` is passed as the argument to [`Task.start_link/1`](https://hexdocs.pm/elixir/Task.html#start_link/1) in the `:start` field of the spec. For more information, see the [`Supervisor`](https://hexdocs.pm/elixir/Supervisor.html) module, the [`Supervisor.child_spec/2`](https://hexdocs.pm/elixir/Supervisor.html#child_spec/2) function and the [`Supervisor.child_spec/0`](https://hexdocs.pm/elixir/Supervisor.html#t:child_spec/0) type. [Link to this function](#run/1 "Link to this function") run(state) ========== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/runtime.ex#L97 "View Source") ``` run([Ratatouille.Runtime.State.t](Ratatouille.Runtime.State.html#t:t/0)()) :: :ok ``` [Link to this function](#start_link/1 "Link to this function") start\_link(config) =================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/runtime.ex#L82 "View Source") ``` start_link([Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: {:ok, [pid](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` Starts the application runtime given a module defining a Ratatouille terminal application. Configuration ---------------- * `:app` (required) - The [`Ratatouille.App`](Ratatouille.App.html) to run. * `:shutdown` - The strategy for stopping the terminal application when a quit event is received. * `:interval` - The runtime loop interval in milliseconds. The default interval is 500 ms. A subscription can be fulfilled at most once every interval, so this effectively configures the maximum subscription resolution that's possible. * `:quit_events` - Specifies the events that should quit the terminal application. Given as a list of tuples conforming where each tuple conforms to either `{:ch, ch}` or `{:key, key}`. If not specified, ctrl-c and q / Q can be used to quit the application by default. Ratatouille.Runtime.Command β€” Ratatouille v0.5.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Ratatouille v0.5.1 Ratatouille.Runtime.Command [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/runtime/command.ex#L1 "View Source") ======================================================================================================================================================================== Commands provide a way to start an expensive call in the background and get the result back via [`Ratatouille.App.update/2`](Ratatouille.App.html#c:update/2). Commands should be constructed via the functions below and not via the struct directly, as this is internal and subject to change. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [batch(cmds)](#batch/1) Returns a batch command given a list of commands. This simply provides a way to return multiple commands as a single one. Batch commands should not depend on one another---Ratatouille's runtime may run some or all of them in parallel and doesn't guarantee any particular order of execution. [new(func, message)](#new/2) Returns a new command that can be returned in the [`Ratatouille.App.update/2`](Ratatouille.App.html#c:update/2) or [`Ratatouille.App.init/1`](Ratatouille.App.html#c:init/1) callbacks. [Link to this section](#types) Types ===================================== [Link to this opaque](#t:t/0 "Link to this opaque") t() === [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/runtime/command.ex#L18 "View Source") (opaque) ``` t() ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#batch/1 "Link to this function") batch(cmds) =========== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/runtime/command.ex#L50 "View Source") ``` batch([[t](#t:t/0)()]) :: [t](#t:t/0)() ``` Returns a batch command given a list of commands. This simply provides a way to return multiple commands as a single one. Batch commands should not depend on one another---Ratatouille's runtime may run some or all of them in parallel and doesn't guarantee any particular order of execution. Dependencies should be expressed via a single command or a sequence of commands orchestrated via the application model state. [Link to this function](#new/2 "Link to this function") new(func, message) ================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/runtime/command.ex#L34 "View Source") ``` new((() -> [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [t](#t:t/0)() ``` Returns a new command that can be returned in the [`Ratatouille.App.update/2`](Ratatouille.App.html#c:update/2) or [`Ratatouille.App.init/1`](Ratatouille.App.html#c:init/1) callbacks. Takes an anonymous function and a message. The message is used to send a response back to your app along with the result. It can be any Erlang term, so it's also possible to include identifiers (e.g., `{:finished, id}`). Ratatouille.Runtime.State β€” Ratatouille v0.5.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Ratatouille v0.5.1 Ratatouille.Runtime.State [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/runtime/state.ex#L1 "View Source") ==================================================================================================================================================================== Defines a struct to store the runtime loop's state. Ratatouille.Runtime.Subscription β€” Ratatouille v0.5.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Ratatouille v0.5.1 Ratatouille.Runtime.Subscription [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/runtime/subscription.ex#L1 "View Source") ================================================================================================================================================================================== Subscriptions provide a way for the app to be notified via [`Ratatouille.App.update/2`](Ratatouille.App.html#c:update/2) when something interesting happens. Subscriptions should be constructed via the functions below and not via the struct directly, as this is internal and subject to change. Currently, it's possible to subscribe to time intervals ([`interval/2`](#interval/2)) and to create batch subscriptions (i.e., multiple time intervals). More subscription types may be introduced later. ### Accuracy of Time Intervals Ratatouille's runtime loop, which handles subscriptions, runs on a interval itself (by default, every 500 ms). This means that the runtime loop is the minimum possible subscription interval. If a subscription's interval is more frequent than the runtime loop interval, the runtime loop interval is the subscription's effective interval. There is also no guarantee that subscriptions will be processed on time, as the runtime may be busy with other tasks (e.g., handling events or rendering). With that said, if care is taken to keep expensive calls out of the runtime loop, subscriptions should be processed very close to requested interval. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [batch(subs)](#batch/1) Creates a batch subscription from a list of subscriptions. [interval(ms, message)](#interval/2) Returns a subscription based on a time interval. Takes the number of milliseconds (`ms`) and a message as arguments. When returned in the [`Ratatouille.App.subscribe/1`](Ratatouille.App.html#c:subscribe/1) callback, the runtime will call the [`Ratatouille.App.update/2`](Ratatouille.App.html#c:update/2) function with current model and the message, on approximately the given interval. See above for details on what "approximately" means here. [Link to this section](#types) Types ===================================== [Link to this opaque](#t:t/0 "Link to this opaque") t() === [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/runtime/subscription.ex#L32 "View Source") (opaque) ``` t() ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#batch/1 "Link to this function") batch(subs) =========== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/runtime/subscription.ex#L60 "View Source") ``` batch([[t](#t:t/0)()]) :: [t](#t:t/0)() ``` Creates a batch subscription from a list of subscriptions. This provides a way to subscribe to multiple things, while still returning a single subscription in [`Ratatouille.App.subscribe/1`](Ratatouille.App.html#c:subscribe/1). [Link to this function](#interval/2 "Link to this function") interval(ms, message) ===================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/runtime/subscription.ex#L47 "View Source") ``` interval([non\_neg\_integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [t](#t:t/0)() ``` Returns a subscription based on a time interval. Takes the number of milliseconds (`ms`) and a message as arguments. When returned in the [`Ratatouille.App.subscribe/1`](Ratatouille.App.html#c:subscribe/1) callback, the runtime will call the [`Ratatouille.App.update/2`](Ratatouille.App.html#c:update/2) function with current model and the message, on approximately the given interval. See above for details on what "approximately" means here. Ratatouille.Runtime.Supervisor β€” Ratatouille v0.5.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Ratatouille v0.5.1 Ratatouille.Runtime.Supervisor [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/runtime/supervisor.ex#L1 "View Source") ============================================================================================================================================================================== A supervisor to run the application runtime and its dependencies. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [child\_spec(init\_arg)](#child_spec/1) Returns a specification to start this module under a supervisor. [start\_link(opts \\ [])](#start_link/1) Starts a supervisor that manages [`Ratatouille.Runtime`](Ratatouille.Runtime.html), along with runtime dependencies [`Ratatouille.EventManager`](Ratatouille.EventManager.html) and [`Ratatouille.Window`](Ratatouille.Window.html). [Link to this section](#functions) Functions ============================================= [Link to this function](#child_spec/1 "Link to this function") child\_spec(init\_arg) ====================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/runtime/supervisor.ex#L6 "View Source") Returns a specification to start this module under a supervisor. See [`Supervisor`](https://hexdocs.pm/elixir/Supervisor.html). [Link to this function](#start_link/1 "Link to this function") start\_link(opts \\ []) ======================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/runtime/supervisor.ex#L21 "View Source") ``` start_link([Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: {:ok, [pid](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} | :ignore | {:error, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` Starts a supervisor that manages [`Ratatouille.Runtime`](Ratatouille.Runtime.html), along with runtime dependencies [`Ratatouille.EventManager`](Ratatouille.EventManager.html) and [`Ratatouille.Window`](Ratatouille.Window.html). Options ---------- * `:runtime` - Options for the runtime. See [`Ratatouille.Runtime.start_link/1`](Ratatouille.Runtime.html#start_link/1). Ratatouille.View β€” Ratatouille v0.5.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Ratatouille v0.5.1 Ratatouille.View [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L1 "View Source") ================================================================================================================================================== In Ratatouille, a view is simply a tree of elements. Each element in the tree holds an attributes map and a list of zero or more child nodes. Visually, it looks like something this: ``` %Element{ tag: :view, attributes: %{}, children: [ %Element{ tag: :row, attributes: %{}, children: [ %Element{tag: :column, attributes: %{size: 4}, children: []}, %Element{tag: :column, attributes: %{size: 4}, children: []}, %Element{tag: :column, attributes: %{size: 4}, children: []} ] } ] } ``` View DSL ----------- Because it's a bit tedious to define views like that, Ratatouille provides a DSL to define them without all the boilerplate. Now we can turn the above into this: ``` view do row do column(size: 4) column(size: 4) column(size: 4) end end ``` While the syntax is more compact, the end result is exactly the same. This expression produces the exact same `%Element{}` struct as defined above. To use the DSL like this, we need to import all the functions: ``` import Ratatouille.View ``` Alternatively, import just the ones you need: ``` import Ratatouille.View, only: [view: 0, row: 0, column: 1] ``` ### Forms All of the possible forms are enumerated below. Element with tag `foo`: ``` foo() ``` Element with tag `foo` and attributes: ``` foo(size: 42) ``` Element with tag `foo` and children as list: ``` foo([ bar() ]) ``` Element with tag `foo` and children as block: ``` foo do bar() end ``` Element with tag `foo`, attributes, and children as list: ``` foo( [size: 42], [bar()] ) ``` Element with tag `foo`, attributes, and children as block: ``` foo size: 42 do bar() end ``` ### Empty Elements Similar to so-called "empty" HTML elements such as `<br />`, Ratatouille also has elements for which passing content doesn't make sense. For example, the leaf node `text` stores its content in its attributes and cannot have any child elements of its own. In such cases, the block and list forms are unsupported. ### Validation While some errors---such as passing children to empty elements---are prevented by the DSL, it's still possible (for now, at least) to build semantically-invalid element trees using the DSL. This means that the elements are being used in a way that doesn't make sense to the renderer. In order to prevent cryptic rendering errors, the renderer first validates the element tree it's given and rejects the whole thing if the structure is unsupported. It currently checks the following things: * The top-level element passed to the renderer must have the `:view` tag. * A parent element may only have child elements that have one of the supported child tags for the parent element. * An element must define all of its required attributes and may not define any unknown attributes. The last two rules are based on the element's specification in `Ratatouille.Renderer.Element`. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [bar()](#bar/0) Defines an element with the `:bar` tag. [bar(attributes\_or\_children)](#bar/1) Defines an element with the `:bar` tag and either [bar(attributes, children)](#bar/2) Defines an element with the `:bar` tag and the given attributes and child elements. [canvas()](#canvas/0) Defines an element with the `:canvas` tag. [canvas(attributes\_or\_children)](#canvas/1) Defines an element with the `:canvas` tag and either [canvas(attributes, children)](#canvas/2) Defines an element with the `:canvas` tag and the given attributes and child elements. [canvas\_cell()](#canvas_cell/0) Defines an element with the `:canvas_cell` tag. [canvas\_cell(attributes)](#canvas_cell/1) Defines an element with the `:canvas_cell` tag and the given attributes. [chart()](#chart/0) Defines an element with the `:chart` tag. [chart(attributes)](#chart/1) Defines an element with the `:chart` tag and the given attributes. [column()](#column/0) Defines an element with the `:column` tag. [column(attributes\_or\_children)](#column/1) Defines an element with the `:column` tag and either [column(attributes, children)](#column/2) Defines an element with the `:column` tag and the given attributes and child elements. [element(tag, attributes\_or\_children)](#element/2) [element(tag, attributes, children)](#element/3) [label()](#label/0) Defines an element with the `:label` tag. [label(attributes\_or\_children)](#label/1) Defines an element with the `:label` tag and either [label(attributes, children)](#label/2) Defines an element with the `:label` tag and the given attributes and child elements. [overlay()](#overlay/0) Defines an element with the `:overlay` tag. [overlay(attributes\_or\_children)](#overlay/1) Defines an element with the `:overlay` tag and either [overlay(attributes, children)](#overlay/2) Defines an element with the `:overlay` tag and the given attributes and child elements. [panel()](#panel/0) Defines an element with the `:panel` tag. [panel(attributes\_or\_children)](#panel/1) Defines an element with the `:panel` tag and either [panel(attributes, children)](#panel/2) Defines an element with the `:panel` tag and the given attributes and child elements. [row()](#row/0) Defines an element with the `:row` tag. [row(attributes\_or\_children)](#row/1) Defines an element with the `:row` tag and either [row(attributes, children)](#row/2) Defines an element with the `:row` tag and the given attributes and child elements. [sparkline()](#sparkline/0) Defines an element with the `:sparkline` tag. [sparkline(attributes)](#sparkline/1) Defines an element with the `:sparkline` tag and the given attributes. [table()](#table/0) Defines an element with the `:table` tag. [table(attributes\_or\_children)](#table/1) Defines an element with the `:table` tag and either [table(attributes, children)](#table/2) Defines an element with the `:table` tag and the given attributes and child elements. [table\_cell()](#table_cell/0) Defines an element with the `:table_cell` tag. [table\_cell(attributes)](#table_cell/1) Defines an element with the `:table_cell` tag and the given attributes. [table\_row()](#table_row/0) Defines an element with the `:table_row` tag. [table\_row(attributes\_or\_children)](#table_row/1) Defines an element with the `:table_row` tag and either [table\_row(attributes, children)](#table_row/2) Defines an element with the `:table_row` tag and the given attributes and child elements. [text()](#text/0) Defines an element with the `:text` tag. [text(attributes)](#text/1) Defines an element with the `:text` tag and the given attributes. [tree()](#tree/0) Defines an element with the `:tree` tag. [tree(attributes\_or\_children)](#tree/1) Defines an element with the `:tree` tag and either [tree(attributes, children)](#tree/2) Defines an element with the `:tree` tag and the given attributes and child elements. [tree\_node()](#tree_node/0) Defines an element with the `:tree_node` tag. [tree\_node(attributes\_or\_children)](#tree_node/1) Defines an element with the `:tree_node` tag and either [tree\_node(attributes, children)](#tree_node/2) Defines an element with the `:tree_node` tag and the given attributes and child elements. [view()](#view/0) Defines an element with the `:view` tag. [view(attributes\_or\_children)](#view/1) Defines an element with the `:view` tag and either [view(attributes, children)](#view/2) Defines an element with the `:view` tag and the given attributes and child elements. [viewport()](#viewport/0) Defines an element with the `:viewport` tag. [viewport(attributes\_or\_children)](#viewport/1) Defines an element with the `:viewport` tag and either [viewport(attributes, children)](#viewport/2) Defines an element with the `:viewport` tag and the given attributes and child elements. [Link to this section](#functions) Functions ============================================= [Link to this macro](#bar/0 "Link to this macro") bar() ===== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L195 "View Source") (macro) Defines an element with the `:bar` tag. Allowed Child Elements ------------------------- * label Examples ----------- Empty element: ``` bar() ``` With a block: ``` bar do # ...child elements... end ``` [Link to this macro](#bar/1 "Link to this macro") bar(attributes\_or\_children) ============================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L199 "View Source") (macro) Defines an element with the `:bar` tag and either: * given attributes and an optional block * a list of child elements Attributes ------------- None Allowed Child Elements ------------------------- * label Examples ----------- Passing attributes: ``` bar(key: value) ``` Passing attributes and a block: ``` bar(key: value) do # ...child elements... end ``` Passing list of children: ``` bar([elem1, elem2]) ``` [Link to this macro](#bar/2 "Link to this macro") bar(attributes, children) ========================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L238 "View Source") (macro) Defines an element with the `:bar` tag and the given attributes and child elements. Attributes ------------- None Allowed Child Elements ------------------------- * label Examples ----------- ``` bar([key: value], [elem1, elem2]) ``` [Link to this macro](#canvas/0 "Link to this macro") canvas() ======== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L195 "View Source") (macro) Defines an element with the `:canvas` tag. Allowed Child Elements ------------------------- * canvas\_cell Examples ----------- Empty element: ``` canvas() ``` With a block: ``` canvas do # ...child elements... end ``` [Link to this macro](#canvas/1 "Link to this macro") canvas(attributes\_or\_children) ================================ [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L199 "View Source") (macro) Defines an element with the `:canvas` tag and either: * given attributes and an optional block * a list of child elements Attributes ------------- * `height` (required) - Integer representing the canvas height * `width` (required) - Integer representing the canvas width Allowed Child Elements ------------------------- * canvas\_cell Examples ----------- Passing attributes: ``` canvas(key: value) ``` Passing attributes and a block: ``` canvas(key: value) do # ...child elements... end ``` Passing list of children: ``` canvas([elem1, elem2]) ``` [Link to this macro](#canvas/2 "Link to this macro") canvas(attributes, children) ============================ [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L238 "View Source") (macro) Defines an element with the `:canvas` tag and the given attributes and child elements. Attributes ------------- * `height` (required) - Integer representing the canvas height * `width` (required) - Integer representing the canvas width Allowed Child Elements ------------------------- * canvas\_cell Examples ----------- ``` canvas([key: value], [elem1, elem2]) ``` [Link to this macro](#canvas_cell/0 "Link to this macro") canvas\_cell() ============== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L273 "View Source") (macro) Defines an element with the `:canvas_cell` tag. Examples ----------- Empty element: ``` canvas\_cell() ``` [Link to this macro](#canvas_cell/1 "Link to this macro") canvas\_cell(attributes) ======================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L288 "View Source") (macro) Defines an element with the `:canvas_cell` tag and the given attributes. Attributes ------------- * `x` (required) - Integer representing the cell's column (zero-indexed) * `y` (required) - Integer representing the cell's row (zero-indexed) * `color` (optional) - Constant representing color to use for foreground * `char` (optional) - Single character to render within this cell * `background` (optional) - Constant representing color to use for background * `attributes` (optional) - Constant representing style attributes to apply Examples ----------- ``` canvas\_cell(key: value) ``` [Link to this macro](#chart/0 "Link to this macro") chart() ======= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L273 "View Source") (macro) Defines an element with the `:chart` tag. Examples ----------- Empty element: ``` chart() ``` [Link to this macro](#chart/1 "Link to this macro") chart(attributes) ================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L288 "View Source") (macro) Defines an element with the `:chart` tag and the given attributes. Attributes ------------- * `series` (required) - List of float or integer values representing the series * `type` (required) - Type of chart to plot. Currently only `:line` is supported * `height` (optional) - Height of the chart in rows Examples ----------- ``` chart(key: value) ``` [Link to this macro](#column/0 "Link to this macro") column() ======== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L195 "View Source") (macro) Defines an element with the `:column` tag. Allowed Child Elements ------------------------- * canvas * chart * label * panel * row * sparkline * table * tree * viewport Examples ----------- Empty element: ``` column() ``` With a block: ``` column do # ...child elements... end ``` [Link to this macro](#column/1 "Link to this macro") column(attributes\_or\_children) ================================ [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L199 "View Source") (macro) Defines an element with the `:column` tag and either: * given attributes and an optional block * a list of child elements Attributes ------------- * `size` (required) - Number of units on the grid that the column should occupy Allowed Child Elements ------------------------- * canvas * chart * label * panel * row * sparkline * table * tree * viewport Examples ----------- Passing attributes: ``` column(key: value) ``` Passing attributes and a block: ``` column(key: value) do # ...child elements... end ``` Passing list of children: ``` column([elem1, elem2]) ``` [Link to this macro](#column/2 "Link to this macro") column(attributes, children) ============================ [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L238 "View Source") (macro) Defines an element with the `:column` tag and the given attributes and child elements. Attributes ------------- * `size` (required) - Number of units on the grid that the column should occupy Allowed Child Elements ------------------------- * canvas * chart * label * panel * row * sparkline * table * tree * viewport Examples ----------- ``` column([key: value], [elem1, elem2]) ``` [Link to this function](#element/2 "Link to this function") element(tag, attributes\_or\_children) ====================================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L120 "View Source") [Link to this function](#element/3 "Link to this function") element(tag, attributes, children) ================================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L127 "View Source") [Link to this macro](#label/0 "Link to this macro") label() ======= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L195 "View Source") (macro) Defines an element with the `:label` tag. Allowed Child Elements ------------------------- * text Examples ----------- Empty element: ``` label() ``` With a block: ``` label do # ...child elements... end ``` [Link to this macro](#label/1 "Link to this macro") label(attributes\_or\_children) =============================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L199 "View Source") (macro) Defines an element with the `:label` tag and either: * given attributes and an optional block * a list of child elements Attributes ------------- * `content` (optional) - Binary containing the text content to be displayed * `color` (optional) - Constant representing color to use for foreground * `background` (optional) - Constant representing color to use for background * `attributes` (optional) - Constant representing style attributes to apply * `wrap` (optional) - Boolean indicating whether or not to wrap lines to fit available space Allowed Child Elements ------------------------- * text Examples ----------- Passing attributes: ``` label(key: value) ``` Passing attributes and a block: ``` label(key: value) do # ...child elements... end ``` Passing list of children: ``` label([elem1, elem2]) ``` [Link to this macro](#label/2 "Link to this macro") label(attributes, children) =========================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L238 "View Source") (macro) Defines an element with the `:label` tag and the given attributes and child elements. Attributes ------------- * `content` (optional) - Binary containing the text content to be displayed * `color` (optional) - Constant representing color to use for foreground * `background` (optional) - Constant representing color to use for background * `attributes` (optional) - Constant representing style attributes to apply * `wrap` (optional) - Boolean indicating whether or not to wrap lines to fit available space Allowed Child Elements ------------------------- * text Examples ----------- ``` label([key: value], [elem1, elem2]) ``` [Link to this macro](#overlay/0 "Link to this macro") overlay() ========= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L195 "View Source") (macro) Defines an element with the `:overlay` tag. Allowed Child Elements ------------------------- * canvas * chart * label * panel * row * sparkline * table * tree * viewport Examples ----------- Empty element: ``` overlay() ``` With a block: ``` overlay do # ...child elements... end ``` [Link to this macro](#overlay/1 "Link to this macro") overlay(attributes\_or\_children) ================================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L199 "View Source") (macro) Defines an element with the `:overlay` tag and either: * given attributes and an optional block * a list of child elements Attributes ------------- * `padding` (optional) - Integer number of units of padding Allowed Child Elements ------------------------- * canvas * chart * label * panel * row * sparkline * table * tree * viewport Examples ----------- Passing attributes: ``` overlay(key: value) ``` Passing attributes and a block: ``` overlay(key: value) do # ...child elements... end ``` Passing list of children: ``` overlay([elem1, elem2]) ``` [Link to this macro](#overlay/2 "Link to this macro") overlay(attributes, children) ============================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L238 "View Source") (macro) Defines an element with the `:overlay` tag and the given attributes and child elements. Attributes ------------- * `padding` (optional) - Integer number of units of padding Allowed Child Elements ------------------------- * canvas * chart * label * panel * row * sparkline * table * tree * viewport Examples ----------- ``` overlay([key: value], [elem1, elem2]) ``` [Link to this macro](#panel/0 "Link to this macro") panel() ======= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L195 "View Source") (macro) Defines an element with the `:panel` tag. Allowed Child Elements ------------------------- * canvas * chart * label * panel * row * sparkline * table * tree * viewport Examples ----------- Empty element: ``` panel() ``` With a block: ``` panel do # ...child elements... end ``` [Link to this macro](#panel/1 "Link to this macro") panel(attributes\_or\_children) =============================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L199 "View Source") (macro) Defines an element with the `:panel` tag and either: * given attributes and an optional block * a list of child elements Attributes ------------- * `color` (optional) - Color of title * `background` (optional) - Background of title * `attributes` (optional) - Attributes for the title * `padding` (optional) - Integer providing inner padding to use when rendering child elements * `height` (optional) - Height of the table in rows or `:fill` to fill the parent container's box * `title` (optional) - Binary containing the title for the panel Allowed Child Elements ------------------------- * canvas * chart * label * panel * row * sparkline * table * tree * viewport Examples ----------- Passing attributes: ``` panel(key: value) ``` Passing attributes and a block: ``` panel(key: value) do # ...child elements... end ``` Passing list of children: ``` panel([elem1, elem2]) ``` [Link to this macro](#panel/2 "Link to this macro") panel(attributes, children) =========================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L238 "View Source") (macro) Defines an element with the `:panel` tag and the given attributes and child elements. Attributes ------------- * `color` (optional) - Color of title * `background` (optional) - Background of title * `attributes` (optional) - Attributes for the title * `padding` (optional) - Integer providing inner padding to use when rendering child elements * `height` (optional) - Height of the table in rows or `:fill` to fill the parent container's box * `title` (optional) - Binary containing the title for the panel Allowed Child Elements ------------------------- * canvas * chart * label * panel * row * sparkline * table * tree * viewport Examples ----------- ``` panel([key: value], [elem1, elem2]) ``` [Link to this macro](#row/0 "Link to this macro") row() ===== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L195 "View Source") (macro) Defines an element with the `:row` tag. Allowed Child Elements ------------------------- * column Examples ----------- Empty element: ``` row() ``` With a block: ``` row do # ...child elements... end ``` [Link to this macro](#row/1 "Link to this macro") row(attributes\_or\_children) ============================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L199 "View Source") (macro) Defines an element with the `:row` tag and either: * given attributes and an optional block * a list of child elements Attributes ------------- None Allowed Child Elements ------------------------- * column Examples ----------- Passing attributes: ``` row(key: value) ``` Passing attributes and a block: ``` row(key: value) do # ...child elements... end ``` Passing list of children: ``` row([elem1, elem2]) ``` [Link to this macro](#row/2 "Link to this macro") row(attributes, children) ========================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L238 "View Source") (macro) Defines an element with the `:row` tag and the given attributes and child elements. Attributes ------------- None Allowed Child Elements ------------------------- * column Examples ----------- ``` row([key: value], [elem1, elem2]) ``` [Link to this macro](#sparkline/0 "Link to this macro") sparkline() =========== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L273 "View Source") (macro) Defines an element with the `:sparkline` tag. Examples ----------- Empty element: ``` sparkline() ``` [Link to this macro](#sparkline/1 "Link to this macro") sparkline(attributes) ===================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L288 "View Source") (macro) Defines an element with the `:sparkline` tag and the given attributes. Attributes ------------- * `series` (required) - List of float or integer values representing the series Examples ----------- ``` sparkline(key: value) ``` [Link to this macro](#table/0 "Link to this macro") table() ======= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L195 "View Source") (macro) Defines an element with the `:table` tag. Allowed Child Elements ------------------------- * table\_row Examples ----------- Empty element: ``` table() ``` With a block: ``` table do # ...child elements... end ``` [Link to this macro](#table/1 "Link to this macro") table(attributes\_or\_children) =============================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L199 "View Source") (macro) Defines an element with the `:table` tag and either: * given attributes and an optional block * a list of child elements Attributes ------------- None Allowed Child Elements ------------------------- * table\_row Examples ----------- Passing attributes: ``` table(key: value) ``` Passing attributes and a block: ``` table(key: value) do # ...child elements... end ``` Passing list of children: ``` table([elem1, elem2]) ``` [Link to this macro](#table/2 "Link to this macro") table(attributes, children) =========================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L238 "View Source") (macro) Defines an element with the `:table` tag and the given attributes and child elements. Attributes ------------- None Allowed Child Elements ------------------------- * table\_row Examples ----------- ``` table([key: value], [elem1, elem2]) ``` [Link to this macro](#table_cell/0 "Link to this macro") table\_cell() ============= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L273 "View Source") (macro) Defines an element with the `:table_cell` tag. Examples ----------- Empty element: ``` table\_cell() ``` [Link to this macro](#table_cell/1 "Link to this macro") table\_cell(attributes) ======================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L288 "View Source") (macro) Defines an element with the `:table_cell` tag and the given attributes. Attributes ------------- * `content` (required) - Binary containing the text content to be displayed * `color` (optional) - Constant representing color to use for foreground * `background` (optional) - Constant representing color to use for background * `attributes` (optional) - Constant representing style attributes to apply Examples ----------- ``` table\_cell(key: value) ``` [Link to this macro](#table_row/0 "Link to this macro") table\_row() ============ [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L195 "View Source") (macro) Defines an element with the `:table_row` tag. Allowed Child Elements ------------------------- * table\_cell Examples ----------- Empty element: ``` table\_row() ``` With a block: ``` table\_row do # ...child elements... end ``` [Link to this macro](#table_row/1 "Link to this macro") table\_row(attributes\_or\_children) ==================================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L199 "View Source") (macro) Defines an element with the `:table_row` tag and either: * given attributes and an optional block * a list of child elements Attributes ------------- * `color` (optional) - Constant representing color to use for foreground * `background` (optional) - Constant representing color to use for background * `attributes` (optional) - Constant representing style attributes to apply Allowed Child Elements ------------------------- * table\_cell Examples ----------- Passing attributes: ``` table\_row(key: value) ``` Passing attributes and a block: ``` table\_row(key: value) do # ...child elements... end ``` Passing list of children: ``` table\_row([elem1, elem2]) ``` [Link to this macro](#table_row/2 "Link to this macro") table\_row(attributes, children) ================================ [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L238 "View Source") (macro) Defines an element with the `:table_row` tag and the given attributes and child elements. Attributes ------------- * `color` (optional) - Constant representing color to use for foreground * `background` (optional) - Constant representing color to use for background * `attributes` (optional) - Constant representing style attributes to apply Allowed Child Elements ------------------------- * table\_cell Examples ----------- ``` table\_row([key: value], [elem1, elem2]) ``` [Link to this macro](#text/0 "Link to this macro") text() ====== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L273 "View Source") (macro) Defines an element with the `:text` tag. Examples ----------- Empty element: ``` text() ``` [Link to this macro](#text/1 "Link to this macro") text(attributes) ================ [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L288 "View Source") (macro) Defines an element with the `:text` tag and the given attributes. Attributes ------------- * `content` (required) - Binary containing the text content to be displayed * `color` (optional) - Constant representing color to use for foreground * `background` (optional) - Constant representing color to use for background * `attributes` (optional) - Constant representing style attributes to apply Examples ----------- ``` text(key: value) ``` [Link to this macro](#tree/0 "Link to this macro") tree() ====== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L195 "View Source") (macro) Defines an element with the `:tree` tag. Allowed Child Elements ------------------------- * tree\_node Examples ----------- Empty element: ``` tree() ``` With a block: ``` tree do # ...child elements... end ``` [Link to this macro](#tree/1 "Link to this macro") tree(attributes\_or\_children) ============================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L199 "View Source") (macro) Defines an element with the `:tree` tag and either: * given attributes and an optional block * a list of child elements Attributes ------------- None Allowed Child Elements ------------------------- * tree\_node Examples ----------- Passing attributes: ``` tree(key: value) ``` Passing attributes and a block: ``` tree(key: value) do # ...child elements... end ``` Passing list of children: ``` tree([elem1, elem2]) ``` [Link to this macro](#tree/2 "Link to this macro") tree(attributes, children) ========================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L238 "View Source") (macro) Defines an element with the `:tree` tag and the given attributes and child elements. Attributes ------------- None Allowed Child Elements ------------------------- * tree\_node Examples ----------- ``` tree([key: value], [elem1, elem2]) ``` [Link to this macro](#tree_node/0 "Link to this macro") tree\_node() ============ [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L195 "View Source") (macro) Defines an element with the `:tree_node` tag. Allowed Child Elements ------------------------- * tree\_node Examples ----------- Empty element: ``` tree\_node() ``` With a block: ``` tree\_node do # ...child elements... end ``` [Link to this macro](#tree_node/1 "Link to this macro") tree\_node(attributes\_or\_children) ==================================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L199 "View Source") (macro) Defines an element with the `:tree_node` tag and either: * given attributes and an optional block * a list of child elements Attributes ------------- * `content` (required) - Binary label for the node * `color` (optional) - Constant representing color to use for foreground * `background` (optional) - Constant representing color to use for background * `attributes` (optional) - Constant representing style attributes to apply Allowed Child Elements ------------------------- * tree\_node Examples ----------- Passing attributes: ``` tree\_node(key: value) ``` Passing attributes and a block: ``` tree\_node(key: value) do # ...child elements... end ``` Passing list of children: ``` tree\_node([elem1, elem2]) ``` [Link to this macro](#tree_node/2 "Link to this macro") tree\_node(attributes, children) ================================ [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L238 "View Source") (macro) Defines an element with the `:tree_node` tag and the given attributes and child elements. Attributes ------------- * `content` (required) - Binary label for the node * `color` (optional) - Constant representing color to use for foreground * `background` (optional) - Constant representing color to use for background * `attributes` (optional) - Constant representing style attributes to apply Allowed Child Elements ------------------------- * tree\_node Examples ----------- ``` tree\_node([key: value], [elem1, elem2]) ``` [Link to this macro](#view/0 "Link to this macro") view() ====== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L195 "View Source") (macro) Defines an element with the `:view` tag. Allowed Child Elements ------------------------- * overlay * canvas * chart * label * panel * row * sparkline * table * tree * viewport Examples ----------- Empty element: ``` view() ``` With a block: ``` view do # ...child elements... end ``` [Link to this macro](#view/1 "Link to this macro") view(attributes\_or\_children) ============================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L199 "View Source") (macro) Defines an element with the `:view` tag and either: * given attributes and an optional block * a list of child elements Attributes ------------- * `top_bar` (optional) - A `:bar` element to occupy the view's first row * `bottom_bar` (optional) - A `:bar` element to occupy the view's last row Allowed Child Elements ------------------------- * overlay * canvas * chart * label * panel * row * sparkline * table * tree * viewport Examples ----------- Passing attributes: ``` view(key: value) ``` Passing attributes and a block: ``` view(key: value) do # ...child elements... end ``` Passing list of children: ``` view([elem1, elem2]) ``` [Link to this macro](#view/2 "Link to this macro") view(attributes, children) ========================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L238 "View Source") (macro) Defines an element with the `:view` tag and the given attributes and child elements. Attributes ------------- * `top_bar` (optional) - A `:bar` element to occupy the view's first row * `bottom_bar` (optional) - A `:bar` element to occupy the view's last row Allowed Child Elements ------------------------- * overlay * canvas * chart * label * panel * row * sparkline * table * tree * viewport Examples ----------- ``` view([key: value], [elem1, elem2]) ``` [Link to this macro](#viewport/0 "Link to this macro") viewport() ========== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L195 "View Source") (macro) Defines an element with the `:viewport` tag. Allowed Child Elements ------------------------- * canvas * chart * label * panel * row * sparkline * table * tree * viewport Examples ----------- Empty element: ``` viewport() ``` With a block: ``` viewport do # ...child elements... end ``` [Link to this macro](#viewport/1 "Link to this macro") viewport(attributes\_or\_children) ================================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L199 "View Source") (macro) Defines an element with the `:viewport` tag and either: * given attributes and an optional block * a list of child elements Attributes ------------- * `offset_x` (optional) - Integer representing the number of columns to offset the child content by. Defaults to 0. * `offset_y` (optional) - Integer representing the number of rows to offset the child content by. Defaults to 0. Allowed Child Elements ------------------------- * canvas * chart * label * panel * row * sparkline * table * tree * viewport Examples ----------- Passing attributes: ``` viewport(key: value) ``` Passing attributes and a block: ``` viewport(key: value) do # ...child elements... end ``` Passing list of children: ``` viewport([elem1, elem2]) ``` [Link to this macro](#viewport/2 "Link to this macro") viewport(attributes, children) ============================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/view.ex#L238 "View Source") (macro) Defines an element with the `:viewport` tag and the given attributes and child elements. Attributes ------------- * `offset_x` (optional) - Integer representing the number of columns to offset the child content by. Defaults to 0. * `offset_y` (optional) - Integer representing the number of rows to offset the child content by. Defaults to 0. Allowed Child Elements ------------------------- * canvas * chart * label * panel * row * sparkline * table * tree * viewport Examples ----------- ``` viewport([key: value], [elem1, elem2]) ``` Ratatouille.Window β€” Ratatouille v0.5.1 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Ratatouille v0.5.1 Ratatouille.Window [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/window.ex#L1 "View Source") ====================================================================================================================================================== A GenServer to manage the terminal window, along with a client API to perform updates and retrieve window information. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [fetch\_attr()](#t:fetch_attr/0) [Functions](#functions) ------------------------ [child\_spec(init\_arg)](#child_spec/1) Returns a specification to start this module under a supervisor. [close(pid \\ \_\_MODULE\_\_)](#close/1) Closes the window by stopping the GenServer. Prior to this, termbox is de-initialized so that the terminal is restored to its previous state. [fetch(pid \\ \_\_MODULE\_\_, attr)](#fetch/2) Fetches an attribute for the window. This is currently limited to the window dimensions, which can be useful when laying out content. [start\_link(opts \\ [])](#start_link/1) Starts the gen\_server representing the window. [update(pid \\ \_\_MODULE\_\_, view)](#update/2) Updates the window by rendering the given view to the termbox buffer and presenting it. [Link to this section](#types) Types ===================================== [Link to this type](#t:fetch_attr/0 "Link to this type") fetch\_attr() ============= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/window.ex#L75 "View Source") ``` fetch_attr() :: :width | :height | :box ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#child_spec/1 "Link to this function") child\_spec(init\_arg) ====================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/window.ex#L7 "View Source") Returns a specification to start this module under a supervisor. See [`Supervisor`](https://hexdocs.pm/elixir/Supervisor.html). [Link to this function](#close/1 "Link to this function") close(pid \\ \_\_MODULE\_\_) ============================ [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/window.ex#L73 "View Source") ``` close([GenServer.server](https://hexdocs.pm/elixir/GenServer.html#t:server/0)()) :: :ok ``` Closes the window by stopping the GenServer. Prior to this, termbox is de-initialized so that the terminal is restored to its previous state. [Link to this function](#fetch/2 "Link to this function") fetch(pid \\ \_\_MODULE\_\_, attr) ================================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/window.ex#L92 "View Source") ``` fetch([GenServer.server](https://hexdocs.pm/elixir/GenServer.html#t:server/0)(), [fetch\_attr](#t:fetch_attr/0)()) :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Fetches an attribute for the window. This is currently limited to the window dimensions, which can be useful when laying out content. Examples ----------- ``` iex> Window.fetch(:height) {:ok, 124} iex> Window.fetch(:width) {:ok, 50} iex> Window.fetch(:foo) {:error, :unknown\_attribute} ``` [Link to this function](#start_link/1 "Link to this function") start\_link(opts \\ []) ======================= [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/window.ex#L38 "View Source") ``` start_link([Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)()) :: [GenServer.on\_start](https://hexdocs.pm/elixir/GenServer.html#t:on_start/0)() ``` Starts the gen\_server representing the window. The window is intended to be run as a singleton gen\_server process, as initializing the underlying termbox library multiple times on the same TTY can lead to undefined behavior. Options ---------- * `:name` - Override the name passed to [`GenServer.start_link/3`](https://hexdocs.pm/elixir/GenServer.html#start_link/3). By ``` default, `name: Ratatouille.Window` is passed in order to protect against accidental double initialization, but this can be overridden by passing `nil` or an alternate value. ``` * `:input_mode` - Configure the input mode. See [`Ratatouille.Constants.input_mode/1`](Ratatouille.Constants.html#input_mode/1) ``` for possible values. ``` * `:output_mode` - Configure the output mode. See [`Ratatouille.Constants.output_mode/1`](Ratatouille.Constants.html#output_mode/1) ``` for possible values. ``` [Link to this function](#update/2 "Link to this function") update(pid \\ \_\_MODULE\_\_, view) =================================== [View Source](https://github.com/ndreynolds/ratatouille/blob/master/lib/ratatouille/window.ex#L66 "View Source") ``` update([GenServer.server](https://hexdocs.pm/elixir/GenServer.html#t:server/0)(), Ratatouille.Renderer.Element.t()) :: :ok ``` Updates the window by rendering the given view to the termbox buffer and presenting it.
surface_formatter
hex
SurfaceFormatter β€” SurfaceFormatter v0.7.5 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } SurfaceFormatter ================ [![Build Status](https://github.com/surface-ui/surface_formatter/workflows/CI/badge.svg)](https://github.com/surface-ui/surface_formatter/actions?query=workflow%3A%22CI%22) [![hex.pm](https://img.shields.io/hexpm/v/surface_formatter.svg)](https://hex.pm/packages/surface_formatter) [![hex.pm](https://img.shields.io/hexpm/l/surface_formatter.svg)](https://hex.pm/packages/surface_formatter) A code formatter for <https://hex.pm/packages/surface>. The complete documentation for SurfaceFormatter is located [here](https://hexdocs.pm/surface_formatter/). Installation --------------- Add `:surface_formatter` as a dependency in `mix.exs`: ``` defp deps do [ {:surface\_formatter, "~> 0.7.5"} ] end ``` Formatter Plugin Usage (Elixir 1.13 and later) ------------------------------------------------- ### Configuration Modify the following in `.formatter.exs`: * `inputs` - add patterns for all Surface files * `plugins` - add [`Surface.Formatter.Plugin`](Surface.Formatter.Plugin.html) ``` # .formatter.exs [ ..., # match all .sface files and all .ex files with ~F sigils inputs: ["lib/\*\*/\*.{ex,sface}", ...], plugins: [Surface.Formatter.Plugin] ] ``` For documentation of other `.formatter.exs` options, see [`Surface.Formatter.Plugin`](Surface.Formatter.Plugin.html). ### Usage ``` $ mix format ``` (Formats both Elixir and Surface code.) Mix Task Usage (Elixir 1.12 and earlier) ------------------------------------------- ### Configuration Add `surface_inputs` to `.formatter.exs` with patterns for all Surface files: ``` # .formatter.exs [ ..., # match all .sface files and all .ex files with ~F sigils surface\_inputs: ["lib/\*\*/\*.{ex,sface}", ...] ] ``` If your project does not use `sface` files, you can omit `:surface_inputs` and specify file patterns in the standard `:inputs` field instead. ([`mix surface.format`](Mix.Tasks.Surface.Format.html) will fall back to `:inputs`.) But be warned that including `.sface` files in `:inputs` causes [`mix format`](https://hexdocs.pm/mix/Mix.Tasks.Format.html) to crash in Elixir 1.12 and earlier. For documentation of other `.formatter.exs` options, see [`mix surface.format`](Mix.Tasks.Surface.Format.html). ### Usage ``` $ mix surface.format ``` Formatting rules ------------------- The formatter mostly follows these rules: * Only formats code inside of `~F"""` blocks and `.sface` files. * Child nodes are typically indented 2 spaces in from their parent. * Interpolated Elixir code (inside `{ }` brackets) is formatted by the [official Elixir formatter](https://hexdocs.pm/elixir/Code.html#format_string!/2). * HTML attributes are put on separate lines if the line is too long. * Retains "lack of whitespace" such as `<p>No whitespace between text and tags</p>`. * Collapses extra newlines down to at most one blank line. See [`Surface.Formatter.format_string!/2`](Surface.Formatter.html#format_string!/2) for further documentation. Example at a glance ---------------------- Out of the box, Surface code that looks like this: ``` <RootComponent with_many_attributes={ true } causing_this_line_to_wrap={ true} because_it_is_too_long={ "yes, this line is long enough to wrap" }> <!-- HTML public comment (hits the browser) --> {!-- Surface private comment (does not hit the browser) --} <div :if={ @show_div } class="container"> <p> Text inside paragraph </p> <span>Text touching parent tags</span> </div> <Child items={[%{name: "Option 1", key: 1}, %{name: "Option 2", key: 2}, %{name: "Option 3", key: 3}, %{name: "Option 4", key: 4}]}> Default slot contents </Child> </RootComponent> ``` will be formatted like this: ``` <RootComponent with_many_attributes causing_this_line_to_wrap because_it_is_too_long="yes, this line is long enough to wrap" > <!-- HTML public comment (hits the browser) --> {!-- Surface private comment (does not hit the browser) --} <div :if={@show_div} class="container"> <p> Text inside paragraph </p> <span>Text touching parent tags</span> </div> <Child items={[ %{name: "Option 1", key: 1}, %{name: "Option 2", key: 2}, %{name: "Option 3", key: 3}, %{name: "Option 4", key: 4} ]}> Default slot contents </Child> </RootComponent> ``` Surface.Formatter β€” SurfaceFormatter v0.7.5 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Surface.Formatter (SurfaceFormatter v0.7.5) [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter.ex#L1 "View Source") ================================================================================================================================================================= Functions for formatting Surface code snippets. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [attribute()](#t:attribute/0) A parsed HTML/Component attribute name and value. [attribute\_value()](#t:attribute_value/0) The value of a parsed HTML/Component attribute. [formatter\_node()](#t:formatter_node/0) A node that will ultimately be sent to `Surface.Formatter.Render.node/2` for rendering. [option()](#t:option/0) Options that can be passed to [`Surface.Formatter.format_string!/2`](#format_string!/2). [surface\_node()](#t:surface_node/0) A node output by `Surface.Compiler.Parser.parse`. [tag()](#t:tag/0) The name of an HTML/Surface tag, such as `div`, `ListItem`, or `#Markdown`. [whitespace()](#t:whitespace/0) Whitespace nodes that can be rendered by `Surface.Formatter.Render.node/2`. [Functions](#functions) ------------------------ [format\_string!(string, opts \\ [])](#format_string!/2) Formats the given Surface code string. (Typically the contents of an `~F` sigil or `.sface` file.) [is\_element?(arg1)](#is_element?/1) Returns true if the argument is an element (HTML element or surface component), false otherwise. [render\_contents\_verbatim?(tag)](#render_contents_verbatim?/1) Given a tag, return whether to render the contens verbatim instead of formatting them. Specifically, don't modify contents of macro components or <pre> and <code> tags. [Link to this section](#types) Types ===================================== [Link to this type](#t:attribute/0 "Link to this type") attribute() =========== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter.ex#L28 "View Source") Specs ----- ``` attribute() :: {name :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), [attribute\_value](#t:attribute_value/0)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} ``` A parsed HTML/Component attribute name and value. [Link to this type](#t:attribute_value/0 "Link to this type") attribute\_value() ================== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter.ex#L20 "View Source") Specs ----- ``` attribute_value() :: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | {:attribute_expr, interpolated_expression :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] ``` The value of a parsed HTML/Component attribute. [Link to this type](#t:formatter_node/0 "Link to this type") formatter\_node() ================= [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter.ex#L59 "View Source") Specs ----- ``` formatter_node() :: [surface\_node](#t:surface_node/0)() | [whitespace](#t:whitespace/0)() ``` A node that will ultimately be sent to `Surface.Formatter.Render.node/2` for rendering. The output of `Surface.Compiler.Parser.parse` is ran through the various formatting phases, which ultimately output a tree of this type. [Link to this type](#t:option/0 "Link to this type") option() ======== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter.ex#L12 "View Source") Specs ----- ``` option() :: {:line_length, [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} | {:indent, [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` Options that can be passed to [`Surface.Formatter.format_string!/2`](#format_string!/2). * `:line_length` - Maximum line length before wrapping opening tags * `:indent` - Starting indentation depth depending on the context of the ~F sigil [Link to this type](#t:surface_node/0 "Link to this type") surface\_node() =============== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter.ex#L31 "View Source") Specs ----- ``` surface_node() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | {:interpolation, [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} | {[tag](#t:tag/0)(), [[attribute](#t:attribute/0)()], [[surface\_node](#t:surface_node/0)()], [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` A node output by `Surface.Compiler.Parser.parse`. [Link to this type](#t:tag/0 "Link to this type") tag() ===== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter.ex#L17 "View Source") Specs ----- ``` tag() :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` The name of an HTML/Surface tag, such as `div`, `ListItem`, or `#Markdown`. [Link to this type](#t:whitespace/0 "Link to this type") whitespace() ============ [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter.ex#L47 "View Source") Specs ----- ``` whitespace() :: :newline | :space | :indent | :indent_one_less ``` Whitespace nodes that can be rendered by `Surface.Formatter.Render.node/2`. The Surface parser does not return these, but formatter phases introduce these nodes in preparation for rendering. * `:newline` adds a newline (`\n`) character * `:space` adds a space () character * `:indent` adds spaces at the appropriate indentation amount * `:indent_one_less` adds spaces at 1 indentation level removed (used for closing tags) [Link to this section](#functions) Functions ============================================= [Link to this function](#format_string!/2 "Link to this function") format\_string!(string, opts \\ []) =================================== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter.ex#L378 "View Source") Specs ----- ``` format_string!([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), [[option](#t:option/0)()]) :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Formats the given Surface code string. (Typically the contents of an `~F` sigil or `.sface` file.) In short: * HTML/Surface elements are indented to the right of their parents. * Attributes are split on multiple lines if the line is too long; otherwise on the same line. * Elixir code snippets (inside `{ }`) are ran through the Elixir code formatter. * Lack of whitespace is preserved, so that intended behaviors are not removed. (For example, `<span>Foo bar baz</span>` will not have newlines or spaces added.) Below the **Options** section is a non-exhaustive list of behaviors of the formatter. Options ======= * `:line_length` - the line length to aim for when formatting the document. Defaults to 98. As with the Elixir formatter, this value is used as reference but is not always enforced depending on the context. Indentation =========== The formatter ensures that children are indented one tab (two spaces) in from their parent. Whitespace ========== Whitespace that exists ------------------------- As in regular HTML, any string of continuous whitespace is considered equivalent to any other string of continuous whitespace. There are four exceptions: 1. Macro components (with names starting with `#`, such as `<#Markdown>`) 2. `<pre>` tags 3. `<code>` tags 4. `<script>` tags The contents of those tags are considered whitespace-sensitive, and developers should sanity check after running the formatter. Whitespace that doesn't exist (Lack of whitespace) ----------------------------------------------------- As is sometimes the case in HTML, *lack* of whitespace is considered significant. Instead of attempting to determine which contexts matter, the formatter consistently retains lack of whitespace. This means that the following ``` <div><p>Hello</p></div> ``` will not be changed. However, the following ``` <div> <p> Hello </p> </div> ``` will be formatted as ``` <div> <p> Hello </p> </div> ``` because of the whitespace on either side of each tag. To be clear, this example ``` <div> <p>Hello</p> </div> ``` will be formatted as ``` <div> <p>Hello</p> </div> ``` because of the lack of whitespace in between the opening and closing `<p>` tags and their child content. Splitting children onto separate lines ----------------------------------------- In certain scenarios, the formatter will move nodes to their own line: (Below, "element" means an HTML element or a Surface component.) 1. If an element contains other elements as children, it will be surrounded by newlines. 2. If there is a space after an opening tag or before a closing tag, it is converted to a newline. 3. If a closing tag is put on its own line, the formatter ensures there's a newline before the next sibling node. Since SurfaceFormatter doesn't know if a component represents an inline or block element, it does not currently make distinctions between elements that should or should not be moved onto their own lines, other than the above rules. This allows inline elements to be placed among text without splitting them onto their own lines: ``` The <b>Dialog</b> is a stateless component. All event handlers had to be defined in the parent <b>LiveView</b>. ``` Newline characters --------------------- The formatter will not add extra newlines unprompted beyond moving nodes onto their own line. However, if the input code has extra newlines, the formatter will retain them but will collapse more than one extra newline into a single one. This means that ``` <p>Hello</p> <p>Goodbye</p> ``` will be formatted as ``` <p>Hello</p> <p>Goodbye</p> ``` HTML attributes and component props =================================== HTML attributes such as `class` in `<p class="container">` and component props such as `name` in `<Person name="Samantha">` are formatted to make use of Surface features. Inline literals ------------------ String literals are placed after the `=` without any interpolation brackets (`{ }`). This means that ``` <Component foo={"hello"} /> ``` will be formatted as ``` <Component foo="hello" /> ``` Also, `true` boolean literals are formatted using the Surface shorthand whereby you can simply write the name of the attribute and it is passed in as `true`. For example, ``` <Component secure={true} /> ``` and ``` <Component secure=true /> ``` will both be formatted as ``` <Component secure /> ``` Interpolation (`{ }` brackets) --------------------------------- Attributes that interpolate Elixir code with `{ }` brackets are ran through the Elixir code formatter. This means that: * `<Foo num={123456} />` becomes `<Foo num={123_456} />` * `list={[1,2,3]}` becomes `list={[1, 2, 3]}` * `things={%{ one: "1", two: "2"}}` becomes `things={%{one: "1", two: "2"}}` Sometimes the Elixir code formatter will add line breaks in the formatted expression. In that case, SurfaceFormatter will ensure indentation lines up. If there is a single attribute, it will keep the attribute on the same line as the tag name, for example: ``` <Component list={[ {"foo", foo}, {"bar", bar} ]} /> ``` However, if there are multiple attributes it will put them on separate lines: ``` <Child list={[ {"foo", foo}, {"bar", bar} ]} int={123} /> ``` Whitespace in string attributes ---------------------------------- ### Code semantics must be maintained It's critical that a code formatter never change the semantics of the code it modifies. In other words, the behavior of a program should never change due to a code formatter. The **Whitespace** section above outlines how `SurfaceFormatter` preserves code semantics by refusing to modify contents of `<script>`, `<code>` and `<pre>` tags as well as macro components. And for the same reason, the formatter does not introduce whitespace between HTML tags when there is none. ### Code semantics in string attributes This principle is also relevant to string attributes, such as: ``` <MyComponent string_prop=" string with whitespace " /> ``` `SurfaceFormatter` cannot reliably guess whether application behavior will be changed by formatting the contents of a string. For example, consider a component with the following interface: ``` <List items=" apples (fuji) oranges (navel) bell peppers (green) " /> ``` The component internally splits on newline characters and outputs the following HTML: ``` <ul> <li>apples (fuji)</li> <li>oranges (navel)</li> <li>bell peppers (green)</li> </ul> ``` If `SurfaceFormatter` assumes it is safe to modify whitespace in string attributes, then the Surface code would likely change to this: ``` <List items="apples (fuji) oranges (navel) bell peppers (green)" /> ``` Which would output the following HTML: ``` <ul> <li>apples (fuji) oranges (navel) bell peppers (green)</li> </ul> ``` Notice that the behavior of the application would have changed simply by running the formatter. It is for this reason that `SurfaceFormatter` always retains precisely the same whitespace in attribute strings, including both space and newline characters. Wrapping attributes on separate lines ---------------------------------------- In the **Interpolation (`{ }` brackets)** section we noted that attributes will each be put on their own line if there is more than one attribute and at least one contains a newline after being formatted by the Elixir code formatter. There is another scenario where attributes will each be given their own line: **any time the opening tag would exceed `line_length` if put on one line**. This value is provided in `.formatter.exs` and defaults to 98. The formatter indents attributes one tab in from the start of the opening tag for readability: ``` <div class="very long class value that causes this to exceed the established line length" aria-role="button" > ``` If you desire to have a separate line length for [`mix format`](https://hexdocs.pm/mix/Mix.Tasks.Format.html) and [`mix surface.format`](Mix.Tasks.Surface.Format.html), provide `surface_line_length` in `.formatter.exs` and it will be given precedence when running [`mix surface.format`](Mix.Tasks.Surface.Format.html). For example: ``` # .formatter.exs [ surface\_line\_length: 120, import\_deps: [...], # ... ] ``` Developer Responsibility ======================== As with all changes (for both [`mix format`](https://hexdocs.pm/mix/Mix.Tasks.Format.html) and [`mix surface.format`](Mix.Tasks.Surface.Format.html)) it's recommended that developers don't blindly run the formatter on an entire codebase and commit, but instead sanity check each file to ensure the results are desired. [Link to this function](#is_element?/1 "Link to this function") is\_element?(arg1) ================== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter.ex#L415 "View Source") Specs ----- ``` is_element?([surface\_node](#t:surface_node/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Returns true if the argument is an element (HTML element or surface component), false otherwise. [Link to this function](#render_contents_verbatim?/1 "Link to this function") render\_contents\_verbatim?(tag) ================================ [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter.ex#L423 "View Source") Specs ----- ``` render_contents_verbatim?([tag](#t:tag/0)()) :: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Given a tag, return whether to render the contens verbatim instead of formatting them. Specifically, don't modify contents of macro components or <pre> and <code> tags. Surface.Formatter.NodeTranslator β€” SurfaceFormatter v0.7.5 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Surface.Formatter.NodeTranslator (SurfaceFormatter v0.7.5) [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/node_translator.ex#L1 "View Source") ================================================================================================================================================================================================ [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [context\_for\_block(name, meta, state)](#context_for_block/3) Callback implementation for `c:Surface.Compiler.NodeTranslator.context_for_block/3`. [context\_for\_node(name, meta, state)](#context_for_node/3) Callback implementation for `c:Surface.Compiler.NodeTranslator.context_for_node/3`. [context\_for\_subblock(name, meta, state, parent\_context)](#context_for_subblock/4) Callback implementation for `c:Surface.Compiler.NodeTranslator.context_for_subblock/4`. [handle\_attribute(name, value, attr\_meta, state, context)](#handle_attribute/5) Callback implementation for `c:Surface.Compiler.NodeTranslator.handle_attribute/5`. [handle\_block(name, expr, body, meta, state, context)](#handle_block/6) Callback implementation for `c:Surface.Compiler.NodeTranslator.handle_block/6`. [handle\_block\_expression(block\_name, arg2, state, context)](#handle_block_expression/4) Callback implementation for `c:Surface.Compiler.NodeTranslator.handle_block_expression/4`. [handle\_comment(comment, meta, state)](#handle_comment/3) Callback implementation for `c:Surface.Compiler.NodeTranslator.handle_comment/3`. [handle\_expression(expression, meta, state)](#handle_expression/3) Callback implementation for `c:Surface.Compiler.NodeTranslator.handle_expression/3`. [handle\_init(state)](#handle_init/1) Callback implementation for `c:Surface.Compiler.NodeTranslator.handle_init/1`. [handle\_node(name, attributes, body, meta, state, context)](#handle_node/6) Callback implementation for `c:Surface.Compiler.NodeTranslator.handle_node/6`. [handle\_subblock(name, expr, children, meta, state, arg6)](#handle_subblock/6) Callback implementation for `c:Surface.Compiler.NodeTranslator.handle_subblock/6`. [handle\_tagged\_expression(binary, expression, meta, state)](#handle_tagged_expression/4) Callback implementation for `c:Surface.Compiler.NodeTranslator.handle_tagged_expression/4`. [handle\_text(text, state)](#handle_text/2) Callback implementation for `c:Surface.Compiler.NodeTranslator.handle_text/2`. [to\_meta(meta)](#to_meta/1) [Link to this section](#functions) Functions ============================================= [Link to this function](#context_for_block/3 "Link to this function") context\_for\_block(name, meta, state) ====================================== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/node_translator.ex#L126 "View Source") Callback implementation for `c:Surface.Compiler.NodeTranslator.context_for_block/3`. [Link to this function](#context_for_node/3 "Link to this function") context\_for\_node(name, meta, state) ===================================== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/node_translator.ex#L118 "View Source") Callback implementation for `c:Surface.Compiler.NodeTranslator.context_for_node/3`. [Link to this function](#context_for_subblock/4 "Link to this function") context\_for\_subblock(name, meta, state, parent\_context) ========================================================== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/node_translator.ex#L122 "View Source") Callback implementation for `c:Surface.Compiler.NodeTranslator.context_for_subblock/4`. [Link to this function](#handle_attribute/5 "Link to this function") handle\_attribute(name, value, attr\_meta, state, context) ========================================================== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/node_translator.ex#L52 "View Source") Callback implementation for `c:Surface.Compiler.NodeTranslator.handle_attribute/5`. [Link to this function](#handle_block/6 "Link to this function") handle\_block(name, expr, body, meta, state, context) ===================================================== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/node_translator.ex#L22 "View Source") Callback implementation for `c:Surface.Compiler.NodeTranslator.handle_block/6`. [Link to this function](#handle_block_expression/4 "Link to this function") handle\_block\_expression(block\_name, arg2, state, context) ============================================================ [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/node_translator.ex#L43 "View Source") Callback implementation for `c:Surface.Compiler.NodeTranslator.handle_block_expression/4`. [Link to this function](#handle_comment/3 "Link to this function") handle\_comment(comment, meta, state) ===================================== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/node_translator.ex#L14 "View Source") Callback implementation for `c:Surface.Compiler.NodeTranslator.handle_comment/3`. [Link to this function](#handle_expression/3 "Link to this function") handle\_expression(expression, meta, state) =========================================== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/node_translator.ex#L6 "View Source") Callback implementation for `c:Surface.Compiler.NodeTranslator.handle_expression/3`. [Link to this function](#handle_init/1 "Link to this function") handle\_init(state) =================== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/node_translator.ex#L4 "View Source") Callback implementation for `c:Surface.Compiler.NodeTranslator.handle_init/1`. [Link to this function](#handle_node/6 "Link to this function") handle\_node(name, attributes, body, meta, state, context) ========================================================== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/node_translator.ex#L18 "View Source") Callback implementation for `c:Surface.Compiler.NodeTranslator.handle_node/6`. [Link to this function](#handle_subblock/6 "Link to this function") handle\_subblock(name, expr, children, meta, state, arg6) ========================================================= [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/node_translator.ex#L26 "View Source") Callback implementation for `c:Surface.Compiler.NodeTranslator.handle_subblock/6`. [Link to this function](#handle_tagged_expression/4 "Link to this function") handle\_tagged\_expression(binary, expression, meta, state) =========================================================== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/node_translator.ex#L10 "View Source") Callback implementation for `c:Surface.Compiler.NodeTranslator.handle_tagged_expression/4`. [Link to this function](#handle_text/2 "Link to this function") handle\_text(text, state) ========================= [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/node_translator.ex#L38 "View Source") Callback implementation for `c:Surface.Compiler.NodeTranslator.handle_text/2`. [Link to this function](#to_meta/1 "Link to this function") to\_meta(meta) ============== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/node_translator.ex#L130 "View Source") Surface.Formatter.Phase β€” SurfaceFormatter v0.7.5 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Surface.Formatter.Phase behaviour (SurfaceFormatter v0.7.5) [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/phase.ex#L1 "View Source") ======================================================================================================================================================================================= A phase implementing a single "rule" for formatting code. These work as middleware between `Surface.Compiler.Parser.parse` and `Surface.Formatter.Render.node/2` to modify node lists before they are rendered. Some phases rely on other phases; `@moduledoc`s should make this explicit. For reference, the formatter operates by running these phases in the following order: * [`Surface.Formatter.Phases.TagWhitespace`](Surface.Formatter.Phases.TagWhitespace.html) * [`Surface.Formatter.Phases.Newlines`](Surface.Formatter.Phases.Newlines.html) * [`Surface.Formatter.Phases.SpacesToNewlines`](Surface.Formatter.Phases.SpacesToNewlines.html) * [`Surface.Formatter.Phases.Indent`](Surface.Formatter.Phases.Indent.html) * [`Surface.Formatter.Phases.FinalNewline`](Surface.Formatter.Phases.FinalNewline.html) * [`Surface.Formatter.Phases.BlockExceptions`](Surface.Formatter.Phases.BlockExceptions.html) * [`Surface.Formatter.Phases.Render`](Surface.Formatter.Phases.Render.html) [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [node\_transformer()](#t:node_transformer/0) A node that takes a list of nodes and returns them back after applying a transformation [nodes()](#t:nodes/0) A list of nodes [Functions](#functions) ------------------------ [transform\_element\_children(nodes, transform)](#transform_element_children/2) Given a list of nodes, find all "element" nodes (HTML elements or Surface components) and transform children of those nodes using the given function. [transform\_elements\_and\_descendants(nodes, transform)](#transform_elements_and_descendants/2) Given a list of nodes, find all "element" nodes (HTML elements or Surface components) and transform children of those nodes using the given function. [Callbacks](#callbacks) ------------------------ [run(nodes, opts)](#c:run/2) The function implementing the phase. Returns the given nodes with the transformation applied. [Link to this section](#types) Types ===================================== [Link to this type](#t:node_transformer/0 "Link to this type") node\_transformer() =================== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/phase.ex#L28 "View Source") Specs ----- ``` node_transformer() :: ([nodes](#t:nodes/0)() -> [nodes](#t:nodes/0)()) ``` A node that takes a list of nodes and returns them back after applying a transformation [Link to this type](#t:nodes/0 "Link to this type") nodes() ======= [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/phase.ex#L31 "View Source") Specs ----- ``` nodes() :: [[Surface.Formatter.formatter\_node](Surface.Formatter.html#t:formatter_node/0)()] ``` A list of nodes [Link to this section](#functions) Functions ============================================= [Link to this function](#transform_element_children/2 "Link to this function") transform\_element\_children(nodes, transform) ============================================== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/phase.ex#L40 "View Source") Specs ----- ``` transform_element_children([nodes](#t:nodes/0)(), [node\_transformer](#t:node_transformer/0)()) :: [nodes](#t:nodes/0)() ``` Given a list of nodes, find all "element" nodes (HTML elements or Surface components) and transform children of those nodes using the given function. Useful for recursing deeply through the entire tree of nodes. [Link to this function](#transform_elements_and_descendants/2 "Link to this function") transform\_elements\_and\_descendants(nodes, transform) ======================================================= [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/phase.ex#L60 "View Source") Given a list of nodes, find all "element" nodes (HTML elements or Surface components) and transform children of those nodes using the given function. Recurses deeply through the tree, unlike `transform_element_children`, which only affects a single layer. [Link to this section](#callbacks) Callbacks ============================================= [Link to this callback](#c:run/2 "Link to this callback") run(nodes, opts) ================ [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/phase.ex#L23 "View Source") Specs ----- ``` run( nodes :: [[Surface.Formatter.formatter\_node](Surface.Formatter.html#t:formatter_node/0)()], opts :: [[Surface.Formatter.option](Surface.Formatter.html#t:option/0)()] ) :: [[Surface.Formatter.formatter\_node](Surface.Formatter.html#t:formatter_node/0)()] ``` The function implementing the phase. Returns the given nodes with the transformation applied. Surface.Formatter.Phases.BlockExceptions β€” SurfaceFormatter v0.7.5 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Surface.Formatter.Phases.BlockExceptions (SurfaceFormatter v0.7.5) [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/phases/block_exceptions.ex#L1 "View Source") ================================================================================================================================================================================================================ Handle exceptional case for blocks. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [run(nodes, opts)](#run/2) Callback implementation for [`Surface.Formatter.Phase.run/2`](Surface.Formatter.Phase.html#c:run/2). [transform\_block(node)](#transform_block/1) [Link to this section](#functions) Functions ============================================= [Link to this function](#run/2 "Link to this function") run(nodes, opts) ================ [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/phases/block_exceptions.ex#L9 "View Source") Callback implementation for [`Surface.Formatter.Phase.run/2`](Surface.Formatter.Phase.html#c:run/2). [Link to this function](#transform_block/1 "Link to this function") transform\_block(node) ====================== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/phases/block_exceptions.ex#L13 "View Source") Surface.Formatter.Phases.FinalNewline β€” SurfaceFormatter v0.7.5 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Surface.Formatter.Phases.FinalNewline (SurfaceFormatter v0.7.5) [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/phases/final_newline.ex#L1 "View Source") ========================================================================================================================================================================================================== Add a newline after all of the nodes if one was present on the original input [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [run(nodes, opts)](#run/2) Callback implementation for [`Surface.Formatter.Phase.run/2`](Surface.Formatter.Phase.html#c:run/2). [Link to this section](#functions) Functions ============================================= [Link to this function](#run/2 "Link to this function") run(nodes, opts) ================ [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/phases/final_newline.ex#L7 "View Source") Callback implementation for [`Surface.Formatter.Phase.run/2`](Surface.Formatter.Phase.html#c:run/2). Surface.Formatter.Phases.Indent β€” SurfaceFormatter v0.7.5 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Surface.Formatter.Phases.Indent (SurfaceFormatter v0.7.5) [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/phases/indent.ex#L1 "View Source") ============================================================================================================================================================================================= Adds indentation nodes (`:indent` and `:indent_one_less`) where appropriate. `Surface.Formatter.Render.node/2` is responsible for adding the appropriate level of indentation. It keeps track of the indentation level based on how "nested" a node is. While running Formatter Phases, it's not necessary to keep track of that detail. `:indent_one_less` exists to notate the indentation that should occur before a closing tag, which is one less than its children. Relies on `Newlines` phase, which collapses :newline nodes to at most 2 in a row. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [add\_indentation(nodes, accumulated \\ [])](#add_indentation/2) [run(nodes, opts)](#run/2) Callback implementation for [`Surface.Formatter.Phase.run/2`](Surface.Formatter.Phase.html#c:run/2). [Link to this section](#functions) Functions ============================================= [Link to this function](#add_indentation/2 "Link to this function") add\_indentation(nodes, accumulated \\ []) ========================================== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/phases/indent.ex#L31 "View Source") [Link to this function](#run/2 "Link to this function") run(nodes, opts) ================ [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/phases/indent.ex#L19 "View Source") Callback implementation for [`Surface.Formatter.Phase.run/2`](Surface.Formatter.Phase.html#c:run/2). Surface.Formatter.Phases.Newlines β€” SurfaceFormatter v0.7.5 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Surface.Formatter.Phases.Newlines (SurfaceFormatter v0.7.5) [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/phases/newlines.ex#L1 "View Source") ================================================================================================================================================================================================= Standardizes usage of newlines. * Prevents more than 1 empty line in a row. * Prevents an empty line separating an opening/closing tag from the contents inside. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [run(nodes, opts)](#run/2) Callback implementation for [`Surface.Formatter.Phase.run/2`](Surface.Formatter.Phase.html#c:run/2). [Link to this section](#functions) Functions ============================================= [Link to this function](#run/2 "Link to this function") run(nodes, opts) ================ [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/phases/newlines.ex#L12 "View Source") Callback implementation for [`Surface.Formatter.Phase.run/2`](Surface.Formatter.Phase.html#c:run/2). Surface.Formatter.Phases.Render β€” SurfaceFormatter v0.7.5 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Surface.Formatter.Phases.Render (SurfaceFormatter v0.7.5) [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/phases/render.ex#L1 "View Source") ============================================================================================================================================================================================= Render the formatted Surface code after it has run through the other transforming phases. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [render\_attribute\_option()](#t:render_attribute_option/0) [Functions](#functions) ------------------------ [render\_node(segment, opts)](#render_node/2) Given a [`Surface.Formatter.formatter_node/0`](Surface.Formatter.html#t:formatter_node/0) node, render it to a string for writing back into a file. [run(nodes, opts)](#run/2) Callback implementation for [`Surface.Formatter.Phase.run/2`](Surface.Formatter.Phase.html#c:run/2). [Link to this section](#types) Types ===================================== [Link to this type](#t:render_attribute_option/0 "Link to this type") render\_attribute\_option() =========================== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/phases/render.ex#L309 "View Source") Specs ----- ``` render_attribute_option() :: {:attributes, [[Surface.Formatter.attribute](Surface.Formatter.html#t:attribute/0)()]} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#render_node/2 "Link to this function") render\_node(segment, opts) =========================== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/phases/render.ex#L30 "View Source") Specs ----- ``` render_node([Surface.Formatter.formatter\_node](Surface.Formatter.html#t:formatter_node/0)(), [[Surface.Formatter.option](Surface.Formatter.html#t:option/0)()]) :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil ``` Given a [`Surface.Formatter.formatter_node/0`](Surface.Formatter.html#t:formatter_node/0) node, render it to a string for writing back into a file. [Link to this function](#run/2 "Link to this function") run(nodes, opts) ================ [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/phases/render.ex#L10 "View Source") Callback implementation for [`Surface.Formatter.Phase.run/2`](Surface.Formatter.Phase.html#c:run/2). Surface.Formatter.Phases.SpacesToNewlines β€” SurfaceFormatter v0.7.5 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Surface.Formatter.Phases.SpacesToNewlines (SurfaceFormatter v0.7.5) [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/phases/spaces_to_newlines.ex#L1 "View Source") =================================================================================================================================================================================================================== In a variety of scenarios, converts :space nodes to :newline nodes. (Below, "element" means an HTML element or a Surface component.) 1. If an element contains other elements as children, surround it with newlines. 2. If there is a space after an opening tag or before a closing tag, convert it to a newline. 3. If there is a closing tag on its own line, ensure there's a newline before the next sibling node. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [run(nodes, opts)](#run/2) Callback implementation for [`Surface.Formatter.Phase.run/2`](Surface.Formatter.Phase.html#c:run/2). [Link to this section](#functions) Functions ============================================= [Link to this function](#run/2 "Link to this function") run(nodes, opts) ================ [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/phases/spaces_to_newlines.ex#L15 "View Source") Callback implementation for [`Surface.Formatter.Phase.run/2`](Surface.Formatter.Phase.html#c:run/2). Surface.Formatter.Phases.TagWhitespace β€” SurfaceFormatter v0.7.5 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Surface.Formatter.Phases.TagWhitespace (SurfaceFormatter v0.7.5) [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/phases/tag_whitespace.ex#L1 "View Source") ============================================================================================================================================================================================================ Inspects all text nodes and "tags" leading and trailing whitespace by converting it into a `:space` atom or a list of `:newline` atoms. This is the first phase of formatting, and all other phases depend on it. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [run(nodes, opts)](#run/2) Callback implementation for [`Surface.Formatter.Phase.run/2`](Surface.Formatter.Phase.html#c:run/2). [tag\_whitespace(text)](#tag_whitespace/1) This function takes a node provided by `Surface.Compiler.Parser.parse` and converts the leading/trailing whitespace into [`Surface.Formatter.whitespace/0`](Surface.Formatter.html#t:whitespace/0) nodes. [Link to this section](#functions) Functions ============================================= [Link to this function](#run/2 "Link to this function") run(nodes, opts) ================ [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/phases/tag_whitespace.ex#L12 "View Source") Callback implementation for [`Surface.Formatter.Phase.run/2`](Surface.Formatter.Phase.html#c:run/2). [Link to this function](#tag_whitespace/1 "Link to this function") tag\_whitespace(text) ===================== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/phases/tag_whitespace.ex#L23 "View Source") Specs ----- ``` tag_whitespace([Surface.Formatter.surface\_node](Surface.Formatter.html#t:surface_node/0)()) :: [ [Surface.Formatter.surface\_node](Surface.Formatter.html#t:surface_node/0)() | :newline | :space ] ``` This function takes a node provided by `Surface.Compiler.Parser.parse` and converts the leading/trailing whitespace into [`Surface.Formatter.whitespace/0`](Surface.Formatter.html#t:whitespace/0) nodes. Surface.Formatter.Plugin β€” SurfaceFormatter v0.7.5 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Surface.Formatter.Plugin (SurfaceFormatter v0.7.5) [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/plugin.ex#L1 "View Source") =============================================================================================================================================================================== An [Elixir formatter plugin](https://hexdocs.pm/mix/1.13.0-rc.1/Mix.Tasks.Format.html#module-plugins) for Surface code. Elixir 1.13 introduced formatter plugins, allowing the Surface formatter to run during [`mix format`](https://hexdocs.pm/mix/Mix.Tasks.Format.html) instead of requiring developers to run [`mix surface.format`](Mix.Tasks.Surface.Format.html) separately. To format Surface code using Elixir 1.12 or earlier, use [`mix surface.format`](Mix.Tasks.Surface.Format.html). ### `.formatter.exs` setup Add to `:plugins` in `.formatter.exs` in order to format `~F` sigils and `.sface` files when running [`mix format`](https://hexdocs.pm/mix/Mix.Tasks.Format.html). Only works on files matching patterns in `:inputs`, so add patterns for all Surface files to ensure they're formatted. ``` # in .formatter.exs [ ..., plugins: [Surface.Formatter.Plugin] # add patterns matching all .sface files and all .ex files with ~F sigils inputs: ["\*.{ex,exs}", "{config,lib,test}/\*\*/\*.{ex,exs,sface}"], # THE FOLLOWING ARE OPTIONAL: # set desired line length for both Elixir's code formatter and this one # (only affects opening tags in Surface) line\_length: 80, # or, set line length only for Surface code (overrides `line\_length`) surface\_line\_length: 84 ] ``` ### Options In `.formatter.exs`, the following options can be provided: * `:line_length` - Maximum line length of an opening tag before SurfaceFormatter attempts to wrap it onto multiple lines. This option is used by [`Code.format_string!/2`](https://hexdocs.pm/elixir/Code.html#format_string!/2) and [`mix format`](https://hexdocs.pm/mix/Mix.Tasks.Format.html) and defaults to 98. * `:surface_line_length` - Overrides `:line_length`; useful for setting separate desired line length for Surface code and non-Surface Elixir code. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [features(opts)](#features/1) Callback implementation for [`Mix.Tasks.Format.features/1`](https://hexdocs.pm/mix/Mix.Tasks.Format.html#c:features/1). [format(contents, opts)](#format/2) Callback implementation for [`Mix.Tasks.Format.format/2`](https://hexdocs.pm/mix/Mix.Tasks.Format.html#c:format/2). [Link to this section](#functions) Functions ============================================= [Link to this function](#features/1 "Link to this function") features(opts) ============== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/plugin.ex#L54 "View Source") Callback implementation for [`Mix.Tasks.Format.features/1`](https://hexdocs.pm/mix/Mix.Tasks.Format.html#c:features/1). [Link to this function](#format/2 "Link to this function") format(contents, opts) ====================== [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/surface/formatter/plugin.ex#L58 "View Source") Callback implementation for [`Mix.Tasks.Format.format/2`](https://hexdocs.pm/mix/Mix.Tasks.Format.html#c:format/2). mix surface.format β€” SurfaceFormatter v0.7.5 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } mix surface.format (SurfaceFormatter v0.7.5) [View Source](https://github.com/surface-ui/surface_formatter/blob/v0.7.5/lib/mix/tasks/surface/format.ex#L1 "View Source") ========================================================================================================================================================================= **To format Surface code using Elixir 1.13 or later, use [`Surface.Formatter.Plugin`](Surface.Formatter.Plugin.html).** Formats Surface `~F` sigils and `.sface` files in the given files and patterns. ``` $ mix surface.format "lib/**/*.{ex,exs}" "test/**/*.{ex,exs}" $ cat path/to/file.ex | mix surface.format - ``` Takes the same options as [`mix format`](https://hexdocs.pm/mix/Mix.Tasks.Format.html) except for `--check-equivalent`. Formatting options --------------------- Like [`mix format`](https://hexdocs.pm/mix/Mix.Tasks.Format.html), the Surface formatter reads a `.formatter.exs` file in the current directory for formatter configuration. The Surface formatter accepts the same options as [`mix format`](https://hexdocs.pm/mix/Mix.Tasks.Format.html). Read more about the expected format of `.formatter.exs` and the shared configuration options [documented here](https://hexdocs.pm/mix/master/Mix.Tasks.Format.html#module-formatting-options). The Surface formatter also takes the following two additional options specified in `.formatter.exs`: * `:surface_line_length` overrides `:line_length` only for [`mix surface.format`](#content) (`:line_length` is used otherwise, or defaults to 98) * `:surface_inputs` overrides `:inputs` only for [`mix surface.format`](#content) (`:inputs` is used otherwise) Task-specific options ------------------------ The Surface formatter accepts the same task-specific options as [`mix format`](https://hexdocs.pm/mix/Mix.Tasks.Format.html). [Read documentation for the options documented here.](https://hexdocs.pm/mix/master/Mix.Tasks.Format.html#module-task-specific-options). For quick reference, here are some examples of using these options: ``` $ mix surface.format --check-formatted ** (Mix) mix surface.format failed due to --check-formatted. The following files are not formatted: * path/to/component.ex * path/to/file.sface ``` ``` $ mix surface.format --dry-run ``` ``` $ mix surface.format --dot-formatter path/to/.formatter.exs ``` You can also use the same syntax as [`mix format`](https://hexdocs.pm/mix/Mix.Tasks.Format.html) for specifying which files to format: ``` $ mix surface.format path/to/file.ex "lib/**/*.{ex,exs}" "test/**/*.{ex,exs}" ``` API Reference β€” SurfaceFormatter v0.7.5 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } API Reference SurfaceFormatter v0.7.5 ======================================= Modules ---------- [Surface.Formatter](Surface.Formatter.html) Functions for formatting Surface code snippets. [Surface.Formatter.NodeTranslator](Surface.Formatter.NodeTranslator.html) [Surface.Formatter.Phase](Surface.Formatter.Phase.html) A phase implementing a single "rule" for formatting code. These work as middleware between `Surface.Compiler.Parser.parse` and `Surface.Formatter.Render.node/2` to modify node lists before they are rendered. [Surface.Formatter.Phases.BlockExceptions](Surface.Formatter.Phases.BlockExceptions.html) Handle exceptional case for blocks. [Surface.Formatter.Phases.FinalNewline](Surface.Formatter.Phases.FinalNewline.html) Add a newline after all of the nodes if one was present on the original input [Surface.Formatter.Phases.Indent](Surface.Formatter.Phases.Indent.html) Adds indentation nodes (`:indent` and `:indent_one_less`) where appropriate. [Surface.Formatter.Phases.Newlines](Surface.Formatter.Phases.Newlines.html) Standardizes usage of newlines. [Surface.Formatter.Phases.Render](Surface.Formatter.Phases.Render.html) Render the formatted Surface code after it has run through the other transforming phases. [Surface.Formatter.Phases.SpacesToNewlines](Surface.Formatter.Phases.SpacesToNewlines.html) In a variety of scenarios, converts :space nodes to :newline nodes. [Surface.Formatter.Phases.TagWhitespace](Surface.Formatter.Phases.TagWhitespace.html) Inspects all text nodes and "tags" leading and trailing whitespace by converting it into a `:space` atom or a list of `:newline` atoms. [Surface.Formatter.Plugin](Surface.Formatter.Plugin.html) An [Elixir formatter plugin](https://hexdocs.pm/mix/1.13.0-rc.1/Mix.Tasks.Format.html#module-plugins) for Surface code. Mix Tasks ------------ [mix surface.format](Mix.Tasks.Surface.Format.html) **To format Surface code using Elixir 1.13 or later, use [`Surface.Formatter.Plugin`](Surface.Formatter.Plugin.html).**
html_entities
hex
HtmlEntities β€” HtmlEntities v0.5.2 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } HtmlEntities ============ [![Module Version](https://img.shields.io/hexpm/v/html_entities.svg)](https://hex.pm/packages/html_entities) [![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/html_entities/) [![Total Download](https://img.shields.io/hexpm/dt/html_entities.svg)](https://hex.pm/packages/html_entities) [![License](https://img.shields.io/hexpm/l/html_entities.svg)](https://github.com/martinsvalin/html_entities/blob/master/LICENSE) [![Last Updated](https://img.shields.io/github/last-commit/martinsvalin/html_entities.svg)](https://github.com/martinsvalin/html_entities/commits/master) Elixir module for decoding and encoding HTML entities in a string. Entity names, codepoints and their corresponding characters are copied from [Wikipedia](https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references). Installation --------------- Add the dependency to your `mix.exs` file, then run [`mix deps.get`](https://hexdocs.pm/mix/Mix.Tasks.Deps.Get.html). ``` defp deps do [ {:html\_entities, "~> 0.5"} ] end ``` Usage -------- Inside IEx: ``` iex> HtmlEntities.decode("Tom &amp; Jerry") "Tom & Jerry" iex> HtmlEntities.decode("&#161;Ay, caramba!") "Β‘Ay, caramba!" iex> HtmlEntities.encode("<< KAPOW!! >>") "&lt;&lt; KAPOW!! &gt;&gt;" ``` Inside a module: ``` defmodule EntityTest do def non\_breaking\_space do HtmlEntities.decode("&#161;") end end ``` License ---------- Copyright (c) 2015 Martin Svalin This library is MIT licensed. See the [LICENSE](https://github.com/martinsvalin/html_entities/blob/master/LICENSE) for details. HtmlEntities β€” HtmlEntities v0.5.2 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } HtmlEntities (HtmlEntities v0.5.2) [View Source](https://github.com/martinsvalin/html_entities/blob/v0.5.2/lib/html_entities.ex#L1 "View Source") =================================================================================================================================================== Decode and encode HTML entities in a string. Examples ----------- Decoding: ``` iex> "Tom &amp; Jerry" |> HtmlEntities.decode "Tom & Jerry" iex> "&#161;Ay, caramba!" |> HtmlEntities.decode "Β‘Ay, caramba!" iex> "&#337; &#x151;" |> HtmlEntities.decode "Ε‘ Ε‘" ``` Encoding: ``` iex> "Tom & Jerry" |> HtmlEntities.encode "Tom &amp; Jerry" iex> "<< KAPOW!! >>" |> HtmlEntities.encode "&lt;&lt; KAPOW!! &gt;&gt;" ``` [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [decode(string)](#decode/1) Decode HTML entities in a string. [encode(string)](#encode/1) Encode HTML entities in a string. [Link to this section](#functions) Functions ============================================= [Link to this function](#decode/1 "Link to this function") decode(string) ============== [View Source](https://github.com/martinsvalin/html_entities/blob/v0.5.2/lib/html_entities.ex#L28 "View Source") Specs ----- ``` decode([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Decode HTML entities in a string. [Link to this function](#encode/1 "Link to this function") encode(string) ============== [View Source](https://github.com/martinsvalin/html_entities/blob/v0.5.2/lib/html_entities.ex#L77 "View Source") Specs ----- ``` encode([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() ``` Encode HTML entities in a string. HtmlEntities.Util β€” HtmlEntities v0.5.2 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } HtmlEntities.Util (HtmlEntities v0.5.2) [View Source](https://github.com/martinsvalin/html_entities/blob/v0.5.2/lib/html_entities/util.ex#L1 "View Source") ============================================================================================================================================================= Utility functions for managing metadata. Putting this code here makes it testable, and allows the code generation part of HtmlEntities to be as small as possible. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [entity()](#t:entity/0) [Functions](#functions) ------------------------ [convert\_line\_to\_entity(line)](#convert_line_to_entity/1) Converts a line of comma-separated lines to entity definitions. [load\_entities(filename)](#load_entities/1) Load HTML entities from an external file. [Link to this section](#types) Types ===================================== [Link to this type](#t:entity/0 "Link to this type") entity() ======== [View Source](https://github.com/martinsvalin/html_entities/blob/v0.5.2/lib/html_entities/util.ex#L9 "View Source") Specs ----- ``` entity() :: {[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#convert_line_to_entity/1 "Link to this function") convert\_line\_to\_entity(line) =============================== [View Source](https://github.com/martinsvalin/html_entities/blob/v0.5.2/lib/html_entities/util.ex#L19 "View Source") Specs ----- ``` convert_line_to_entity([[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | [File.Stream.t](https://hexdocs.pm/elixir/File.Stream.html#t:t/0)()) :: [entity](#t:entity/0)() ``` Converts a line of comma-separated lines to entity definitions. [Link to this function](#load_entities/1 "Link to this function") load\_entities(filename) ======================== [View Source](https://github.com/martinsvalin/html_entities/blob/v0.5.2/lib/html_entities/util.ex#L13 "View Source") Specs ----- ``` load_entities([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) :: [[entity](#t:entity/0)()] ``` Load HTML entities from an external file. API Reference β€” HtmlEntities v0.5.2 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } API Reference HtmlEntities v0.5.2 =================================== Modules ---------- [HtmlEntities](HtmlEntities.html) Decode and encode HTML entities in a string. [HtmlEntities.Util](HtmlEntities.Util.html) Utility functions for managing metadata.
meex
hex
API Reference – meex v1.4.1 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; meex v1.4.1 API Reference =========================== Modules ---------- [MEEx](MEEx.html) MEx stands for Embedded Elixir. It allows you to embed Elixir code inside a string in a robust way [MEEx.Engine](MEEx.Engine.html) Basic MEx engine that ships with Elixir [MEEx.SmartEngine](MEEx.SmartEngine.html) The default engine used by MEEx Exceptions ------------- [MEEx.SyntaxError](MEEx.SyntaxError.html) MEEx – meex v1.4.1 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; meex v1.4.1 MEEx ================== MEx stands for Embedded Elixir. It allows you to embed Elixir code inside a string in a robust way. ``` iex> MEEx.eval_string "foo {%= bar %}", [bar: "baz"] "foo baz" ``` API ------ This module provides 3 main APIs for you to use: 1. Evaluate a string (`eval_string`) or a file (`eval_file`) directly. This is the simplest API to use but also the slowest, since the code is evaluated and not compiled before. 2. Define a function from a string (`function_from_string`) or a file (`function_from_file`). This allows you to embed the template as a function inside a module which will then be compiled. This is the preferred API if you have access to the template at compilation time. 3. Compile a string (`compile_string`) or a file (`compile_file`) into Elixir syntax tree. This is the API used by both functions above and is available to you if you want to provide your own ways of handling the compiled template. Options ---------- All functions in this module accept MEx-related options. They are: * `:line` - the line to be used as the template start. Defaults to 1. * `:file` - the file to be used in the template. Defaults to the given file the template is read from or to β€œnofile” when compiling from a string. * `:engine` - the MEx engine to be used for compilation. * `:trim` - trims whitespace left/right of quotation tags Engine --------- MEx has the concept of engines which allows you to modify or transform the code extracted from the given string or file. By default, `MEx` uses the [`MEEx.SmartEngine`](MEEx.SmartEngine.html) that provides some conveniences on top of the simple [`MEEx.Engine`](MEEx.Engine.html). ### Tags [`MEEx.SmartEngine`](MEEx.SmartEngine.html) supports the following tags: ``` {% Elixir expression - inline with output %} {%= Elixir expression - replace with result %} {%% MEx quotation - returns the contents inside %} {%# Comments - they are discarded from source %} ``` All expressions that output something to the template **must** use the equals sign (`=`). Since everything in Elixir is an expression, there are no exceptions for this rule. For example, while some template languages would special-case `if/2` clauses, they are treated the same in MEx and also require `=` in order to have their result printed: ``` {%= if true do %} It is obviously true {% else %} This will never appear {% end %} ``` Notice that different engines may have different rules for each tag. Other tags may be added in future versions. ### Macros [`MEEx.SmartEngine`](MEEx.SmartEngine.html) also adds some macros to your template. An example is the `@` macro which allows easy data access in a template: ``` iex> MEEx.eval_string "{%= @foo %}", assigns: [foo: 1] "1" ``` In other words, `{%= @foo %}` translates to: ``` {%= {:ok, v} = Access.fetch(assigns, :foo); v %} ``` The `assigns` extension is useful when the number of variables required by the template is not specified at compilation time. Summary ========== [Functions](#functions) ------------------------ [compile\_file(filename, options \\ [])](#compile_file/2) Gets a `filename` and generate a quoted expression that can be evaluated by Elixir or compiled to a function [compile\_string(source, options \\ [])](#compile_string/2) Gets a string `source` and generate a quoted expression that can be evaluated by Elixir or compiled to a function [eval\_file(filename, bindings \\ [], options \\ [])](#eval_file/3) Gets a `filename` and evaluate the values using the `bindings` [eval\_string(source, bindings \\ [], options \\ [])](#eval_string/3) Gets a string `source` and evaluate the values using the `bindings` [Macros](#macros) ------------------ [function\_from\_file(kind, name, file, args \\ [], options \\ [])](#function_from_file/5) Generates a function definition from the file contents [function\_from\_string(kind, name, source, args \\ [], options \\ [])](#function_from_string/5) Generates a function definition from the string Functions ============ compile\_file(filename, options \\ []) ``` compile_file([String.t](https://hexdocs.pm/elixir/String.html#t:t/0), [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)) :: [Macro.t](https://hexdocs.pm/elixir/Macro.html#t:t/0) | no_return ``` Gets a `filename` and generate a quoted expression that can be evaluated by Elixir or compiled to a function. compile\_string(source, options \\ []) ``` compile_string([String.t](https://hexdocs.pm/elixir/String.html#t:t/0), [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)) :: [Macro.t](https://hexdocs.pm/elixir/Macro.html#t:t/0) | no_return ``` Gets a string `source` and generate a quoted expression that can be evaluated by Elixir or compiled to a function. eval\_file(filename, bindings \\ [], options \\ []) ``` eval_file([String.t](https://hexdocs.pm/elixir/String.html#t:t/0), [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0), [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)) :: any ``` Gets a `filename` and evaluate the values using the `bindings`. Examples ----------- ``` # sample.mex foo {%= bar %} # iex MEEx.eval_file "sample.mex", [bar: "baz"] #=> "foo baz" ``` eval\_string(source, bindings \\ [], options \\ []) ``` eval_string([String.t](https://hexdocs.pm/elixir/String.html#t:t/0), [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0), [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)) :: any ``` Gets a string `source` and evaluate the values using the `bindings`. Examples ----------- ``` iex> MEEx.eval_string "foo {%= bar %}", [bar: "baz"] "foo baz" ``` Macros ========= function\_from\_file(kind, name, file, args \\ [], options \\ []) Generates a function definition from the file contents. The kind (`:def` or `:defp`) must be given, the function name, its arguments and the compilation options. This function is useful in case you have templates but you want to precompile inside a module for speed. Examples ----------- ``` # sample.mex {%= a + b %} # sample.ex defmodule Sample do require MEx MEEx.function_from_file :def, :sample, "sample.mex", [:a, :b] end # iex Sample.sample(1, 2) #=> "3" ``` function\_from\_string(kind, name, source, args \\ [], options \\ []) Generates a function definition from the string. The kind (`:def` or `:defp`) must be given, the function name, its arguments and the compilation options. Examples ----------- ``` iex> defmodule Sample do ...> require MEx ...> MEEx.function_from_string :def, :sample, "{%= a + b %}", [:a, :b] ...> end iex> Sample.sample(1, 2) "3" ``` MEEx.Engine – meex v1.4.1 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; meex v1.4.1 MEEx.Engine behaviour ====================================== Basic MEx engine that ships with Elixir. An engine needs to implement four functions: * `init(opts)` - returns the initial buffer * `handle_body(quoted)` - receives the final built quoted expression, should do final post-processing and return a quoted expression. * `handle_text(buffer, text)` - it receives the buffer, the text and must return a new quoted expression. * `handle_expr(buffer, marker, expr)` - it receives the buffer, the marker, the expr and must return a new quoted expression. The marker is what follows exactly after `{%`. For example, `{% foo %}` has an empty marker, but `{%= foo %}` has `"="` as marker. The allowed markers so far are: `""` and `"="`. Read [`handle_expr/3`](#handle_expr/3) below for more information about the markers implemented by default by this engine. [`MEEx.Engine`](MEEx.Engine.html#content) can be used directly if one desires to use the default implementations for the functions above. Summary ========== [Functions](#functions) ------------------------ [handle\_assign(arg)](#handle_assign/1) Handles assigns in quoted expressions [handle\_body(quoted)](#handle_body/1) The default implementation simply returns the given expression [handle\_expr(buffer, binary, expr)](#handle_expr/3) Implements expressions according to the markers [handle\_text(buffer, text)](#handle_text/2) The default implementation simply concatenates text to the buffer [init(opts)](#init/1) Returns an empty string as initial buffer [Callbacks](#callbacks) ------------------------ [handle\_body(quoted)](#c:handle_body/1) [handle\_expr(buffer, marker, expr)](#c:handle_expr/3) [handle\_text(buffer, text)](#c:handle_text/2) [init(opts)](#c:init/1) Functions ============ handle\_assign(arg) ``` handle_assign([Macro.t](https://hexdocs.pm/elixir/Macro.html#t:t/0)) :: [Macro.t](https://hexdocs.pm/elixir/Macro.html#t:t/0) ``` Handles assigns in quoted expressions. A warning will be printed on missing assigns. Future versions will raise. This can be added to any custom engine by invoking [`handle_assign/1`](#handle_assign/1) with [`Macro.prewalk/2`](https://hexdocs.pm/elixir/Macro.html#prewalk/2): ``` def handle_expr(buffer, token, expr) do expr = Macro.prewalk(expr, &MEEx.Engine.handle_assign/1) MEEx.Engine.handle_expr(buffer, token, expr) end ``` handle\_body(quoted) The default implementation simply returns the given expression. handle\_expr(buffer, binary, expr) Implements expressions according to the markers. ``` {% Elixir expression - inline with output %} {%= Elixir expression - replace with result %} ``` All other markers are not implemented by this engine. handle\_text(buffer, text) The default implementation simply concatenates text to the buffer. init(opts) Returns an empty string as initial buffer. Callbacks ============ handle\_body(quoted) ``` handle_body(quoted :: [Macro.t](https://hexdocs.pm/elixir/Macro.html#t:t/0)) :: [Macro.t](https://hexdocs.pm/elixir/Macro.html#t:t/0) ``` handle\_expr(buffer, marker, expr) ``` handle_expr(buffer :: [Macro.t](https://hexdocs.pm/elixir/Macro.html#t:t/0), marker :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0), expr :: [Macro.t](https://hexdocs.pm/elixir/Macro.html#t:t/0)) :: [Macro.t](https://hexdocs.pm/elixir/Macro.html#t:t/0) ``` handle\_text(buffer, text) ``` handle_text(buffer :: [Macro.t](https://hexdocs.pm/elixir/Macro.html#t:t/0), text :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)) :: [Macro.t](https://hexdocs.pm/elixir/Macro.html#t:t/0) ``` init(opts) ``` init(opts :: [Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)) :: [Macro.t](https://hexdocs.pm/elixir/Macro.html#t:t/0) ``` MEEx.SmartEngine – meex v1.4.1 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; meex v1.4.1 MEEx.SmartEngine ============================== The default engine used by MEEx. It includes assigns (like `@foo`) and possibly other conveniences in the future. Examples ----------- ``` iex> MEEx.eval_string("{%= @foo %}", assigns: [foo: 1]) "1" ``` In the example above, we can access the value `foo` under the binding `assigns` using `@foo`. This is useful because a template, after being compiled, can receive different assigns and would not require recompilation for each variable set. Assigns can also be used when compiled to a function: ``` # sample.mex {%= @a + @b %} # sample.ex defmodule Sample do require MEx MEEx.function_from_file :def, :sample, "sample.mex", [:assigns] end # iex Sample.sample(a: 1, b: 2) #=> "3" ``` Summary ========== [Functions](#functions) ------------------------ [handle\_body(quoted)](#handle_body/1) Callback implementation for [`MEEx.Engine.handle_body/1`](MEEx.Engine.html#c:handle_body/1) [handle\_expr(buffer, marker, expr)](#handle_expr/3) Callback implementation for [`MEEx.Engine.handle_expr/3`](MEEx.Engine.html#c:handle_expr/3) [handle\_text(buffer, text)](#handle_text/2) Callback implementation for [`MEEx.Engine.handle_text/2`](MEEx.Engine.html#c:handle_text/2) [init(opts)](#init/1) Callback implementation for [`MEEx.Engine.init/1`](MEEx.Engine.html#c:init/1) Functions ============ handle\_body(quoted) Callback implementation for [`MEEx.Engine.handle_body/1`](MEEx.Engine.html#c:handle_body/1). handle\_expr(buffer, marker, expr) Callback implementation for [`MEEx.Engine.handle_expr/3`](MEEx.Engine.html#c:handle_expr/3). handle\_text(buffer, text) Callback implementation for [`MEEx.Engine.handle_text/2`](MEEx.Engine.html#c:handle_text/2). init(opts) Callback implementation for [`MEEx.Engine.init/1`](MEEx.Engine.html#c:init/1). MEEx.SyntaxError – meex v1.4.1 if(localStorage.getItem('night-mode')) document.body.className += ' night-mode'; meex v1.4.1 MEEx.SyntaxError exception =========================================== Summary ========== [Functions](#functions) ------------------------ [exception(msg)](#exception/1) Callback implementation for [`Exception.exception/1`](https://hexdocs.pm/elixir/Exception.html#c:exception/1) [message(exception)](#message/1) Callback implementation for [`Exception.message/1`](https://hexdocs.pm/elixir/Exception.html#c:message/1) Functions ============ exception(msg) ``` exception([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)) :: [Exception.t](https://hexdocs.pm/elixir/Exception.html#t:t/0) ``` ``` exception([Keyword.t](https://hexdocs.pm/elixir/Keyword.html#t:t/0)) :: [Exception.t](https://hexdocs.pm/elixir/Exception.html#t:t/0) ``` Callback implementation for [`Exception.exception/1`](https://hexdocs.pm/elixir/Exception.html#c:exception/1). message(exception) ``` message([Exception.t](https://hexdocs.pm/elixir/Exception.html#t:t/0)) :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0) ``` Callback implementation for [`Exception.message/1`](https://hexdocs.pm/elixir/Exception.html#c:message/1).
wait_for_it
hex
API Reference β€” wait\_for\_it v1.3.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } wait\_for\_it v1.3.0 API Reference ==================================== Modules ---------- [WaitForIt](WaitForIt.html) WaitForIt provides macros for various ways to wait for things to happen. [WaitForIt.ConditionVariable](WaitForIt.ConditionVariable.html) WaitForIt β€” wait\_for\_it v1.3.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } wait\_for\_it v1.3.0 WaitForIt [View Source](https://github.com/jvoegele/wait_for_it/blob/master/lib/wait_for_it.ex#L1 "View Source") ====================================================================================================================================== WaitForIt provides macros for various ways to wait for things to happen. Since most Elixir systems are highly concurrent there must be a way to coordinate and synchronize the processes in the system. While the language provides features (such as [`Process.sleep/1`](https://hexdocs.pm/elixir/Process.html#sleep/1) and `receive`/`after`) that can be used to implement such synchronization, they are inconvenient to use for this purpose. [`WaitForIt`](#content) builds on top of these language features to provide convenient and easy-to-use facilities for synchronizing concurrent activities. While this is likely most useful for test code in which tests must wait for concurrent or asynchronous activities to complete, it is also useful in any scenario where concurrent processes must coordinate their activity. Examples include asynchronous event handling, producer-consumer processes, and time-based activity. There are three distinct forms of waiting provided: 1. The `wait` macro waits until a given expression evaluates to a truthy value. 2. The `case_wait` macro waits until a given expression evaluates to a value that matches any one of the given case clauses (looks like an Elixir `case` expression). 3. The `cond_wait` macro waits until any one of the given expressions evaluates to a truthy value (looks like an Elixir `cond` expression). All three forms accept the same set of options to control their behavior: * `:timeout` - the amount of time to wait (in milliseconds) before giving up * `:frequency` - the polling frequency (in milliseconds) at which to re-evaluate conditions * `:signal` - disable polling and use a condition variable of the given name instead * `:pre_wait` - wait for the given number of milliseconds before evaluating conditions for the first time The `:signal` option warrants further explanation. By default, all three forms of waiting use polling to periodically re-evaluate conditions to determine if waiting should continue. The frequency of polling is controlled by the `:frequency` option. However, if the `:signal` option is given it disables polling altogether. Instead of periodically re-evaluating conditions at a particular frequency, a *condition variable* is used to signal when conditions should be re-evaluated. It is expected that the `signal` macro will be used to unblock the waiting code in order to re-evaluate conditions. For example, imagine a typical producer-consumer problem in which a consumer process waits for items to appear in some buffer while a separate producer process occasionally place items in the buffer. In this scenario, the consumer process might use the `wait` macro with the `:signal` option to wait until there are some items in the buffer and the producer process would use the `signal` macro to tell the consumer that it might be time for it to check the buffer again. ``` # CONSUMER # assume the existence of a `buffer\_size` function WaitForIt.wait buffer\_size() >= 4, signal: :wait\_for\_buffer ``` ``` # PRODUCER # put some things in buffer, then: WaitForIt.signal(:wait\_for\_buffer) ``` Notice that the same condition variable name `:wait_for_buffer` is used in both cases. It is important to note that when using condition variables for signaling like this, both the `wait` invocation and the `signal` invocation should be in the same Elixir module. This is because [`WaitForIt`](#content) uses the calling module as a namespace for condition variable names to prevent accidental name collisions with other registered processes in the application. Also note that just because a condition variable has been signalled does not necessarily mean that any waiters on that condition variable can stop waiting. Rather, a signal indicates that waiters should re-evaluate their waiting conditions to determine if they should continue to wait or not. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [case\_wait(expression, opts \\ [], blocks)](#case_wait/3) Wait until the given `expression` matches one of the case clauses in the given block. [cond\_wait(opts \\ [], blocks)](#cond_wait/2) Wait until one of the expressions in the given block evaluates to a truthy value. [signal(condition\_var)](#signal/1) Send a signal to the given condition variable to indicate that any processes waiting on the condition variable should re-evaluate their wait conditions. [wait(expression, opts \\ [])](#wait/2) Wait until the given `expression` evaluates to a truthy value. [Link to this section](#functions) Functions ============================================= [Link to this macro](#case_wait/3 "Link to this macro") case\_wait(expression, opts \\ [], blocks) ========================================== [View Source](https://github.com/jvoegele/wait_for_it/blob/master/lib/wait_for_it.ex#L181 "View Source") (macro) Wait until the given `expression` matches one of the case clauses in the given block. Returns the value of the matching clause, the value of the optional `else` clause, or a tuple of the form `{:timeout, timeout_milliseconds}`. The `do` block passed to this macro must be a series of case clauses exactly like a built-in Elixir `case` expression. Just like a `case` expression, the clauses will attempt to be matched from top to bottom and the first one that matches will provide the resulting value of the expression. The difference with `case_wait` is that if none of the clauses initially matches it will wait and periodically re-evaluate the clauses until one of them does match or a timeout occurs. An optional `else` clause may also be used to provide the value in case of a timeout. If an `else` clause is provided and a timeout occurs, then the `else` clause will be evaluated and the resulting value of the `else` clause becomes the value of the `case_wait` expression. If no `else` clause is provided and a timeout occurs, then the value of the `case_wait` expression is a tuple of the form `{:timeout, timeout_milliseconds}`. The optional `else` clause may also take the form of match clauses, such as those in a case expression. In this form, the `else` clause can match on the final value of the expression that was evaluated before the timeout occurred. See the examples below for an example of this. Options ---------- See the WaitForIt module documentation for further discussion of these options. * `:timeout` - the amount of time to wait (in milliseconds) before giving up * `:frequency` - the polling frequency (in milliseconds) at which to re-evaluate conditions * `:signal` - disable polling and use a condition variable of the given name instead * `:pre_wait` - wait for the given number of milliseconds before evaluating conditions for the first time Examples ----------- Wait until queue has at least 5 messages, then return them: ``` WaitForIt.case\_wait Queue.get\_messages(queue), timeout: 30\_000, frequency: 100 do messages when length(messages) > 4 -> messages else # If after 30 seconds we still don't have 5 messages, just return the messages we do have. messages -> messages end ``` A thermostat that keeps temperature in a small range: ``` def thermostat(desired\_temperature) do WaitForIt.case\_wait get\_current\_temperature() do temp when temp > desired\_temperature + 2 -> turn\_on\_air\_conditioning() temp when temp < desired\_temperature - 2 -> turn\_on\_heat() end thermostat(desired\_temperature) end ``` Ring the church bells every 15 minutes: ``` def church\_bell\_chimes do count = WaitForIt.case\_wait Time.utc\_now.minute, frequency: 60\_000, timeout: 60\_000 \* 60 do 15 -> 1 30 -> 2 45 -> 3 0 -> 4 end IO.puts(String.duplicate(" ding ding ding dong ", count)) church\_bell\_chimes() end ``` [Link to this macro](#cond_wait/2 "Link to this macro") cond\_wait(opts \\ [], blocks) ============================== [View Source](https://github.com/jvoegele/wait_for_it/blob/master/lib/wait_for_it.ex#L247 "View Source") (macro) Wait until one of the expressions in the given block evaluates to a truthy value. Returns the value corresponding with the matching expression, the value of the optional `else` clause, or a tuple of the form `{:timeout, timeout_milliseconds}`. The `do` block passed to this macro must be a series of expressions exactly like a built-in Elixir `cond` expression. Just like a `cond` expression, the embedded expresions will be evaluated from top to bottom and the first one that is truthy will provide the resulting value of the expression. The difference with `cond_wait` is that if none of the expressions is initially truthy it will wait and periodically re-evaluate them until one of them becomes truthy or a timeout occurs. An optional `else` clause may also be used to provide the value in case of a timeout. If an `else` clause is provided and a timeout occurs, then the `else` clause will be evaluated and the resulting value of the `else` clause becomes the value of the `cond_wait` expression. If no `else` clause is provided and a timeout occurs, then the value of the `cond_wait` expression is a tuple of the form `{:timeout, timeout_milliseconds}`. Options ---------- See the WaitForIt module documentation for further discussion of these options. * `:timeout` - the amount of time to wait (in milliseconds) before giving up * `:frequency` - the polling frequency (in milliseconds) at which to re-evaluate conditions * `:signal` - disable polling and use a condition variable of the given name instead * `:pre_wait` - wait for the given number of milliseconds before evaluating conditions for the first time Examples ----------- Trigger an alarm when any sensors go beyond a threshold: ``` def sound\_the\_alarm do WaitForIt.cond\_wait timeout: 60\_000 \* 60 \* 24 do read\_sensor(:sensor1) > 9 -> IO.puts("Alarm: :sensor1 too high!") read\_sensor(:sensor2) < 100 -> IO.puts("Alarm: :sensor2 too low!") read\_sensor(:sensor3) < 0 -> IO.puts("Alarm: :sensor3 below zero!") else IO.puts("All is good...for now.") end sound\_the\_alarm() end ``` [Link to this macro](#signal/1 "Link to this macro") signal(condition\_var) ====================== [View Source](https://github.com/jvoegele/wait_for_it/blob/master/lib/wait_for_it.ex#L277 "View Source") (macro) Send a signal to the given condition variable to indicate that any processes waiting on the condition variable should re-evaluate their wait conditions. The caller of `signal` must be in the same Elixir module as any waiters on the same condition variable since the module is used as a namespace for condition variables. This is to prevent accidental name collisions as well as to enforce good practice for encapsulation. [Link to this macro](#wait/2 "Link to this macro") wait(expression, opts \\ []) ============================ [View Source](https://github.com/jvoegele/wait_for_it/blob/master/lib/wait_for_it.ex#L94 "View Source") (macro) Wait until the given `expression` evaluates to a truthy value. Returns `{:ok, value}` or `{:timeout, timeout_milliseconds}`. Options ---------- See the WaitForIt module documentation for further discussion of these options. * `:timeout` - the amount of time to wait (in milliseconds) before giving up * `:frequency` - the polling frequency (in milliseconds) at which to re-evaluate conditions * `:signal` - disable polling and use a condition variable of the given name instead * `:pre_wait` - wait for the given number of milliseconds before evaluating conditions for the first time Examples ----------- Wait until the top of the hour: ``` WaitForIt.wait Time.utc\_now.minute == 0, frequency: 60\_000, timeout: 60\_000 \* 60 ``` Wait up to one minute for a particular record to appear in the database: ``` case WaitForIt.wait Repo.get(Post, 42), frequency: 1000, timeout: 60\_000 do {:ok, data} -> IO.inspect(data) {:timeout, timeout} -> IO.puts("Gave up after #{timeout} milliseconds") end ``` WaitForIt.ConditionVariable β€” wait\_for\_it v1.3.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } wait\_for\_it v1.3.0 WaitForIt.ConditionVariable [View Source](https://github.com/jvoegele/wait_for_it/blob/master/lib/wait_for_it/condition_variable.ex#L1 "View Source") =========================================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [child\_spec(init\_arg)](#child_spec/1) Returns a specification to start this module under a supervisor. [registry()](#registry/0) [signal(condition\_var)](#signal/1) [start\_link()](#start_link/0) [start\_link(opts)](#start_link/1) [wait(condition\_var, opts \\ [])](#wait/2) [Link to this section](#functions) Functions ============================================= [Link to this function](#child_spec/1 "Link to this function") child\_spec(init\_arg) ====================== [View Source](https://github.com/jvoegele/wait_for_it/blob/master/lib/wait_for_it/condition_variable.ex#L2 "View Source") Returns a specification to start this module under a supervisor. See [`Supervisor`](https://hexdocs.pm/elixir/Supervisor.html). [Link to this function](#registry/0 "Link to this function") registry() ========== [View Source](https://github.com/jvoegele/wait_for_it/blob/master/lib/wait_for_it/condition_variable.ex#L23 "View Source") [Link to this function](#signal/1 "Link to this function") signal(condition\_var) ====================== [View Source](https://github.com/jvoegele/wait_for_it/blob/master/lib/wait_for_it/condition_variable.ex#L25 "View Source") [Link to this function](#start_link/0 "Link to this function") start\_link() ============= [View Source](https://github.com/jvoegele/wait_for_it/blob/master/lib/wait_for_it/condition_variable.ex#L10 "View Source") [Link to this function](#start_link/1 "Link to this function") start\_link(opts) ================= [View Source](https://github.com/jvoegele/wait_for_it/blob/master/lib/wait_for_it/condition_variable.ex#L12 "View Source") [Link to this function](#wait/2 "Link to this function") wait(condition\_var, opts \\ []) ================================ [View Source](https://github.com/jvoegele/wait_for_it/blob/master/lib/wait_for_it/condition_variable.ex#L28 "View Source")
devtools
hex
API Reference β€” devtools v2.0.9 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } API Reference devtools v2.0.9 =============================== Modules ---------- [Devtools](Devtools.html) [Mix.Devtools.Common](Mix.Devtools.Common.html) [Mix.Devtools.Versions](Mix.Devtools.Versions.html) Mix Tasks ------------ [mix devtools.copy\_migrations](Mix.Tasks.Devtools.CopyMigrations.html) [mix devtools.docker\_build](Mix.Tasks.Devtools.DockerBuild.html) [mix devtools.docker\_push](Mix.Tasks.Devtools.DockerPush.html) [mix devtools.init\_test](Mix.Tasks.Devtools.InitTest.html) [mix devtools.major](Mix.Tasks.Devtools.Major.html) [mix devtools.minor](Mix.Tasks.Devtools.Minor.html) [mix devtools.patch](Mix.Tasks.Devtools.Patch.html) [mix devtools.pre](Mix.Tasks.Devtools.Pre.html) [mix devtools.pre\_commit\_hook](Mix.Tasks.Devtools.PreCommitHook.html) [mix devtools.remote\_console](Mix.Tasks.Devtools.RemoteConsole.html) [mix devtools.tag](Mix.Tasks.Devtools.Tag.html) Devtools β€” devtools v2.0.9 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } Devtools (devtools v2.0.9) =========================== Mix.Devtools.Common β€” devtools v2.0.9 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } Mix.Devtools.Common (devtools v2.0.9) ====================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [migrations\_path()](#migrations_path/0) [root\_path()](#root_path/0) [scripts\_path()](#scripts_path/0) [Link to this section](#functions) Functions ============================================= [Link to this function](#migrations_path/0 "Link to this function") migrations\_path() ================== [Link to this function](#root_path/0 "Link to this function") root\_path() ============ [Link to this function](#scripts_path/0 "Link to this function") scripts\_path() =============== Mix.Devtools.Versions β€” devtools v2.0.9 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } Mix.Devtools.Versions (devtools v2.0.9) ======================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [increment(versions)](#increment/1) [Link to this section](#functions) Functions ============================================= [Link to this function](#increment/1 "Link to this function") increment(versions) =================== mix devtools.copy\_migrations β€” devtools v2.0.9 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } mix devtools.copy\_migrations (devtools v2.0.9) ================================================ [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [run(args)](#run/1) Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1). [Link to this section](#functions) Functions ============================================= [Link to this function](#run/1 "Link to this function") run(args) ========= Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1). mix devtools.docker\_build β€” devtools v2.0.9 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } mix devtools.docker\_build (devtools v2.0.9) ============================================= [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [run(args)](#run/1) Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1). [Link to this section](#functions) Functions ============================================= [Link to this function](#run/1 "Link to this function") run(args) ========= Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1). mix devtools.docker\_push β€” devtools v2.0.9 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } mix devtools.docker\_push (devtools v2.0.9) ============================================ [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [run(args)](#run/1) Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1). [Link to this section](#functions) Functions ============================================= [Link to this function](#run/1 "Link to this function") run(args) ========= Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1). mix devtools.init\_test β€” devtools v2.0.9 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } mix devtools.init\_test (devtools v2.0.9) ========================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [run(args)](#run/1) Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1). [Link to this section](#functions) Functions ============================================= [Link to this function](#run/1 "Link to this function") run(args) ========= Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1). mix devtools.major β€” devtools v2.0.9 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } mix devtools.major (devtools v2.0.9) ===================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [run(args)](#run/1) Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1). [Link to this section](#functions) Functions ============================================= [Link to this function](#run/1 "Link to this function") run(args) ========= Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1). mix devtools.minor β€” devtools v2.0.9 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } mix devtools.minor (devtools v2.0.9) ===================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [run(args)](#run/1) Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1). [Link to this section](#functions) Functions ============================================= [Link to this function](#run/1 "Link to this function") run(args) ========= Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1). mix devtools.patch β€” devtools v2.0.9 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } mix devtools.patch (devtools v2.0.9) ===================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [run(args)](#run/1) Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1). [Link to this section](#functions) Functions ============================================= [Link to this function](#run/1 "Link to this function") run(args) ========= Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1). mix devtools.pre β€” devtools v2.0.9 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } mix devtools.pre (devtools v2.0.9) =================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [run(args)](#run/1) Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1). [Link to this section](#functions) Functions ============================================= [Link to this function](#run/1 "Link to this function") run(args) ========= Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1). mix devtools.pre\_commit\_hook β€” devtools v2.0.9 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } mix devtools.pre\_commit\_hook (devtools v2.0.9) ================================================= [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [run(args)](#run/1) Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1). [Link to this section](#functions) Functions ============================================= [Link to this function](#run/1 "Link to this function") run(args) ========= Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1). mix devtools.remote\_console β€” devtools v2.0.9 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } mix devtools.remote\_console (devtools v2.0.9) =============================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [run(args)](#run/1) Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1). [Link to this section](#functions) Functions ============================================= [Link to this function](#run/1 "Link to this function") run(args) ========= Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1). mix devtools.tag β€” devtools v2.0.9 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } mix devtools.tag (devtools v2.0.9) =================================== [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [run(args)](#run/1) Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1). [Link to this section](#functions) Functions ============================================= [Link to this function](#run/1 "Link to this function") run(args) ========= Callback implementation for [`Mix.Task.run/1`](https://hexdocs.pm/mix/Mix.Task.html#c:run/1).
google_api_accelerated_mobile_page_url
hex
API Reference β€” google\_api\_accelerated\_mobile\_page\_url v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } API Reference google\_api\_accelerated\_mobile\_page\_url v0.11.0 =================================================================== Modules ---------- [GoogleApi.AcceleratedMobilePageUrl.V1](GoogleApi.AcceleratedMobilePageUrl.V1.html) API client metadata for GoogleApi.AcceleratedMobilePageUrl.V1. [GoogleApi.AcceleratedMobilePageUrl.V1.Api.AmpUrls](GoogleApi.AcceleratedMobilePageUrl.V1.Api.AmpUrls.html) API calls for all endpoints tagged `AmpUrls`. [GoogleApi.AcceleratedMobilePageUrl.V1.Connection](GoogleApi.AcceleratedMobilePageUrl.V1.Connection.html) Handle Tesla connections for GoogleApi.AcceleratedMobilePageUrl.V1. [GoogleApi.AcceleratedMobilePageUrl.V1.Model.AmpUrl](GoogleApi.AcceleratedMobilePageUrl.V1.Model.AmpUrl.html) AMP URL response for a requested URL. [GoogleApi.AcceleratedMobilePageUrl.V1.Model.AmpUrlError](GoogleApi.AcceleratedMobilePageUrl.V1.Model.AmpUrlError.html) AMP URL Error resource for a requested URL that couldn't be found. [GoogleApi.AcceleratedMobilePageUrl.V1.Model.BatchGetAmpUrlsRequest](GoogleApi.AcceleratedMobilePageUrl.V1.Model.BatchGetAmpUrlsRequest.html) AMP URL request for a batch of URLs. [GoogleApi.AcceleratedMobilePageUrl.V1.Model.BatchGetAmpUrlsResponse](GoogleApi.AcceleratedMobilePageUrl.V1.Model.BatchGetAmpUrlsResponse.html) Batch AMP URL response. GoogleApi.AcceleratedMobilePageUrl.V1 β€” google\_api\_accelerated\_mobile\_page\_url v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } GoogleApi.AcceleratedMobilePageUrl.V1 (google\_api\_accelerated\_mobile\_page\_url v0.11.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/metadata.ex#L18 "View Source") ==================================================================================================================================================================================================================================================================================================== API client metadata for GoogleApi.AcceleratedMobilePageUrl.V1. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [discovery\_revision()](#discovery_revision/0) [Link to this section](#functions) Functions ============================================= [Link to this function](#discovery_revision/0 "Link to this function") discovery\_revision() ===================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/metadata.ex#L25 "View Source") GoogleApi.AcceleratedMobilePageUrl.V1.Api.AmpUrls β€” google\_api\_accelerated\_mobile\_page\_url v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } GoogleApi.AcceleratedMobilePageUrl.V1.Api.AmpUrls (google\_api\_accelerated\_mobile\_page\_url v0.11.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/api/amp_urls.ex#L18 "View Source") ==================================================================================================================================================================================================================================================================================================================== API calls for all endpoints tagged `AmpUrls`. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [acceleratedmobilepageurl\_amp\_urls\_batch\_get(connection, optional\_params \\ [], opts \\ [])](#acceleratedmobilepageurl_amp_urls_batch_get/3) Returns AMP URL(s) and equivalent [AMP Cache URL(s)](/amp/cache/overview#amp-cache-url-format). [Link to this section](#functions) Functions ============================================= [Link to this function](#acceleratedmobilepageurl_amp_urls_batch_get/3 "Link to this function") acceleratedmobilepageurl\_amp\_urls\_batch\_get(connection, optional\_params \\ [], opts \\ []) =============================================================================================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/api/amp_urls.ex#L59 "View Source") Specs ----- ``` acceleratedmobilepageurl_amp_urls_batch_get( [Tesla.Env.client](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:client/0)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ) :: {:ok, [GoogleApi.AcceleratedMobilePageUrl.V1.Model.BatchGetAmpUrlsResponse.t](GoogleApi.AcceleratedMobilePageUrl.V1.Model.BatchGetAmpUrlsResponse.html#t:t/0)()} | {:ok, [Tesla.Env.t](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:t/0)()} | {:ok, [list](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | {:error, [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` Returns AMP URL(s) and equivalent [AMP Cache URL(s)](/amp/cache/overview#amp-cache-url-format). Parameters ------------- * `connection` (*type:* `GoogleApi.AcceleratedMobilePageUrl.V1.Connection.t`) - Connection to server * `optional_params` (*type:* `keyword()`) - Optional parameters + `:"$.xgafv"` (*type:* `String.t`) - V1 error format. + `:access_token` (*type:* `String.t`) - OAuth access token. + `:alt` (*type:* `String.t`) - Data format for response. + `:callback` (*type:* `String.t`) - JSONP + `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response. + `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user. + `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks. + `:quotaUser` (*type:* `String.t`) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + `:uploadType` (*type:* `String.t`) - Legacy upload protocol for media (e.g. "media", "multipart"). + `:upload_protocol` (*type:* `String.t`) - Upload protocol for media (e.g. "raw", "multipart"). + `:body` (*type:* `GoogleApi.AcceleratedMobilePageUrl.V1.Model.BatchGetAmpUrlsRequest.t`) - * `opts` (*type:* `keyword()`) - Call options Returns ---------- * `{:ok, %GoogleApi.AcceleratedMobilePageUrl.V1.Model.BatchGetAmpUrlsResponse{}}` on success * `{:error, info}` on failure GoogleApi.AcceleratedMobilePageUrl.V1.Connection β€” google\_api\_accelerated\_mobile\_page\_url v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } GoogleApi.AcceleratedMobilePageUrl.V1.Connection (google\_api\_accelerated\_mobile\_page\_url v0.11.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/connection.ex#L18 "View Source") ================================================================================================================================================================================================================================================================================================================= Handle Tesla connections for GoogleApi.AcceleratedMobilePageUrl.V1. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [option()](#t:option/0) [t()](#t:t/0) [Functions](#functions) ------------------------ [delete(client, url, opts)](#delete/3) Perform a DELETE request. [delete!(client, url, opts)](#delete!/3) Perform a DELETE request. [execute(connection, request)](#execute/2) Execute a request on this connection [get(client, url, opts)](#get/3) Perform a GET request. [get!(client, url, opts)](#get!/3) Perform a GET request. [head(client, url, opts)](#head/3) Perform a HEAD request. [head!(client, url, opts)](#head!/3) Perform a HEAD request. [new()](#new/0) Configure an authless client connection [new(token)](#new/1) Configure a client connection using a function which yields a Bearer token. [options(client, url, opts)](#options/3) Perform a OPTIONS request. [options!(client, url, opts)](#options!/3) Perform a OPTIONS request. [patch(client, url, body, opts)](#patch/4) Perform a PATCH request. [patch!(client, url, body, opts)](#patch!/4) Perform a PATCH request. [post(client, url, body, opts)](#post/4) Perform a POST request. [post!(client, url, body, opts)](#post!/4) Perform a POST request. [put(client, url, body, opts)](#put/4) Perform a PUT request. [put!(client, url, body, opts)](#put!/4) Perform a PUT request. [request(client \\ %Tesla.Client{}, options)](#request/2) Perform a request. [request!(client \\ %Tesla.Client{}, options)](#request!/2) Perform request and raise in case of error. [trace(client, url, opts)](#trace/3) Perform a TRACE request. [trace!(client, url, opts)](#trace!/3) Perform a TRACE request. [Link to this section](#types) Types ===================================== [Link to this type](#t:option/0 "Link to this type") option() ======== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/connection.ex#L25 "View Source") Specs ----- ``` option() :: {:method, [Tesla.Env.method](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:method/0)()} | {:url, [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:url/0)()} | {:query, [Tesla.Env.query](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:query/0)()} | {:headers, [Tesla.Env.headers](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:headers/0)()} | {:body, [Tesla.Env.body](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:body/0)()} | {:opts, [Tesla.Env.opts](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:opts/0)()} ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/connection.ex#L23 "View Source") Specs ----- ``` t() :: [Tesla.Env.client](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:client/0)() ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#delete/3 "Link to this function") delete(client, url, opts) ========================= [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/connection.ex#L25 "View Source") Specs ----- ``` delete([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:url/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.result](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:result/0)() ``` Perform a DELETE request. See [`request/1`](#request/1) or [`request/2`](#request/2) for options definition. ``` delete("/users") delete("/users", query: [scope: "admin"]) delete(client, "/users") delete(client, "/users", query: [scope: "admin"]) delete(client, "/users", body: %{name: "Jon"}) ``` [Link to this function](#delete!/3 "Link to this function") delete!(client, url, opts) ========================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/connection.ex#L25 "View Source") Specs ----- ``` delete!([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:url/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.t](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:t/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Perform a DELETE request. See [`request!/1`](#request!/1) or [`request!/2`](#request!/2) for options definition. ``` delete!("/users") delete!("/users", query: [scope: "admin"]) delete!(client, "/users") delete!(client, "/users", query: [scope: "admin"]) delete!(client, "/users", body: %{name: "Jon"}) ``` [Link to this function](#execute/2 "Link to this function") execute(connection, request) ============================ [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/connection.ex#L25 "View Source") Specs ----- ``` execute([Tesla.Client.t](https://hexdocs.pm/tesla/1.4.0/Tesla.Client.html#t:t/0)(), [GoogleApi.Gax.Request.t](https://hexdocs.pm/google_gax/0.4.0/GoogleApi.Gax.Request.html#t:t/0)()) :: {:ok, [Tesla.Env.t](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:t/0)()} ``` Execute a request on this connection Returns ---------- * `{:ok, Tesla.Env.t}` - If the call was successful * `{:error, reason}` - If the call failed [Link to this function](#get/3 "Link to this function") get(client, url, opts) ====================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/connection.ex#L25 "View Source") Specs ----- ``` get([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:url/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.result](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:result/0)() ``` Perform a GET request. See [`request/1`](#request/1) or [`request/2`](#request/2) for options definition. ``` get("/users") get("/users", query: [scope: "admin"]) get(client, "/users") get(client, "/users", query: [scope: "admin"]) get(client, "/users", body: %{name: "Jon"}) ``` [Link to this function](#get!/3 "Link to this function") get!(client, url, opts) ======================= [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/connection.ex#L25 "View Source") Specs ----- ``` get!([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:url/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.t](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:t/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Perform a GET request. See [`request!/1`](#request!/1) or [`request!/2`](#request!/2) for options definition. ``` get!("/users") get!("/users", query: [scope: "admin"]) get!(client, "/users") get!(client, "/users", query: [scope: "admin"]) get!(client, "/users", body: %{name: "Jon"}) ``` [Link to this function](#head/3 "Link to this function") head(client, url, opts) ======================= [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/connection.ex#L25 "View Source") Specs ----- ``` head([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:url/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.result](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:result/0)() ``` Perform a HEAD request. See [`request/1`](#request/1) or [`request/2`](#request/2) for options definition. ``` head("/users") head("/users", query: [scope: "admin"]) head(client, "/users") head(client, "/users", query: [scope: "admin"]) head(client, "/users", body: %{name: "Jon"}) ``` [Link to this function](#head!/3 "Link to this function") head!(client, url, opts) ======================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/connection.ex#L25 "View Source") Specs ----- ``` head!([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:url/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.t](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:t/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Perform a HEAD request. See [`request!/1`](#request!/1) or [`request!/2`](#request!/2) for options definition. ``` head!("/users") head!("/users", query: [scope: "admin"]) head!(client, "/users") head!(client, "/users", query: [scope: "admin"]) head!(client, "/users", body: %{name: "Jon"}) ``` [Link to this function](#new/0 "Link to this function") new() ===== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/connection.ex#L25 "View Source") Specs ----- ``` new() :: [Tesla.Client.t](https://hexdocs.pm/tesla/1.4.0/Tesla.Client.html#t:t/0)() ``` Configure an authless client connection Returns ---------- * `Tesla.Env.client` [Link to this function](#new/1 "Link to this function") new(token) ========== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/connection.ex#L25 "View Source") Specs ----- ``` new([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) :: [Tesla.Client.t](https://hexdocs.pm/tesla/1.4.0/Tesla.Client.html#t:t/0)() ``` ``` new(([[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] -> [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)())) :: [Tesla.Client.t](https://hexdocs.pm/tesla/1.4.0/Tesla.Client.html#t:t/0)() ``` Configure a client connection using a function which yields a Bearer token. Parameters ------------- * `token_fetcher` (*type:* `list(String.t()) -> String.t()`) - Callback which provides an OAuth2 token given a list of scopes Returns ---------- * `Tesla.Env.client` [Link to this function](#options/3 "Link to this function") options(client, url, opts) ========================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/connection.ex#L25 "View Source") Specs ----- ``` options([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:url/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.result](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:result/0)() ``` Perform a OPTIONS request. See [`request/1`](#request/1) or [`request/2`](#request/2) for options definition. ``` options("/users") options("/users", query: [scope: "admin"]) options(client, "/users") options(client, "/users", query: [scope: "admin"]) options(client, "/users", body: %{name: "Jon"}) ``` [Link to this function](#options!/3 "Link to this function") options!(client, url, opts) =========================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/connection.ex#L25 "View Source") Specs ----- ``` options!([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:url/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.t](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:t/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Perform a OPTIONS request. See [`request!/1`](#request!/1) or [`request!/2`](#request!/2) for options definition. ``` options!("/users") options!("/users", query: [scope: "admin"]) options!(client, "/users") options!(client, "/users", query: [scope: "admin"]) options!(client, "/users", body: %{name: "Jon"}) ``` [Link to this function](#patch/4 "Link to this function") patch(client, url, body, opts) ============================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/connection.ex#L25 "View Source") Specs ----- ``` patch([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:url/0)(), [Tesla.Env.body](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:body/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.result](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:result/0)() ``` Perform a PATCH request. See [`request/1`](#request/1) or [`request/2`](#request/2) for options definition. ``` patch("/users", %{name: "Jon"}) patch("/users", %{name: "Jon"}, query: [scope: "admin"]) patch(client, "/users", %{name: "Jon"}) patch(client, "/users", %{name: "Jon"}, query: [scope: "admin"]) ``` [Link to this function](#patch!/4 "Link to this function") patch!(client, url, body, opts) =============================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/connection.ex#L25 "View Source") Specs ----- ``` patch!([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:url/0)(), [Tesla.Env.body](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:body/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.t](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:t/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Perform a PATCH request. See [`request!/1`](#request!/1) or [`request!/2`](#request!/2) for options definition. ``` patch!("/users", %{name: "Jon"}) patch!("/users", %{name: "Jon"}, query: [scope: "admin"]) patch!(client, "/users", %{name: "Jon"}) patch!(client, "/users", %{name: "Jon"}, query: [scope: "admin"]) ``` [Link to this function](#post/4 "Link to this function") post(client, url, body, opts) ============================= [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/connection.ex#L25 "View Source") Specs ----- ``` post([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:url/0)(), [Tesla.Env.body](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:body/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.result](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:result/0)() ``` Perform a POST request. See [`request/1`](#request/1) or [`request/2`](#request/2) for options definition. ``` post("/users", %{name: "Jon"}) post("/users", %{name: "Jon"}, query: [scope: "admin"]) post(client, "/users", %{name: "Jon"}) post(client, "/users", %{name: "Jon"}, query: [scope: "admin"]) ``` [Link to this function](#post!/4 "Link to this function") post!(client, url, body, opts) ============================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/connection.ex#L25 "View Source") Specs ----- ``` post!([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:url/0)(), [Tesla.Env.body](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:body/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.t](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:t/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Perform a POST request. See [`request!/1`](#request!/1) or [`request!/2`](#request!/2) for options definition. ``` post!("/users", %{name: "Jon"}) post!("/users", %{name: "Jon"}, query: [scope: "admin"]) post!(client, "/users", %{name: "Jon"}) post!(client, "/users", %{name: "Jon"}, query: [scope: "admin"]) ``` [Link to this function](#put/4 "Link to this function") put(client, url, body, opts) ============================ [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/connection.ex#L25 "View Source") Specs ----- ``` put([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:url/0)(), [Tesla.Env.body](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:body/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.result](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:result/0)() ``` Perform a PUT request. See [`request/1`](#request/1) or [`request/2`](#request/2) for options definition. ``` put("/users", %{name: "Jon"}) put("/users", %{name: "Jon"}, query: [scope: "admin"]) put(client, "/users", %{name: "Jon"}) put(client, "/users", %{name: "Jon"}, query: [scope: "admin"]) ``` [Link to this function](#put!/4 "Link to this function") put!(client, url, body, opts) ============================= [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/connection.ex#L25 "View Source") Specs ----- ``` put!([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:url/0)(), [Tesla.Env.body](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:body/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.t](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:t/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Perform a PUT request. See [`request!/1`](#request!/1) or [`request!/2`](#request!/2) for options definition. ``` put!("/users", %{name: "Jon"}) put!("/users", %{name: "Jon"}, query: [scope: "admin"]) put!(client, "/users", %{name: "Jon"}) put!(client, "/users", %{name: "Jon"}, query: [scope: "admin"]) ``` [Link to this function](#request/2 "Link to this function") request(client \\ %Tesla.Client{}, options) =========================================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/connection.ex#L25 "View Source") Specs ----- ``` request([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:client/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.result](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:result/0)() ``` Perform a request. Options ---------- * `:method` - the request method, one of [:head, :get, :delete, :trace, :options, :post, :put, :patch] * `:url` - either full url e.g. "[http://example.com/some/path"](http://example.com/some/path%22) or just "/some/path" if using [`Tesla.Middleware.BaseUrl`](https://hexdocs.pm/tesla/1.4.0/Tesla.Middleware.BaseUrl.html) * `:query` - a keyword list of query params, e.g. `[page: 1, per_page: 100]` * `:headers` - a keyworld list of headers, e.g. `[{"content-type", "text/plain"}]` * `:body` - depends on used middleware: + by default it can be a binary + if using e.g. JSON encoding middleware it can be a nested map + if adapter supports it it can be a Stream with any of the above * `:opts` - custom, per-request middleware or adapter options Examples ----------- ``` ExampleApi.request(method: :get, url: "/users/path") # use shortcut methods ExampleApi.get("/users/1") ExampleApi.post(client, "/users", %{name: "Jon"}) ``` [Link to this function](#request!/2 "Link to this function") request!(client \\ %Tesla.Client{}, options) ============================================ [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/connection.ex#L25 "View Source") Specs ----- ``` request!([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:client/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.t](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:t/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Perform request and raise in case of error. This is similar to [`request/2`](#request/2) behaviour from Tesla 0.x See [`request/2`](#request/2) for list of available options. [Link to this function](#trace/3 "Link to this function") trace(client, url, opts) ======================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/connection.ex#L25 "View Source") Specs ----- ``` trace([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:url/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.result](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:result/0)() ``` Perform a TRACE request. See [`request/1`](#request/1) or [`request/2`](#request/2) for options definition. ``` trace("/users") trace("/users", query: [scope: "admin"]) trace(client, "/users") trace(client, "/users", query: [scope: "admin"]) trace(client, "/users", body: %{name: "Jon"}) ``` [Link to this function](#trace!/3 "Link to this function") trace!(client, url, opts) ========================= [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/connection.ex#L25 "View Source") Specs ----- ``` trace!([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:url/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.t](https://hexdocs.pm/tesla/1.4.0/Tesla.Env.html#t:t/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Perform a TRACE request. See [`request!/1`](#request!/1) or [`request!/2`](#request!/2) for options definition. ``` trace!("/users") trace!("/users", query: [scope: "admin"]) trace!(client, "/users") trace!(client, "/users", query: [scope: "admin"]) trace!(client, "/users", body: %{name: "Jon"}) ``` GoogleApi.AcceleratedMobilePageUrl.V1.Model.AmpUrl β€” google\_api\_accelerated\_mobile\_page\_url v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } GoogleApi.AcceleratedMobilePageUrl.V1.Model.AmpUrl (google\_api\_accelerated\_mobile\_page\_url v0.11.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/model/amp_url.ex#L18 "View Source") ====================================================================================================================================================================================================================================================================================================================== AMP URL response for a requested URL. Attributes ------------- * `ampUrl` (*type:* `String.t`, *default:* `nil`) - The AMP URL pointing to the publisher's web server. * `cdnAmpUrl` (*type:* `String.t`, *default:* `nil`) - The [AMP Cache URL](/amp/cache/overview#amp-cache-url-format) pointing to the cached document in the Google AMP Cache. * `originalUrl` (*type:* `String.t`, *default:* `nil`) - The original non-AMP URL. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [decode(value, options)](#decode/2) Unwrap a decoded JSON object into its complex fields. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/model/amp_url.ex#L31 "View Source") Specs ----- ``` t() :: %GoogleApi.AcceleratedMobilePageUrl.V1.Model.AmpUrl{ ampUrl: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, cdnAmpUrl: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, originalUrl: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#decode/2 "Link to this function") decode(value, options) ====================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/model/amp_url.ex#L18 "View Source") Specs ----- ``` decode([struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Unwrap a decoded JSON object into its complex fields. GoogleApi.AcceleratedMobilePageUrl.V1.Model.AmpUrlError β€” google\_api\_accelerated\_mobile\_page\_url v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } GoogleApi.AcceleratedMobilePageUrl.V1.Model.AmpUrlError (google\_api\_accelerated\_mobile\_page\_url v0.11.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/model/amp_url_error.ex#L18 "View Source") ================================================================================================================================================================================================================================================================================================================================= AMP URL Error resource for a requested URL that couldn't be found. Attributes ------------- * `errorCode` (*type:* `String.t`, *default:* `nil`) - The error code of an API call. * `errorMessage` (*type:* `String.t`, *default:* `nil`) - An optional descriptive error message. * `originalUrl` (*type:* `String.t`, *default:* `nil`) - The original non-AMP URL. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [decode(value, options)](#decode/2) Unwrap a decoded JSON object into its complex fields. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/model/amp_url_error.ex#L31 "View Source") Specs ----- ``` t() :: %GoogleApi.AcceleratedMobilePageUrl.V1.Model.AmpUrlError{ errorCode: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, errorMessage: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, originalUrl: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#decode/2 "Link to this function") decode(value, options) ====================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/model/amp_url_error.ex#L18 "View Source") Specs ----- ``` decode([struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Unwrap a decoded JSON object into its complex fields. GoogleApi.AcceleratedMobilePageUrl.V1.Model.BatchGetAmpUrlsRequest β€” google\_api\_accelerated\_mobile\_page\_url v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } GoogleApi.AcceleratedMobilePageUrl.V1.Model.BatchGetAmpUrlsRequest (google\_api\_accelerated\_mobile\_page\_url v0.11.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/model/batch_get_amp_urls_request.ex#L18 "View Source") ========================================================================================================================================================================================================================================================================================================================================================= AMP URL request for a batch of URLs. Attributes ------------- * `lookupStrategy` (*type:* `String.t`, *default:* `nil`) - The lookup\_strategy being requested. * `urls` (*type:* `list(String.t)`, *default:* `nil`) - List of URLs to look up for the paired AMP URLs. The URLs are case-sensitive. Up to 50 URLs per lookup (see [Usage Limits](/amp/cache/reference/limits)). [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [decode(value, options)](#decode/2) Unwrap a decoded JSON object into its complex fields. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/model/batch_get_amp_urls_request.ex#L30 "View Source") Specs ----- ``` t() :: %GoogleApi.AcceleratedMobilePageUrl.V1.Model.BatchGetAmpUrlsRequest{ lookupStrategy: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, urls: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#decode/2 "Link to this function") decode(value, options) ====================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/model/batch_get_amp_urls_request.ex#L18 "View Source") Specs ----- ``` decode([struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Unwrap a decoded JSON object into its complex fields. GoogleApi.AcceleratedMobilePageUrl.V1.Model.BatchGetAmpUrlsResponse β€” google\_api\_accelerated\_mobile\_page\_url v0.11.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } GoogleApi.AcceleratedMobilePageUrl.V1.Model.BatchGetAmpUrlsResponse (google\_api\_accelerated\_mobile\_page\_url v0.11.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/model/batch_get_amp_urls_response.ex#L18 "View Source") =========================================================================================================================================================================================================================================================================================================================================================== Batch AMP URL response. Attributes ------------- * `ampUrls` (*type:* `list(GoogleApi.AcceleratedMobilePageUrl.V1.Model.AmpUrl.t)`, *default:* `nil`) - For each URL in BatchAmpUrlsRequest, the URL response. The response might not be in the same order as URLs in the batch request. If BatchAmpUrlsRequest contains duplicate URLs, AmpUrl is generated only once. * `urlErrors` (*type:* `list(GoogleApi.AcceleratedMobilePageUrl.V1.Model.AmpUrlError.t)`, *default:* `nil`) - The errors for requested URLs that have no AMP URL. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [decode(value, options)](#decode/2) Unwrap a decoded JSON object into its complex fields. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/model/batch_get_amp_urls_response.ex#L30 "View Source") Specs ----- ``` t() :: %GoogleApi.AcceleratedMobilePageUrl.V1.Model.BatchGetAmpUrlsResponse{ ampUrls: [[GoogleApi.AcceleratedMobilePageUrl.V1.Model.AmpUrl.t](GoogleApi.AcceleratedMobilePageUrl.V1.Model.AmpUrl.html#t:t/0)()] | nil, urlErrors: [[GoogleApi.AcceleratedMobilePageUrl.V1.Model.AmpUrlError.t](GoogleApi.AcceleratedMobilePageUrl.V1.Model.AmpUrlError.html#t:t/0)()] | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#decode/2 "Link to this function") decode(value, options) ====================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/accelerated_mobile_page_url/blob/master/lib/google_api/accelerated_mobile_page_url/v1/model/batch_get_amp_urls_response.ex#L18 "View Source") Specs ----- ``` decode([struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Unwrap a decoded JSON object into its complex fields.
kiosk_system_rpi3
hex
Raspberry Pi 3 Kiosk β€” kiosk\_system\_rpi3 v1.10.0 try { if(localStorage.getItem('night-mode') === 'true') document.body.className += ' night-mode'; } catch (e) { } Raspberry Pi 3 Kiosk ==================== Implements `qt-webengine-kiosk` for rendering QtWebEngine. This is the base Nerves System configuration for the Raspberry Pi 3 Model B. ![Fritzing Raspberry Pi 3 image](assets/images/raspberry-pi-3-model-b.png) [Image credit](#fritzing) | Feature | Description | | --- | --- | | CPU | 1.2 GHz quad-core ARMv8 | | Memory | 1 GB DRAM | | Storage | MicroSD | | Linux kernel | 4.19 w/ Raspberry Pi patches | | IEx terminal | ttyS0 | | GPIO, I2C, SPI | Yes - Elixir ALE | | ADC | No | | PWM | Yes, but no Elixir support | | UART | 1 available - ttyS0 | | Camera | Yes - via rpi-userland | | Ethernet | Yes | | WiFi | Yes - Nerves.InterimWiFi | | Bluetooth | Not yet | Using -------- The most common way of using this Nerves System is create a project with `mix nerves.new` and to export `MIX_TARGET=rpi3`. Then, change the rpi3 system dependency to `{:kiosk_system_rpi3, "~> 1.0"}` See the [Getting started guide](https://hexdocs.pm/nerves/getting-started.html#creating-a-new-nerves-app) for more information. If you need custom modifications to this system for your device, clone this repository and update as described in [Making custom systems](https://hexdocs.pm/nerves/systems.html#customizing-your-own-nerves-system) See the [example project](https://github.com/LeToteTeam/kiosk_system_rpi3/tree/master/example) for more info Built-in WiFi Firmware ------------------------- WiFi modules almost always require proprietary firmware to be loaded for them to work. The Linux kernel handles this and firmware blobs are maintained in the `linux-firmware` project. The firmware for the built-in WiFi module on the RPi3 hasn't made it to the `linux-firmware` project nor Buildroot, so it is included here in a `rootfs-additions` overlay directory. The original firmware files came from <https://github.com/RPi-Distro/firmware-nonfree/blob/master/brcm80211/brcm>. [Image credit](#fritzing): This image is from the [Fritzing](http://fritzing.org/home/) parts library. Provisioning devices ----------------------- This system supports storing provisioning information in a small key-value store outside of any filesystem. Provisioning is an optional step and reasonable defaults are provided if this is missing. Provisioning information can be queried using the Nerves.Runtime KV store's [`Nerves.Runtime.KV.get/1`](https://hexdocs.pm/nerves_runtime/Nerves.Runtime.KV.html#get/1) function. Keys used by this system are: | Key | Example Value | Description | | --- | --- | --- | | `nerves_serial_number` | "1234578"` | By default, this string is used to create unique hostnames and Erlang node names. If unset, it defaults to part of the Raspberry Pi's device ID. | The normal procedure would be to set these keys once in manufacturing or before deployment and then leave them alone. For example, to provision a serial number on a running device, run the following and reboot: ``` iex> cmd("fw\_setenv nerves\_serial\_number 1234") ``` This system supports setting the serial number offline. To do this, set the `NERVES_SERIAL_NUMBER` environment variable when burning the firmware. If you're programming MicroSD cards using `fwup`, the commandline is: ``` sudo NERVES_SERIAL_NUMBER=1234 fwup path_to_firmware.fw ``` Serial numbers are stored on the MicroSD card so if the MicroSD card is replaced, the serial number will need to be reprogrammed. The numbers are stored in a U-boot environment block. This is a special region that is separate from the application partition so reformatting the application partition will not lose the serial number or any other data stored in this block.
ueberauth_github
hex
Overview β€” Üeberauth GitHub v0.8.3 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } Überauth GitHub =============== [![Build Status](https://travis-ci.org/ueberauth/ueberauth_github.svg?branch=master)](https://travis-ci.org/ueberauth/ueberauth_github) [![Module Version](https://img.shields.io/hexpm/v/ueberauth_github.svg)](https://hex.pm/packages/ueberauth_github) [![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/ueberauth_github/) [![Total Download](https://img.shields.io/hexpm/dt/ueberauth_github.svg)](https://hex.pm/packages/ueberauth_github) [![License](https://img.shields.io/hexpm/l/ueberauth_github.svg)](https://github.com/ueberauth/ueberauth_github/blob/master/LICENSE.md) [![Last Updated](https://img.shields.io/github/last-commit/ueberauth/ueberauth_github.svg)](https://github.com/ueberauth/ueberauth_github/commits/master) > GitHub OAuth2 strategy for Überauth. > > Installation --------------- 1. Setup your application at [GitHub Developer](https://developer.github.com). 2. Add `:ueberauth_github` to your list of dependencies in `mix.exs`: ``` def deps do [ {:ueberauth\_github, "~> 0.8"} ] end ``` 3. Add GitHub to your Überauth configuration: ``` config :ueberauth, Ueberauth, providers: [ github: {Ueberauth.Strategy.Github, []} ] ``` 4. Update your provider configuration: ``` config :ueberauth, Ueberauth.Strategy.Github.OAuth, client\_id: System.get\_env("GITHUB\_CLIENT\_ID"), client\_secret: System.get\_env("GITHUB\_CLIENT\_SECRET") ``` Or, to read the client credentials at runtime: ``` config :ueberauth, Ueberauth.Strategy.Github.OAuth, client\_id: {:system, "GITHUB\_CLIENT\_ID"}, client\_secret: {:system, "GITHUB\_CLIENT\_SECRET"} ``` 5. Include the Überauth plug in your router: ``` defmodule MyApp.Router do use MyApp.Web, :router pipeline :browser do plug Ueberauth ... end end ``` 6. Create the request and callback routes if you haven't already: ``` scope "/auth", MyApp do pipe\_through :browser get "/:provider", AuthController, :request get "/:provider/callback", AuthController, :callback end ``` 7. Your controller needs to implement callbacks to deal with [`Ueberauth.Auth`](https://hexdocs.pm/ueberauth/0.10.3/Ueberauth.Auth.html) and [`Ueberauth.Failure`](https://hexdocs.pm/ueberauth/0.10.3/Ueberauth.Failure.html) responses. For an example implementation see the [Überauth Example](https://github.com/ueberauth/ueberauth_example) application. Calling ---------- Depending on the configured url you can initiate the request through: ``` /auth/github ``` Or with options: ``` /auth/github?scope=user,public\_repo ``` By default the requested scope is `"user,public\_repo"`. This provides both read and write access to the GitHub user profile details and public repos. For a read-only scope, either use `"user:email"` or an empty scope `""`. Empty scope will only request minimum public information which even excludes user's email address which results in a `nil` for `email` inside returned `%Ueberauth.Auth.Info{}`. See more at [GitHub's OAuth Documentation](https://developer.github.com/apps/building-integrations/setting-up-and-registering-oauth-apps/about-scopes-for-oauth-apps/). Scope can be configured either explicitly as a `scope` query value on the request path or in your configuration: ``` config :ueberauth, Ueberauth, providers: [ github: {Ueberauth.Strategy.Github, [default\_scope: "user,public\_repo,notifications"]} ] ``` It is also possible to disable the sending of the `redirect_uri` to GitHub. This is particularly useful when your production application sits behind a proxy that handles SSL connections. In this case, the `redirect_uri` sent by [`Ueberauth`](https://hexdocs.pm/ueberauth/0.10.3/Ueberauth.html) will start with `http` instead of `https`, and if you configured your GitHub OAuth application's callback URL to use HTTPS, GitHub will throw an `uri_mismatch` error. To prevent [`Ueberauth`](https://hexdocs.pm/ueberauth/0.10.3/Ueberauth.html) from sending the `redirect_uri`, you should add the following to your configuration: ``` config :ueberauth, Ueberauth, providers: [ github: {Ueberauth.Strategy.Github, [send\_redirect\_uri: false]} ] ``` Private Emails ----------------- GitHub now allows you to keep your email address private. If you don't mind that you won't know a users email address you can specify `allow_private_emails`. This will set the users email as `id+username@users.noreply.github.com`. ``` config :ueberauth, Ueberauth, providers: [ github: {Ueberauth.Strategy.Github, [allow\_private\_emails: true]} ] ``` Copyright and License ------------------------ Copyright (c) 2015 Daniel Neighman This library is released under the MIT License. See the [LICENSE.md](./LICENSE.md) file [← Previous Page License](license.html) Ueberauth.Strategy.Github β€” Üeberauth GitHub v0.8.3 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } Ueberauth.Strategy.Github (Üeberauth GitHub v0.8.3) [View Source](https://github.com/ueberauth/ueberauth_github/blob/#v{@version}/lib/ueberauth/strategy/github.ex#L1 "View Source") ===================================================================================================================================================================================== Provides an Ueberauth strategy for authenticating with GitHub. ### Setup Create an application in Github for you to use. Register a new application at: [your github developer page](https://github.com/settings/developers) and get the `client_id` and `client_secret`. Include the provider in your configuration for Ueberauth; ``` config :ueberauth, Ueberauth, providers: [ github: { Ueberauth.Strategy.Github, [] } ] ``` Then include the configuration for GitHub: ``` config :ueberauth, Ueberauth.Strategy.Github.OAuth, client\_id: System.get\_env("GITHUB\_CLIENT\_ID"), client\_secret: System.get\_env("GITHUB\_CLIENT\_SECRET") ``` If you haven't already, create a pipeline and setup routes for your callback handler ``` pipeline :auth do Ueberauth.plug "/auth" end scope "/auth" do pipe\_through [:browser, :auth] get "/:provider/callback", AuthController, :callback end ``` Create an endpoint for the callback where you will handle the [`Ueberauth.Auth`](https://hexdocs.pm/ueberauth/0.10.3/Ueberauth.Auth.html) struct: ``` defmodule MyApp.AuthController do use MyApp.Web, :controller def callback\_phase(%{ assigns: %{ ueberauth\_failure: fails } } = conn, \_params) do # do things with the failure end def callback\_phase(%{ assigns: %{ ueberauth\_auth: auth } } = conn, params) do # do things with the auth end end ``` You can edit the behaviour of the Strategy by including some options when you register your provider. To set the `uid_field`: ``` config :ueberauth, Ueberauth, providers: [ github: { Ueberauth.Strategy.Github, [uid\_field: :email] } ] ``` Default is `:id`. To set the default 'scopes' (permissions): ``` config :ueberauth, Ueberauth, providers: [ github: { Ueberauth.Strategy.Github, [default\_scope: "user,public\_repo"] } ] ``` Default is empty ("") which "Grants read-only access to public information (includes public user profile info, public repository info, and gists)" [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [credentials(conn)](#credentials/1) Includes the credentials from the GitHub response. [default\_options()](#default_options/0) Callback implementation for [`Ueberauth.Strategy.default_options/0`](https://hexdocs.pm/ueberauth/0.10.3/Ueberauth.Strategy.html#c:default_options/0). [extra(conn)](#extra/1) Stores the raw information (including the token) obtained from the GitHub callback. [handle\_cleanup!(conn)](#handle_cleanup!/1) Cleans up the private area of the connection used for passing the raw GitHub response around during the callback. [handle\_request!(conn)](#handle_request!/1) Handles the initial redirect to the github authentication page. [info(conn)](#info/1) Fetches the fields to populate the info section of the [`Ueberauth.Auth`](https://hexdocs.pm/ueberauth/0.10.3/Ueberauth.Auth.html) struct. [uid(conn)](#uid/1) Fetches the `:uid` field from the GitHub response. [Link to this section](#functions) Functions ============================================= [Link to this function](#credentials/1 "Link to this function") credentials(conn) ================= [View Source](https://github.com/ueberauth/ueberauth_github/blob/#v{@version}/lib/ueberauth/strategy/github.ex#L151 "View Source") Includes the credentials from the GitHub response. [Link to this function](#default_options/0 "Link to this function") default\_options() ================== [View Source](https://github.com/ueberauth/ueberauth_github/blob/#v{@version}/lib/ueberauth/strategy/github.ex#L74 "View Source") Callback implementation for [`Ueberauth.Strategy.default_options/0`](https://hexdocs.pm/ueberauth/0.10.3/Ueberauth.Strategy.html#c:default_options/0). [Link to this function](#extra/1 "Link to this function") extra(conn) =========== [View Source](https://github.com/ueberauth/ueberauth_github/blob/#v{@version}/lib/ueberauth/strategy/github.ex#L203 "View Source") Stores the raw information (including the token) obtained from the GitHub callback. [Link to this function](#handle_cleanup!/1 "Link to this function") handle\_cleanup!(conn) ====================== [View Source](https://github.com/ueberauth/ueberauth_github/blob/#v{@version}/lib/ueberauth/strategy/github.ex#L133 "View Source") Cleans up the private area of the connection used for passing the raw GitHub response around during the callback. [Link to this function](#handle_request!/1 "Link to this function") handle\_request!(conn) ====================== [View Source](https://github.com/ueberauth/ueberauth_github/blob/#v{@version}/lib/ueberauth/strategy/github.ex#L93 "View Source") Handles the initial redirect to the github authentication page. To customize the scope (permissions) that are requested by github include them as part of your url: ``` "/auth/github?scope=user,public\_repo,gist" ``` [Link to this function](#info/1 "Link to this function") info(conn) ========== [View Source](https://github.com/ueberauth/ueberauth_github/blob/#v{@version}/lib/ueberauth/strategy/github.ex#L170 "View Source") Fetches the fields to populate the info section of the [`Ueberauth.Auth`](https://hexdocs.pm/ueberauth/0.10.3/Ueberauth.Auth.html) struct. [Link to this function](#uid/1 "Link to this function") uid(conn) ========= [View Source](https://github.com/ueberauth/ueberauth_github/blob/#v{@version}/lib/ueberauth/strategy/github.ex#L144 "View Source") Fetches the `:uid` field from the GitHub response. This defaults to the option `:uid_field` which in-turn defaults to `:id` Ueberauth.Strategy.Github.OAuth β€” Üeberauth GitHub v0.8.3 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } Ueberauth.Strategy.Github.OAuth (Üeberauth GitHub v0.8.3) [View Source](https://github.com/ueberauth/ueberauth_github/blob/#v{@version}/lib/ueberauth/strategy/github/oauth.ex#L1 "View Source") ================================================================================================================================================================================================= An implementation of OAuth2 for GitHub. To add your `:client_id` and `:client_secret` include these values in your configuration: ``` config :ueberauth, Ueberauth.Strategy.Github.OAuth, client\_id: System.get\_env("GITHUB\_CLIENT\_ID"), client\_secret: System.get\_env("GITHUB\_CLIENT\_SECRET") ``` [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [authorize\_url(client, params)](#authorize_url/2) Callback implementation for [`OAuth2.Strategy.authorize_url/2`](https://hexdocs.pm/oauth2/2.0.0/OAuth2.Strategy.html#c:authorize_url/2). [authorize\_url!(params \\ [], opts \\ [])](#authorize_url!/2) Provides the authorize url for the request phase of Ueberauth. [client(opts \\ [])](#client/1) Construct a client for requests to GitHub. [get(token, url, headers \\ [], opts \\ [])](#get/4) [get\_token(client, params, headers)](#get_token/3) Callback implementation for [`OAuth2.Strategy.get_token/3`](https://hexdocs.pm/oauth2/2.0.0/OAuth2.Strategy.html#c:get_token/3). [get\_token!(params \\ [], options \\ [])](#get_token!/2) [Link to this section](#functions) Functions ============================================= [Link to this function](#authorize_url/2 "Link to this function") authorize\_url(client, params) ============================== [View Source](https://github.com/ueberauth/ueberauth_github/blob/#v{@version}/lib/ueberauth/strategy/github/oauth.ex#L84 "View Source") Callback implementation for [`OAuth2.Strategy.authorize_url/2`](https://hexdocs.pm/oauth2/2.0.0/OAuth2.Strategy.html#c:authorize_url/2). [Link to this function](#authorize_url!/2 "Link to this function") authorize\_url!(params \\ [], opts \\ []) ========================================= [View Source](https://github.com/ueberauth/ueberauth_github/blob/#v{@version}/lib/ueberauth/strategy/github/oauth.ex#L61 "View Source") Provides the authorize url for the request phase of Ueberauth. No need to call this usually. [Link to this function](#client/1 "Link to this function") client(opts \\ []) ================== [View Source](https://github.com/ueberauth/ueberauth_github/blob/#v{@version}/lib/ueberauth/strategy/github/oauth.ex#L37 "View Source") Construct a client for requests to GitHub. Optionally include any OAuth2 options here to be merged with the defaults: ``` Ueberauth.Strategy.Github.OAuth.client( redirect\_uri: "http://localhost:4000/auth/github/callback" ) ``` This will be setup automatically for you in [`Ueberauth.Strategy.Github`](Ueberauth.Strategy.Github.html). These options are only useful for usage outside the normal callback phase of Ueberauth. [Link to this function](#get/4 "Link to this function") get(token, url, headers \\ [], opts \\ []) ========================================== [View Source](https://github.com/ueberauth/ueberauth_github/blob/#v{@version}/lib/ueberauth/strategy/github/oauth.ex#L67 "View Source") [Link to this function](#get_token/3 "Link to this function") get\_token(client, params, headers) =================================== [View Source](https://github.com/ueberauth/ueberauth_github/blob/#v{@version}/lib/ueberauth/strategy/github/oauth.ex#L88 "View Source") Callback implementation for [`OAuth2.Strategy.get_token/3`](https://hexdocs.pm/oauth2/2.0.0/OAuth2.Strategy.html#c:get_token/3). [Link to this function](#get_token!/2 "Link to this function") get\_token!(params \\ [], options \\ []) ======================================== [View Source](https://github.com/ueberauth/ueberauth_github/blob/#v{@version}/lib/ueberauth/strategy/github/oauth.ex#L74 "View Source") API Reference β€” Üeberauth GitHub v0.8.3 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } API Reference Üeberauth GitHub v0.8.3 ======================================= Modules ---------- [Ueberauth.Strategy.Github](Ueberauth.Strategy.Github.html) Provides an Ueberauth strategy for authenticating with GitHub. [Ueberauth.Strategy.Github.OAuth](Ueberauth.Strategy.Github.OAuth.html) An implementation of OAuth2 for GitHub. [Next Page β†’ Changelog](changelog.html)
live_svelte
hex
LiveSvelte β€” LiveSvelte v0.12.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/woutdp/live_svelte/blob/v0.12.0/lib/component.ex#L1 "View Source") LiveSvelte (LiveSvelte v0.12.0) ================================================================================================================================================ [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [render(assigns)](#render/1) [svelte(assigns)](#svelte/1) Renders a Svelte component on the server. [Link to this section](#functions) Functions ============================================= [Link to this function](#render/1 "Link to this function") render(assigns) =============== [View Source](https://github.com/woutdp/live_svelte/blob/v0.12.0/lib/component.ex#L115 "View Source") [Link to this function](#svelte/1 "Link to this function") svelte(assigns) =============== [View Source](https://github.com/woutdp/live_svelte/blob/v0.12.0/lib/component.ex#L1 "View Source") Renders a Svelte component on the server. [attributes](#svelte/1-attributes) Attributes ----------------------------------------------- * `props` (`:map`) - Props to pass to the Svelte component. Defaults to `%{}`. * `name` (`:string`) (required) - Name of the Svelte component.Examples include `"YourComponent"`, and `"directory/Example"`. * `class` (`:string`) - Class to apply to the Svelte component. Defaults to `nil`. * `ssr` (`:boolean`) - Whether to render the component on the server. Defaults to `true`. * `socket` (`:map`) - LiveView socket, should be provided when rendering inside LiveView. Defaults to `nil`. * `live_json_props` (`:map`) - LiveJson props to pass to the Svelte component. Defaults to `%{}`. [slots](#svelte/1-slots) Slots -------------------------------- * `inner_block` - Inner block of the Svelte component. LiveSvelte.Components β€” LiveSvelte v0.12.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/woutdp/live_svelte/blob/v0.12.0/lib/components.ex#L1 "View Source") LiveSvelte.Components (LiveSvelte v0.12.0) ============================================================================================================================================================ Macros to improve the developer experience of crossing the Liveview/Svelte boundary. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [\_\_using\_\_(opts)](#__using__/1) Generates functions local to your current module that can be used to render Svelte components. [get\_svelte\_components()](#get_svelte_components/0) TODO: This could perhaps be optimized to only read the files once per compilation. [Link to this section](#functions) Functions ============================================= [Link to this macro](#__using__/1 "Link to this macro") \_\_using\_\_(opts) =================== [View Source](https://github.com/woutdp/live_svelte/blob/v0.12.0/lib/components.ex#L9 "View Source") (macro) Generates functions local to your current module that can be used to render Svelte components. [Link to this function](#get_svelte_components/0 "Link to this function") get\_svelte\_components() ========================= [View Source](https://github.com/woutdp/live_svelte/blob/v0.12.0/lib/components.ex#L17 "View Source") TODO: This could perhaps be optimized to only read the files once per compilation. LiveSvelte.LiveJson β€” LiveSvelte v0.12.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/woutdp/live_svelte/blob/v0.12.0/lib/live_json.ex#L1 "View Source") LiveSvelte.LiveJson (LiveSvelte v0.12.0) ========================================================================================================================================================= [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [live\_json(assigns)](#live_json/1) Attributes ---------- * `live_json_props` (`:map`) - LiveJSON props to pass to the svelte component. Defaults to `%{}`. Slots ----- * `inner_block` [Link to this section](#functions) Functions ============================================= [Link to this function](#live_json/1 "Link to this function") live\_json(assigns) =================== [View Source](https://github.com/woutdp/live_svelte/blob/v0.12.0/lib/live_json.ex#L1 "View Source") [attributes](#live_json/1-attributes) Attributes -------------------------------------------------- * `live_json_props` (`:map`) - LiveJSON props to pass to the svelte component. Defaults to `%{}`. [slots](#live_json/1-slots) Slots ----------------------------------- * `inner_block` mix live\_svelte.configure\_esbuild β€” LiveSvelte v0.12.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/woutdp/live_svelte/blob/v0.12.0/lib/mix/tasks/configure_esbuild.ex#L1 "View Source") mix live\_svelte.configure\_esbuild (LiveSvelte v0.12.0) =========================================================================================================================================================================================== Creates Javascript files to be used by esbuild. Necessary for LiveSvelte to work. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [run(\_)](#run/1) [Link to this section](#functions) Functions ============================================= [Link to this function](#run/1 "Link to this function") run(\_) ======= [View Source](https://github.com/woutdp/live_svelte/blob/v0.12.0/lib/mix/tasks/configure_esbuild.ex#L8 "View Source") mix live\_svelte.configure\_phoenix β€” LiveSvelte v0.12.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/woutdp/live_svelte/blob/v0.12.0/lib/mix/tasks/configure_phoenix.ex#L1 "View Source") mix live\_svelte.configure\_phoenix (LiveSvelte v0.12.0) =========================================================================================================================================================================================== Configures any necessary code changes inside Phoenix to make LiveSvelte work. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [run(\_)](#run/1) [Link to this section](#functions) Functions ============================================= [Link to this function](#run/1 "Link to this function") run(\_) ======= [View Source](https://github.com/woutdp/live_svelte/blob/v0.12.0/lib/mix/tasks/configure_phoenix.ex#L13 "View Source") mix live\_svelte.install\_npm\_deps β€” LiveSvelte v0.12.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/woutdp/live_svelte/blob/v0.12.0/lib/mix/tasks/install_npm_deps.ex#L1 "View Source") mix live\_svelte.install\_npm\_deps (LiveSvelte v0.12.0) ========================================================================================================================================================================================== Installs npm dependencies for LiveSvelte. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [run(\_)](#run/1) [Link to this section](#functions) Functions ============================================= [Link to this function](#run/1 "Link to this function") run(\_) ======= [View Source](https://github.com/woutdp/live_svelte/blob/v0.12.0/lib/mix/tasks/install_npm_deps.ex#L8 "View Source") mix live\_svelte.setup β€” LiveSvelte v0.12.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/woutdp/live_svelte/blob/v0.12.0/lib/mix/tasks/setup.ex#L1 "View Source") mix live\_svelte.setup (LiveSvelte v0.12.0) ================================================================================================================================================================== Runs all setup tasks for LiveSvelte. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [run(\_)](#run/1) [Link to this section](#functions) Functions ============================================= [Link to this function](#run/1 "Link to this function") run(\_) ======= [View Source](https://github.com/woutdp/live_svelte/blob/v0.12.0/lib/mix/tasks/setup.ex#L8 "View Source") README β€” LiveSvelte v0.12.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/woutdp/live_svelte/blob/v0.12.0/README.md#L1 "View Source") README ================================================================================================================ # LiveSvelte [![GitHub](https://img.shields.io/github/stars/woutdp/live\_svelte?style=social)](https://github.com/woutdp/live\_svelte) [![Hex.pm](https://img.shields.io/hexpm/v/live\_svelte.svg)](https://hex.pm/packages/live\_svelte) Svelte inside Phoenix LiveView with seamless end-to-end reactivity ![logo](https://github.com/woutdp/live\_svelte/blob/master/logo.png?raw=true) [Features](#features) β€’ [Resources](#resources) β€’ [Demo](#demo) β€’ [Installation](#installation) β€’ [Usage](#usage) [features](#features) Features -------------------------------- * ⚑ **End-To-End Reactivity** with LiveView * πŸ”‹ **Server-Side Rendered** (SSR) Svelte * πŸͺ„ **Sigil** as an [Alternative LiveView DSL](#livesvelte-as-an-alternative-liveview-dsl) * ⭐ **Svelte Preprocessing** Support with [svelte-preprocess](https://github.com/sveltejs/svelte-preprocess) * πŸ¦„ **Tailwind** Support * πŸ’€ **Dead View** Support * 🀏 **live\_json** Support * πŸ¦₯ **Slot Interoperability** *(Experimental)* [resources](#resources) Resources ----------------------------------- * [HexDocs](https://hexdocs.pm/live_svelte) * [HexPackage](https://hex.pm/packages/live_svelte) * [Phoenix LiveView](https://github.com/phoenixframework/phoenix_live_view) * [Blog Post](https://wout.space/notes/live-svelte) * [YouTube Introduction](https://www.youtube.com/watch?v=JMkvbW35QvA) [demo](#demo) Demo -------------------- For a full intro and demo check out the [YouTube introduction](https://www.youtube.com/watch?v=JMkvbW35QvA) `/examples/advanced_chat` <https://user-images.githubusercontent.com/3637265/229902870-29166253-3d18-4b24-bbca-83c4b6648578.webm> Svelte handles the look and feel of the chat, while LiveView takes care of syncing. E2E reactivity to the Svelte component so we don't really need to fetch anything! The 'login' to enter your name is a simple LiveView form. Hybrid! --- `/examples/breaking_news` <https://user-images.githubusercontent.com/3637265/229902860-f7ada6b4-4a20-4105-9ee9-79c0cbad8d72.webm> News items are synced with the server while the speed is only client side. [why-livesvelte](#why-livesvelte) Why LiveSvelte -------------------------------------------------- Phoenix LiveView enables rich, real-time user experiences with server-rendered HTML. It works by communicating any state changes through a websocket and updating the DOM in realtime. You can get a really good user experience without ever needing to write any client side code. LiveSvelte builds on top of Phoenix LiveView to allow for easy client side state management while still allowing for communication over the websocket. ### [reasons-why-you-d-use-livesvelte](#reasons-why-you-d-use-livesvelte) Reasons why you'd use LiveSvelte * You have (complex) local state * You want to take full advantage of Javascript's ecosystem * You want to take advantage of Svelte's animations * You want scoped CSS * You like Svelte and its DX :) [requirements](#requirements) Requirements -------------------------------------------- For Server-Side Rendering (SSR) to work you need `node` (version 19 or later) installed in your environment. Make sure you have it installed in production too. You might be using `node` in the build step, but it might actually not be installed in your production environment. You can make sure you have `node` installed by running `node --version` in your project directory. If you don't want SSR, you can disable it by not setting [`NodeJS.Supervisor`](https://hexdocs.pm/nodejs/2.0.0/NodeJS.Supervisor.html) in `application.ex`. More on that in the [SSR](#ssr-server-side-rendering) section of this document. [installation](#installation) Installation -------------------------------------------- *If you're updating from an older version, make sure to check the `CHANGELOG.md` for breaking changes.* 1. Add `live_svelte` to your list of dependencies in `mix.exs`: ``` defp deps do [ {:live\_svelte, "~> 0.12.0"} ] end ``` 2. Adjust the `setup` and `assets.deploy` aliases in `mix.exs`: ``` defp aliases do [ setup: ["deps.get", "ecto.setup", "cmd --cd assets npm install"], ..., "assets.deploy": ["cmd --cd assets node build.js --deploy", "phx.digest"] ] end ``` 3. Run the following in your terminal ``` mix deps.get mix live\_svelte.setup ``` 4. Add `import LiveSvelte` in `html_helpers/0` inside `/lib/<app_name>_web.ex` like so: ``` # /lib/<app\_name>\_web.ex defp html\_helpers do quote do # ... import LiveSvelte # <-- Add this line # ... end end ``` 5. For tailwind support, add `"./svelte/**/*.svelte"` to `content` in the `tailwind.config.js` file ``` ... content: [ ... "./svelte/**/*.svelte" ], ... ``` 6. Finally, remove the `esbuild` configuration from `config/config.exs` and remove the dependency from the `deps` function in your `mix.exs`, and you are done! ### [what-did-we-do](#what-did-we-do) What did we do? You'll notice a bunch of files get created in `/assets`, as well as some code changes in `/lib`. This mostly follows from the recommended way of using esbuild plugins, which we need to make this work. You can read more about this here: <https://hexdocs.pm/phoenix/asset_management.html#esbuild-plugins> In addition we commented out some things such as the `esbuild` watcher configured in `dev.exs` that won't be needed anymore, you can delete these comments if desired. [usage](#usage) Usage ----------------------- Svelte components need to go into the `assets/svelte` directory Attributes: * `name`: Specify the Svelte component * `props` *(Optional)*: Provide the `props` you want to use that should be reactive as a map to the props field * `class` *(Optional)*: Provide `class` to set the class attribute on the root svelte element * `ssr` *(Optional)*: Set `ssr` to `false` to disable server-side rendering e.g. If your component is named `assets/svelte/Example.svelte`: ``` def render(assigns) do ~H""" <.svelte name="Example" props={%{number: @number}} socket={@socket} /> """ end ``` If your component is in a directory, for example `assets/svelte/some-directory/SomeComponent.svelte` you need to include the directory in your name: `some-directory/SomeComponent`. ### [the-components-macro](#the-components-macro) The Components Macro There is also an Elixir macro which checks your `assets/svelte` folder for any Svelte components, and injects local function `def`s for those components into the calling module. This allows for an alternative, more JSX-like authoring experience inside Liveviews. e.g. in the below example, a Svelte component called `Example` is available to be called inside the Liveview template: ``` use LiveSvelte.Components def render(assigns) do ~H""" <.Example number={@number} socket={@socket} /> """ end ``` ### [examples](#examples) Examples Examples can be found in the `/examples` and `/example_project` directories. Most of the `/example_project` examples are visible in the [YouTube demo video](https://www.youtube.com/watch?v=JMkvbW35QvA). I recommend cloning `live_svelte` and running the example project in `/example_project` by running the following commands: ``` git clone https://github.com/woutdp/live\_svelte.git cd ./live\_svelte/example\_project npm install --prefix assets mix deps.get mix phx.server ``` Server should be running on `localhost:4000` If you have examples you want to add, feel free to create a PR, I'd be happy to add them. #### Create a Svelte component ``` <script> // The number prop is reactive, // this means if the server assigns the number, it will update in the frontend export let number = 1 // live contains all exported LiveView methods available to the frontend export let live function increase() { // This pushes the event over the websocket // The last parameter is optional. It's a callback for when the event is finished. // You could for example set a loading state until the event is finished if it takes a longer time. live.pushEvent("set_number", {number: number + 1}, () => {}) // Note that we actually never set the number in the frontend! // We ONLY push the event to the server. // This is the E2E reactivity in action! // The number will automatically be updated through the LiveView websocket } function decrease() { pushEvent("set_number", {number: number - 1}, () => {}) } </script> <p>The number is {number}</p> <button on:click={increase}>+</button> <button on:click={decrease}>-</button> ``` *Note: that here we use the `pushEvent` function, but you could also use `phx-click` and `phx-value-number` if you wanted.* The following methods are available on `live`: * `pushEvent` * `pushEventTo` * `handleEvent` * `removeHandleEvent` * `upload` * `uploadTo` More about this in the [LiveView documentation on js-interop](https://hexdocs.pm/phoenix_live_view/js-interop.html#client-hooks-via-phx-hook) #### Create a LiveView ``` # `/lib/app\_web/live/live\_svelte.ex` defmodule AppWeb.SvelteLive do use AppWeb, :live\_view def render(assigns) do ~H""" <.svelte name="Example" props={%{number: @number}} socket={@socket} /> """ end def handle\_event("set\_number", %{"number" => number}, socket) do {:noreply, assign(socket, :number, number)} end def mount(\_params, \_session, socket) do {:ok, assign(socket, :number, 5)} end end ``` ``` # `/lib/app\_web/router.ex` import Phoenix.LiveView.Router scope "/", AppWeb do ... live "/svelte", SvelteLive ... end ``` ### [livesvelte-as-an-alternative-liveview-dsl](#livesvelte-as-an-alternative-liveview-dsl) LiveSvelte As An Alternative LiveView DSL [Blogpost on the topic](https://wout.space/notes/live-svelte-as-liveview-dsl) We can go one step further and use LiveSvelte as an alternative to the standard LiveView DSL. This idea is inspired by [Surface UI](https://surface-ui.org/). Take a look at the following example: ``` defmodule ExampleWeb.LiveSigil do use ExampleWeb, :live\_view def render(assigns) do ~V""" <script> export let number = 5 let other = 1 $: combined = other + number </script> <p>This is number: {number}</p> <p>This is other: {other}</p> <p>This is other + number: {combined}</p> <button phx-click="increment">Increment</button> <button on:click={() => other += 1}>Increment</button> """ end def mount(\_params, \_session, socket) do {:ok, assign(socket, :number, 1)} end def handle\_event("increment", \_value, socket) do {:noreply, assign(socket, :number, socket.assigns.number + 1)} end end ``` Use the `~V` sigil instead of `~H` and your LiveView will be Svelte instead of an HEEx template. #### Installation 1. If it's not already imported inside `html_helpers/0`, add `import LiveSvelte` inside the `live_view` function in your project, this can be found in `/lib/<app_name>_web.ex`: ``` def live\_view do quote do use Phoenix.LiveView, layout: {ExampleWeb.Layouts, :app} import LiveSvelte unquote(html\_helpers()) end end ``` 2. Ignore build files in your `.gitignore`. The sigil will create Svelte files that are then picked up by `esbuild`, these files don't need to be included in your git repo: ``` # Ignore automatically generated Svelte files by the ~V sigil /assets/svelte/_build/ ``` #### Neovim Treesitter Config To enable syntax highlighting in Neovim with Treesitter, create the following file: `~/.config/nvim/after/queries/elixir/injections.scm` ``` ; extends ; Svelte (sigil (sigil\_name) @\_sigil\_name (quoted\_content) @svelte (#eq? @\_sigil\_name "V")) ``` Also make sure Svelte and Elixir is installed in Treesitter. #### Options Options can be passed in the mount by setting `svelte_opts`, check the following example: ``` def mount(\_params, \_session, socket) do {:ok, assign(socket, some\_value: 1, svelte\_opts: %{ssr: false, class: "example-class"})} end ``` ### [liveview-live-navigation-events](#liveview-live-navigation-events) LiveView Live Navigation Events Inside Svelte you can define [Live Navigation](https://hexdocs.pm/phoenix_live_view/live-navigation.html) links. These links navigate from one LiveView to the other without refreshing the page. For example this can be useful when you have a Svelte store and you want this store state to remain during navigation. Example of Svelte store usage can be found in `/examples/store`. `push_navigate` ``` <a href="/your-liveview-path" data-phx-link="redirect" data-phx-link-state="push">Redirect</a> ``` `push_patch` ``` <a href="/your-liveview-path" data-phx-link="patch" data-phx-link-state="push">Patch</a> ``` ### [liveview-javascript-interoperability](#liveview-javascript-interoperability) LiveView JavaScript Interoperability LiveView allows for a bunch of interoperability which you can read more about here: <https://hexdocs.pm/phoenix_live_view/js-interop.html> ### [preprocessor](#preprocessor) Preprocessor To use the preprocessor, install the desired preprocessor. e.g. Typescript ``` cd assets && npm install --save-dev typescript ``` ### [ssr-server-side-rendering](#ssr-server-side-rendering) SSR (Server-Side Rendering) If you're unfamiliar with SSR (Server-Side Rendering), it is a feature of Svelte to... render Svelte on the server. This means on first page load you get to see HTML instead of a blank page. Immediately after the first page load the page is '[hydrated](https://www.youtube.com/watch?v=D46aT3mx9LU)', which is a fancy word for adding reactivity to your component. This happens in the background, you don't notice this step happening. The way LiveSvelte updates itself through LiveView is by letting Svelte handle all the HTML edits. Usually LiveView would edit the HTML by passing messages through the websocket. In our case we only pass the data we provided in the props attribute to Svelte through the websocket. No HTML is being touched by LiveView, Svelte takes care of that. Like mentioned, without SSR you'd see a brief flash of un-rendered content. Sometimes you can get away with not rendering Svelte on the server, for example when your Svelte component doesn't do any rendering on first page load and needs to be manually toggled for visibility by the user. Or when it is a component that has no visual component to it like tracking your mouse cursor and sending it back to the server. In theses cases you can turn off SSR. #### Disabling SSR SSR is enabled by default when you install LiveSvelte. If you don't want to use Server-Side Rendering for Svelte, you have 2 options: ##### Globally If you don't want to use SSR on any component you can disable it globally. This will automatically be the case if you don't include the [`NodeJS`](https://hexdocs.pm/nodejs/2.0.0/NodeJS.html) supervisor in the `application.ex` file ##### Component To disable SSR on a specific component, set the `ssr` property to false. Like so: ``` <.svelte name="Example" ssr={false} /> ``` ### [live\_json](#live_json) live\_json LiveSvelte has support for [live\_json](https://github.com/Miserlou/live_json). By default, LiveSvelte sends your entire json object over the wire through LiveView. This can be expensive if your json object is big and changes frequently. `live_json` on the other hand allows you to only send a *diff* of the json to Svelte. This is very useful the bigger your json objects get. Counterintuitively, you don't always want to use `live_json`. Sometimes it's cheaper to send your entire object again. Although diffs are small, they do add a little bit of data to your json. So if your json is relatively small, I'd recommend not using `live_json`, but it's something to experiment with for your use-case. #### Usage 1. Install [live\_json](https://github.com/Miserlou/live_json#installation) 2. Use `live_json` in your project with LiveSvelte. For example: ``` def render(assigns) do ~H""" <.svelte name="Component" live\_json\_props={%{my\_prop: @ljmy\_prop}} socket={@socket} /> """ end def mount(\_, \_, socket) do # Get `my\_big\_json\_object` somehow {:ok, LiveJson.initialize("my\_prop", my\_big\_json\_object)} end def handle\_info(%Broadcast{event: "update", payload: my\_big\_json\_object}, socket) do {:noreply, LiveJson.push\_patch(socket, "my\_prop", my\_big\_json\_object)} end ``` #### Example You can find an example [here](https://github.com/woutdp/live_svelte/blob/master/example_project/lib/example_web/live/live_json.ex). ### [structs-and-ecto](#structs-and-ecto) Structs and Ecto We use [Jason](https://github.com/michalmuskala/jason) to serialize any data you pass in the props so it can be handled by Javascript. Jason doesn't know how to handle structs by default, so you need to define it yourself. #### Structs For example, if you have a regular struct like this: ``` defmodule User do defstruct name: "John", age: 27, address: "Main St" end ``` You must define `@derive` ``` defmodule User do @derive Jason.Encoder defstruct name: "John", age: 27, address: "Main St" end ``` Be careful though, as you might accidentally leak certain fields you don't want the client to access, you can include which fields to serialize: ``` defmodule User do @derive {Jason.Encoder, only: [:name, :age]} defstruct name: "John", age: 27, address: "Main St" end ``` #### Ecto In ecto's case it's important to *also* omit the `__meta__` field as it's not serializable. Check out the following example: ``` defmodule Example.Planets.Planet do use Ecto.Schema import Ecto.Changeset @derive {Jason.Encoder, except: [:\_\_meta\_\_]} schema "planets" do field :diameter, :integer field :mass, :integer field :name, :string timestamps() end ... end ``` #### Documentation More documentation on the topic: * [HexDocs](https://hexdocs.pm/jason/Jason.Encoder.html) * [GitHub](https://github.com/michalmuskala/jason#encoders) [caveats](#caveats) Caveats ----------------------------- ### [slot-interoperability](#slot-interoperability) Slot Interoperability Slot interoperability is still experimental, **so use with caution!** Svelte doesn't have an official way of setting the slot on mounting the Svelte object or updating it on subsequent changes, unlike props. This makes using slots from within Liveview on a Svelte component fragile. The server side rendered initial Svelte rendering does have support for slots so that should work as expected. Slots may eventually reach a state where it is stable, any help in getting there is appreciated. If you know a lot about the internals of Svelte your help may be invaluable here! Any bugs related to this are welcome to be logged, PR's are especially welcome! ### [secret-state](#secret-state) "Secret State" With LiveView, it's easy to keep things secret. Let's say you have a conditional that only renders when something is `true`, in LiveView there's no way to know what that conditional will show until it is shown, that's because the HTML is sent over the wire. With LiveSvelte, we're dealing with JSON being sent to Svelte, which in turn takes that JSON data and conditionally renders something, even if we don't set the conditional to `true`, the Svelte code will contain code on what to show when the conditional turns `true`. In a lot of scenarios this is not an issue, but it can be and is something you should be aware of. [livesvelte-development](#livesvelte-development) LiveSvelte Development -------------------------------------------------------------------------- ### [local-setup](#local-setup) Local Setup #### Example Project You can use `/example_project` as a way to test `live_svelte` locally. #### Custom Project You can also use your own project. Clone `live_svelte` to the parent directory of the project you want to test it in. Inside `mix.exs` ``` {:live\_svelte, path: "../live\_svelte"}, ``` Inside `assets/package.json` ``` "live_svelte": "file:../../live_svelte", ``` ### [building-static-files](#building-static-files) Building Static Files Make the changes in `/assets/js` and run: ``` mix assets.build ``` Or run the watcher: ``` mix assets.build --watch ``` ### [releasing](#releasing) Releasing * Update the version in `README.md` * Update the version in `package.json` * Update the version in `mix.exs` * Update the changelog Run: ``` mix hex.publish ``` [credits](#credits) Credits ----------------------------- * [Ryan Cooke](https://dev.to/debussyman) - [E2E Reactivity using Svelte with Phoenix LiveView](https://dev.to/debussyman/e2e-reactivity-using-svelte-with-phoenix-liveview-38mf) * [Svonix](https://github.com/nikokozak/svonix) * [Sveltex](https://github.com/virkillz/sveltex) [livesvelte-projects](#livesvelte-projects) LiveSvelte Projects ----------------------------------------------------------------- * [Territoriez.io](https://territoriez.io) * [ash-svelte-flowbite](https://github.com/dev-guy/ash-svelte-flowbite) *Using LiveSvelte in a public project? Let me know and I'll add it to this list!* [← Previous Page API Reference](api-reference.html)
telemetry_ui
hex
TelemetryUI β€” telemetry\_ui v4.1.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui.ex#L1 "View Source") TelemetryUI (telemetry\_ui v4.1.0) ====================================================================================================================================================== Main entry point to start all the processes as part of your application. Usage ===== ``` use Application def start(\_type, \_args) do children = [ Shopcast.Repo, MyAppWeb.Endpoint, {TelemetryUI, my\_config()} ] ``` The reporter, write buffer and pruner processes will be part of your supervision tree, ensuring that everything runs smoothly. The config is a data structure representing all settings used by TelemetryUI. [Config example](#module-config-example) ----------------------------------------- ``` [ metrics: [ {"System", [last\_value("vm.memory.total", unit: {:byte, :megabyte})]} ], theme: %{title: "Metrics"}, backend: %TelemetryUI.Backend.EctoPostgres{ repo: MyApp.Repo, pruner\_threshold: [months: -1], pruner\_interval\_ms: 3\_600\_000, max\_buffer\_size: 1\_000, flush\_interval\_ms: 10\_000 } ] ``` This config will show a basic "last value" chart for the memory usage reported by the VM. The title of the page will be "Metrics" and the backend used to store and query metrics will be PostgreSQL. See [`TelemetryUI.Config`](TelemetryUI.Config.html) for a list of all options. [Metrics list](#module-metrics-list) ------------------------------------- Every kind of metrics exposed by `TelemetryMetrics` is supported by [`TelemetryUI`](TelemetryUI.html#content): * `last_value` * `summary` * `sum` * `counter` * `distribution` [`TelemetryUI`](TelemetryUI.html#content) also exposes its own set of metrics: * `average` * `average_over_time` * `count_over_time` * `median` * `median_over_time` [The Web](#module-the-web) --------------------------- Finally, when the configuration is done and we actually want to see our metrics, we need to add the [`TelemetryUI.Web`](TelemetryUI.Web.html) module in our router: *Phoenix* ``` scope "/" do pipe\_through([:browser]) get("/metrics", TelemetryUI.Web, [], [assigns: %{telemetry\_ui\_allowed: true}]) end ``` The metrics page is protected by default. It needs to have the `telemetry_ui_allowed` assign to true to render. We can imagine having a `:admin_protected` plug that ensure a user is an admin and also assign `telemetry_ui_allowed` to true. ``` scope "/" do pipe\_through([:browser, :admin\_protected]) get("/metrics", TelemetryUI.Web, []) end ``` That’s it! The `/metrics` page will show the metrics as they are recorded. Checkout the Guides to dive into more complex configuration and awesome features :) [Summary](#summary) ==================== [Functions](#functions) ------------------------ [backend(name)](#backend/1) [child\_spec(init\_arg)](#child_spec/1) Returns a specification to start this module under a supervisor. [config\_name(name)](#config_name/1) [insert\_metric\_data(name, event)](#insert_metric_data/2) [metric\_by\_id(name, id)](#metric_by_id/2) [metric\_data(name, metric, filters)](#metric_data/3) [page\_by\_id(name, id)](#page_by_id/2) [page\_by\_title(name, title)](#page_by_title/2) [pages(name)](#pages/1) [start\_link(opts)](#start_link/1) [theme(name)](#theme/1) [valid\_share\_key?(share\_key)](#valid_share_key?/1) [valid\_share\_url?(url)](#valid_share_url?/1) [writer\_buffer\_name(name)](#writer_buffer_name/1) [Functions](#functions) ======================== [Link to this function](#backend/1 "Link to this function") backend(name) ============= [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui.ex#L193 "View Source") [Link to this function](#child_spec/1 "Link to this function") child\_spec(init\_arg) ====================== [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui.ex#L132 "View Source") Returns a specification to start this module under a supervisor. See [`Supervisor`](https://hexdocs.pm/elixir/Supervisor.html). [Link to this function](#config_name/1 "Link to this function") config\_name(name) ================== [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui.ex#L211 "View Source") [Link to this function](#insert_metric_data/2 "Link to this function") insert\_metric\_data(name, event) ================================= [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui.ex#L185 "View Source") [Link to this function](#metric_by_id/2 "Link to this function") metric\_by\_id(name, id) ======================== [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui.ex#L202 "View Source") [Link to this function](#metric_data/3 "Link to this function") metric\_data(name, metric, filters) =================================== [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui.ex#L181 "View Source") [Link to this function](#page_by_id/2 "Link to this function") page\_by\_id(name, id) ====================== [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui.ex#L199 "View Source") [Link to this function](#page_by_title/2 "Link to this function") page\_by\_title(name, title) ============================ [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui.ex#L200 "View Source") [Link to this function](#pages/1 "Link to this function") pages(name) =========== [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui.ex#L189 "View Source") [Link to this function](#start_link/1 "Link to this function") start\_link(opts) ================= [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui.ex#L110 "View Source") [Link to this function](#theme/1 "Link to this function") theme(name) =========== [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui.ex#L191 "View Source") [Link to this function](#valid_share_key?/1 "Link to this function") valid\_share\_key?(share\_key) ============================== [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui.ex#L195 "View Source") [Link to this function](#valid_share_url?/1 "Link to this function") valid\_share\_url?(url) ======================= [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui.ex#L197 "View Source") [Link to this function](#writer_buffer_name/1 "Link to this function") writer\_buffer\_name(name) ========================== [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui.ex#L210 "View Source") TelemetryUI.Backend β€” telemetry\_ui v4.1.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui/backend/backend.ex#L1 "View Source") TelemetryUI.Backend protocol (telemetry\_ui v4.1.0) ======================================================================================================================================================================================= Inserting, fetching and pruning of metrics. [Inserting](#module-inserting) ------------------------------- Inserting is called by the internal `WriteBuffer`. It can be grouped depending on the buffer configuration inside the backend struct: * `flush_interval_ms`: Time interval before the write buffer calls the backend * `max_buffer_size`: Maximum count of events before the write buffer calls the backend [Fetching](#module-fetching) ----------------------------- Fetching is called when rendering metrics in the view. The `filters` argument is a struct with predefined fields: `to`, `from`, `event_name` and `compare`. [Pruning](#module-pruning) --------------------------- Pruning is implemented to keep the datastore clean. Keeping data forever will increase the size of the storage and affect performance. * `pruner_threshold`: *Example:* `[months: -1]`. Delete events older than a month. * `pruner_interval_ms`: *Example:* 84\_000. Time interval for the pruner process to run. The process simply calls `#prune_events!/2`. [Summary](#summary) ==================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [insert\_event(backend, value, date, event\_name, tags \\ %{}, count \\ 1)](#insert_event/6) [metric\_data(backend, metric, filters)](#metric_data/3) [prune\_events!(backend, datetime)](#prune_events!/2) [Types](#types) ================ [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui/backend/backend.ex#L1 "View Source") ``` @type t() :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Functions](#functions) ======================== [Link to this function](#insert_event/6 "Link to this function") insert\_event(backend, value, date, event\_name, tags \\ %{}, count \\ 1) ========================================================================= [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui/backend/backend.ex#L19 "View Source") [Link to this function](#metric_data/3 "Link to this function") metric\_data(backend, metric, filters) ====================================== [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui/backend/backend.ex#L21 "View Source") [Link to this function](#prune_events!/2 "Link to this function") prune\_events!(backend, datetime) ================================= [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui/backend/backend.ex#L20 "View Source") TelemetryUI.Backend.EctoPostgres.Migrations β€” telemetry\_ui v4.1.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui/backend/ecto_postgres/migrations.ex#L1 "View Source") TelemetryUI.Backend.EctoPostgres.Migrations (telemetry\_ui v4.1.0) ======================================================================================================================================================================================================================= Migrations create and modify the database tables TelemetryUI needs to function. [Usage](#module-usage) ----------------------- To use migrations in your application you'll need to generate an [`Ecto.Migration`](https://hexdocs.pm/ecto_sql/3.10.1/Ecto.Migration.html) that wraps calls to [`TelemetryUI.Backend.EctoPostgres.Migrations`](TelemetryUI.Backend.EctoPostgres.Migrations.html#content): ``` mix ecto.gen.migration add\_telemetry\_ui ``` Open the generated migration in your editor and call the `up` and `down` functions on [`TelemetryUI.Backend.EctoPostgres.Migrations`](TelemetryUI.Backend.EctoPostgres.Migrations.html#content): ``` defmodule MyApp.Repo.Migrations.AddTelemetryUI do use Ecto.Migration def up, do: TelemetryUI.Backend.EctoPostgres.Migrations.up() def down, do: TelemetryUI.Backend.EctoPostgres.Migrations.down() end ``` This will run all of TelemetryUI's versioned migrations for your database. Now, run the migration to create the table: ``` mix ecto.migrate ``` Migrations between versions are idempotent. As new versions are released, you may need to run additional migrations. To do this, generate a new migration: ``` mix ecto.gen.migration upgrade\_telemetry\_ui\_to\_v11 ``` Open the generated migration in your editor and call the `up` and `down` functions on [`TelemetryUI.Backend.EctoPostgres.Migrations`](TelemetryUI.Backend.EctoPostgres.Migrations.html#content), passing a version number: ``` defmodule MyApp.Repo.Migrations.UpgradeTelemetryUIToV11 do use Ecto.Migration def up, do: TelemetryUI.Backend.EctoPostgres.Migrations.up(version: 11) def down, do: TelemetryUI.Backend.EctoPostgres.Migrations.down(version: 11) end ``` [Isolation with Prefixes](#module-isolation-with-prefixes) ----------------------------------------------------------- TelemetryUI supports namespacing through PostgreSQL schemas, also called "prefixes" in Ecto. With prefixes your events table can reside outside of your primary schema (usually public) and you can have multiple separate job tables. To use a prefix you first have to specify it within your migration: ``` defmodule MyApp.Repo.Migrations.AddPrefixedTelemetryUIJobsTable do use Ecto.Migration def up, do: TelemetryUI.Backend.EctoPostgres.Migrations.up(prefix: "private") def down, do: TelemetryUI.Backend.EctoPostgres.Migrations.down(prefix: "private") end ``` The migration will create the "private" schema and all tables, functions and triggers within that schema. With the database migrated you'll then specify the prefix in your configuration: ``` config :my\_app, TelemetryUI, prefix: "private", ... ``` In some cases, for example if your "private" schema already exists and your database user in production doesn't have permissions to create a new schema, trying to create the schema from the migration will result in an error. In such situations, it may be useful to inhibit the creation of the "private" schema: ``` defmodule MyApp.Repo.Migrations.AddPrefixedTelemetryUIJobsTable do use Ecto.Migration def up, do: TelemetryUI.Backend.EctoPostgres.Migrations.up(prefix: "private", create\_schema: false) def down, do: TelemetryUI.Backend.EctoPostgres.Migrations.down(prefix: "private") end ``` [Summary](#summary) ==================== [Functions](#functions) ------------------------ [down(opts \\ [])](#down/1) Run the `down` changes for all migrations between the current version and the initial version. [up(opts \\ [])](#up/1) Run the `up` changes for all migrations between the initial version and the current version. [Functions](#functions) ======================== [Link to this function](#down/1 "Link to this function") down(opts \\ []) ================ [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui/backend/ecto_postgres/migrations.ex#L158 "View Source") Run the `down` changes for all migrations between the current version and the initial version. [Example](#down/1-example) --------------------------- Run all migrations from current version down to the first: ``` TelemetryUI.Backend.EctoPostgres.Migrations.down() ``` Run migrations down to and including a specified version: ``` TelemetryUI.Backend.EctoPostgres.Migrations.down(version: 5) ``` Run migrations in an alternate prefix: ``` TelemetryUI.Backend.EctoPostgres.Migrations.down(prefix: "payments") ``` [Link to this function](#up/1 "Link to this function") up(opts \\ []) ============== [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui/backend/ecto_postgres/migrations.ex#L125 "View Source") Run the `up` changes for all migrations between the initial version and the current version. [Example](#up/1-example) ------------------------- Run all migrations up to the current version: ``` TelemetryUI.Backend.EctoPostgres.Migrations.up() ``` Run migrations up to a specified version: ``` TelemetryUI.Backend.EctoPostgres.Migrations.up(version: 2) ``` Run migrations in an alternate prefix: ``` TelemetryUI.Backend.EctoPostgres.Migrations.up(prefix: "payments") ``` Run migrations in an alternate prefix but don't try to create the schema: ``` TelemetryUI.Backend.EctoPostgres.Migrations.up(prefix: "payments", create\_schema: false) ``` TelemetryUI.Config β€” telemetry\_ui v4.1.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui/config.ex#L1 "View Source") TelemetryUI.Config (telemetry\_ui v4.1.0) ==================================================================================================================================================================== Holds the state of the config. See other modules for more details: * [`TelemetryUI.Theme`](TelemetryUI.Theme.html) * [`TelemetryUI.Backend`](TelemetryUI.Backend.html) [Summary](#summary) ==================== [Functions](#functions) ------------------------ [child\_spec(init\_arg)](#child_spec/1) Returns a specification to start this module under a supervisor. [start\_link(initial\_state)](#start_link/1) [Functions](#functions) ======================== [Link to this function](#child_spec/1 "Link to this function") child\_spec(init\_arg) ====================== [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui/config.ex#L10 "View Source") Returns a specification to start this module under a supervisor. See [`Supervisor`](https://hexdocs.pm/elixir/Supervisor.html). [Link to this function](#start_link/1 "Link to this function") start\_link(initial\_state) =========================== [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui/config.ex#L12 "View Source") TelemetryUI.Theme β€” telemetry\_ui v4.1.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui/theme.ex#L1 "View Source") TelemetryUI.Theme (telemetry\_ui v4.1.0) ================================================================================================================================================================== Customize the UI of the web view. * `primary_color`: *Example: #ff0000*, Used for the title and first color on the charts * `title`: *Example: "My metrics"*, Used for the HTML page title and the title in the header. * `description`: *Example: "HTTP, GraphQL and Database metrics"*, Used for the HTML description tag. * `logo`: SVG logo in string used for the favicon and header. * `scale`: List of hex colors used in the charts. * `share_key`: 16 characters string used to hash the shared page. * `share_path`: Path in string starting by a `/` used to generate the shared page. It’s difference from the metrics page since it does not require authentication. * `frame_options`: *Example: [{:last\_30\_minutes, 30, :minute}, {:last\_2\_hours, 120, :minute}]*, Used to generate the time frame in the header. TelemetryUI.Web β€” telemetry\_ui v4.1.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui/web/web.ex#L1 "View Source") TelemetryUI.Web (telemetry\_ui v4.1.0) ================================================================================================================================================================== Plug to render an HTML view with all metrics. The view handles the different pages in the configurationa and the assets pipeline for CSS and JavaScript. The module also handles "async" components data request called in the components. [Summary](#summary) ==================== [Functions](#functions) ------------------------ [call(conn, opts)](#call/2) Callback implementation for [`Plug.call/2`](https://hexdocs.pm/plug/1.14.2/Plug.html#c:call/2). [index(conn, arg2)](#index/2) [init(opts)](#init/1) Callback implementation for [`Plug.init/1`](https://hexdocs.pm/plug/1.14.2/Plug.html#c:init/1). [Functions](#functions) ======================== [Link to this function](#call/2 "Link to this function") call(conn, opts) ================ [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui/web/web.ex#L8 "View Source") Callback implementation for [`Plug.call/2`](https://hexdocs.pm/plug/1.14.2/Plug.html#c:call/2). [Link to this function](#index/2 "Link to this function") index(conn, arg2) ================= [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui/web/web.ex#L24 "View Source") [Link to this function](#init/1 "Link to this function") init(opts) ========== [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/lib/telemetry_ui/web/web.ex#L8 "View Source") Callback implementation for [`Plug.init/1`](https://hexdocs.pm/plug/1.14.2/Plug.html#c:init/1). README β€” telemetry\_ui v4.1.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/mirego/telemetry_ui/blob/v4.1.0/README.md#L1 "View Source") README ================================================================================================================ ![](https://user-images.githubusercontent.com/464900/183483800-f313a3c0-1877-4c37-ac07-e08bed3f2276.png) Telemetry-based metrics UI. Take your [`telemetry`](https://github.com/beam-telemetry/telemetry) metrics and display them in a web page. [![](https://img.shields.io/hexpm/v/telemetry_ui.svg)](https://hex.pm/packages/telemetry_ui) [Features](#features) ---------------------- [`TelemetryUI`](TelemetryUI.html)’s primary goal is to display [your application metrics](https://hexdocs.pm/telemetry_metrics) without external infrastructure dependencies. [Plug](https://hexdocs.pm/plug/Plug.Telemetry.html), [Phoenix](https://hexdocs.pm/phoenix/telemetry.html), [Phoenix LiveView](https://hexdocs.pm/phoenix_live_view/telemetry.html), [Absinthe](https://hexdocs.pm/absinthe/telemetry.html), [Ecto](https://hexdocs.pm/ecto/Ecto.Repo.html#module-telemetry-events), [Erlang VM](https://hexdocs.pm/telemetry_poller/readme.html), [Tesla](https://hexdocs.pm/tesla/Tesla.Middleware.Telemetry.html), [Finch](https://hexdocs.pm/finch/Finch.Telemetry.html), [Redix](https://hexdocs.pm/redix/telemetry.html), [Oban](https://hexdocs.pm/oban/Oban.Telemetry.html), [Broadway](https://hexdocs.pm/broadway/Broadway.html#module-telemetry) and others expose all sorts of data that can be useful. You can also emit your own events from your application. Your data should not have to be uploaded somewhere else to have insighful metrics. It comes with a Postgres backend, powered by [Ecto](https://hexdocs.pm/ecto), to quickly (and efficiently) store and query your application events. ![Screenshot of /metrics showcasing values and charts](https://user-images.githubusercontent.com/464900/205386716-a4aa9387-6125-40e6-b764-b2e76df5e83b.png)### [Advantages over other tools](#advantages-over-other-tools) * Persisted metrics inside your own database * Live dashboard * Many built-in charts and visualizations using [VegaLite](https://vega.github.io/vega-lite/) ### [Advanced features](#advanced-features) * 100% custom UI hook to show your own components * 100% custom data fetching to show live data * Shareable metrics page (secured, cacheable, without external requests) * Slack digest with rendered images * Multiple metrics dashboard living in the same app Checkout the Guides for more informations. [Usage](#usage) ---------------- ### [Installation](#installation) TelemetryUI is published on Hex. Add it to your list of dependencies in `mix.exs`: ``` # mix.exs def deps do [ {:telemetry\_ui, "~> 4.0"} ] end ``` Then run mix deps.get to install Telemetry and its dependencies. After the packages are installed you must create a database migration to add the `telemetry_ui_events` table to your database: ``` mix ecto.gen.migration add\_telemetry\_ui\_events\_table ``` Open the generated migration in your editor and call the up and down functions on `TelemetryUI.Adapter.EctoPostgres.Migrations`: ``` defmodule MyApp.Repo.Migrations.AddTelemetryUIEventsTable do use Ecto.Migration def up do TelemetryUI.Backend.EctoPostgres.Migrations.up() end # We specify `version: 1` in `down`, ensuring that we'll roll all the way back down if # necessary, regardless of which version we've migrated `up` to. def down do TelemetryUI.Backend.EctoPostgres.Migrations.down(version: 1) end end ``` This will run all of TelemetryUI's versioned migrations for your database. Migrations between versions are idempotent and rarely change after a release. As new versions are released you may need to run additional migrations. Now, run the migration to create the table: ``` mix ecto.migrate ``` TelemetryUI instances are isolated supervision trees and must be included in your application's supervisor to run. Use the application configuration you've just set and include TelemetryUI in the list of supervised children: ``` # lib/my\_app/application.ex def start(\_type, \_args) do children = [ MyApp.Repo, {TelemetryUI, telemetry\_config()} ] Supervisor.start\_link(children, strategy: :one\_for\_one, name: MyApp.Supervisor) end defp telemetry\_config do import TelemetryUI.Metrics [ metrics: [ last\_value("my\_app.users.total\_count", description: "Number of users", ui\_options: [unit: " users"]), counter("phoenix.router\_dispatch.stop.duration", description: "Number of requests", unit: {:native, :millisecond}, ui\_options: [unit: " requests"]), value\_over\_time("vm.memory.total", unit: {:byte, :megabyte}), distribution("phoenix.router\_dispatch.stop.duration", description: "Requests duration", unit: {:native, :millisecond}, reporter\_options: [buckets: [0, 100, 500, 2000]]), ], backend: %TelemetryUI.Backend.EctoPostgres{ repo: MyApp.Repo, pruner\_threshold: [months: -1], pruner\_interval\_ms: 84\_000, max\_buffer\_size: 10\_000, flush\_interval\_ms: 10\_000 } ] end ``` Since the config is read once at startup, you need to restart the server of you add new metrics to track. To see the rendered metrics, you need to add a route to your router. ``` # lib/my\_app\_web/router.ex scope "/" do get("/metrics", TelemetryUI.Web, [], [assigns: %{telemetry\_ui\_allowed: true}]) end ``` #### Security Since it may contain sensitive data, [`TelemetryUI`](TelemetryUI.html) requires a special assign to render the page. `:telemetry_ui_allowed` must be set to `true` in the `conn` struct before it enters the [`TelemetryUI.Web`](TelemetryUI.Web.html) module. By using a special assign to control access, you can integrate [`TelemetryUI.Web`](TelemetryUI.Web.html) page with your existing authorization. We can imagine an admin protected section that also gives you access to the [`TelemetryUI.Web`](TelemetryUI.Web.html) page: ``` pipeline :admin\_protected do plug(MyAppWeb.EnsureCurrentUser) plug(MyAppWeb.EnsureRole, :admin) plug(:enable\_telemetry\_ui) end def enable\_telemetry\_ui(conn, \_), do: assign(conn, :telemetry\_ui\_allowed, true) ``` That’s it! You can declare as many metrics as you want and they will render in HTML on your page! [License](#license) -------------------- [`TelemetryUI`](TelemetryUI.html) is Β© 2023 [Mirego](https://www.mirego.com) and may be freely distributed under the [New BSD license](http://opensource.org/licenses/BSD-3-Clause). See the [`LICENSE.md`](https://github.com/mirego/telemetry_ui/blob/master/LICENSE.md) file. [About Mirego](#about-mirego) ------------------------------ [Mirego](https://www.mirego.com) is a team of passionate people who believe that work is a place where you can innovate and have fun. We’re a team of [talented people](https://life.mirego.com) who imagine and build beautiful Web and mobile applications. We come together to share ideas and [change the world](http://www.mirego.org). We also [love open-source software](https://open.mirego.com) and we try to give back to the community as much as we can. [← Previous Page API Reference](api-reference.html) [Next Page β†’ Using application data](application-data.html)
jason
hex
Jason β€” jason v1.4.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/README.md#L1 "View Source") Jason =============================================================================================================== A blazing fast JSON parser and generator in pure Elixir. The parser and generator are at least twice as fast as other Elixir/Erlang libraries (most notably `Poison`). The performance is comparable to `jiffy`, which is implemented in C as a NIF. Jason is usually only twice as slow. Both parser and generator fully conform to [RFC 8259](https://tools.ietf.org/html/rfc8259) and [ECMA 404](http://www.ecma-international.org/publications/standards/Ecma-404.htm) standards. The parser is tested using [JSONTestSuite](https://github.com/nst/JSONTestSuite). [installation](#installation) Installation -------------------------------------------- The package can be installed by adding `jason` to your list of dependencies in `mix.exs`: ``` def deps do [{:jason, "~> 1.4"}] end ``` [basic-usage](#basic-usage) Basic Usage ----------------------------------------- ``` iex(1)> Jason.encode!(%{"age" => 44, "name" => "Steve Irwin", "nationality" => "Australian"}) "{\"age\":44,\"name\":\"Steve Irwin\",\"nationality\":\"Australian\"}" iex(2)> Jason.decode!(~s({"age":44,"name":"Steve Irwin","nationality":"Australian"})) %{"age" => 44, "name" => "Steve Irwin", "nationality" => "Australian"} ``` Full documentation can be found at <https://hexdocs.pm/jason>. [use-with-other-libraries](#use-with-other-libraries) Use with other libraries -------------------------------------------------------------------------------- ### [postgrex](#postgrex) Postgrex Versions starting at 0.14.0 use [`Jason`](Jason.html) by default. For earlier versions, please refer to [previous versions of this document](https://github.com/michalmuskala/jason/tree/v1.1.2#postgrex). ### [ecto](#ecto) Ecto Versions starting at 3.0.0 use [`Jason`](Jason.html) by default. For earlier versions, please refer to [previous versions of this document](https://github.com/michalmuskala/jason/tree/v1.1.2#ecto). ### [plug-and-phoenix](#plug-and-phoenix) Plug (and Phoenix) Phoenix starting at 1.4.0 uses [`Jason`](Jason.html) by default. For earlier versions, please refer to [previous versions of this document](https://github.com/michalmuskala/jason/tree/v1.1.2#plug-and-phoenix). ### [absinthe](#absinthe) Absinthe You need to pass the `:json_codec` option to `Absinthe.Plug` ``` # When called directly: plug Absinthe.Plug, schema: MyApp.Schema, json\_codec: Jason # When used in phoenix router: forward "/api", to: Absinthe.Plug, init\_opts: [schema: MyApp.Schema, json\_codec: Jason] ``` [benchmarks](#benchmarks) Benchmarks -------------------------------------- Detailed benchmarks (including memory measurements): <https://gist.github.com/michalmuskala/4d64a5a7696ca84ac7c169a0206640d5> HTML reports for the benchmark (only performance measurements): <http://michal.muskala.eu/jason/decode.html> and <http://michal.muskala.eu/jason/encode.html> ### [running](#running) Running Benchmarks against most popular Elixir & Erlang json libraries can be executed after going into the `bench/` folder and then executing `mix bench.encode` and `mix bench.decode`. A HTML report of the benchmarks (after their execution) can be found in `bench/output/encode.html` and `bench/output/decode.html` respectively. [differences-to-poison](#differences-to-poison) Differences to Poison ----------------------------------------------------------------------- Jason has a couple feature differences compared to Poison. * Jason follows the JSON spec more strictly, for example it does not allow unescaped newline characters in JSON strings - e.g. `"\"\n\""` will produce a decoding error. * no support for decoding into data structures (the `as:` option). * no built-in encoders for [`MapSet`](https://hexdocs.pm/elixir/MapSet.html), [`Range`](https://hexdocs.pm/elixir/Range.html) and [`Stream`](https://hexdocs.pm/elixir/Stream.html). * no support for encoding arbitrary structs - explicit implementation of the [`Jason.Encoder`](Jason.Encoder.html) protocol is always required. * different pretty-printing customisation options (default `pretty: true` works the same) ### [encoders](#encoders) Encoders If you require encoders for any of the unsupported collection types, I suggest adding the needed implementations directly to your project: ``` defimpl Jason.Encoder, for: [MapSet, Range, Stream] do def encode(struct, opts) do Jason.Encode.list(Enum.to\_list(struct), opts) end end ``` If you need to encode some struct that does not implement the protocol, if you own the struct, you can derive the implementation specifying which fields should be encoded to JSON: ``` @derive {Jason.Encoder, only: [....]} defstruct # ... ``` It is also possible to encode all fields, although this should be used carefully to avoid accidentally leaking private information when new fields are added: ``` @derive Jason.Encoder defstruct # ... ``` Finally, if you don't own the struct you want to encode to JSON, you may use [`Protocol.derive/3`](https://hexdocs.pm/elixir/Protocol.html#derive/3) placed outside of any module: ``` Protocol.derive(Jason.Encoder, NameOfTheStruct, only: [...]) Protocol.derive(Jason.Encoder, NameOfTheStruct) ``` [injecting-an-already-encoded-json-inside-a-to-be-encoded-structure](#injecting-an-already-encoded-json-inside-a-to-be-encoded-structure) Injecting an already encoded JSON inside a to-be-encoded structure -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- If parts of the to-be-encoded structure are already JSON-encoded, you can use [`Jason.Fragment`](Jason.Fragment.html) to mark the parts as already encoded, and avoid a decoding/encoding roundtrip. ``` already\_encoded\_json = Jason.encode!(%{hello: "world"}) Jason.encode!(%{foo: Jason.Fragment.new(already\_encoded\_json)}) ```` This feature is especially useful if you need to cache a part of the JSON, or if it is already provided by another system (e.g. `jsonb\_agg` with Postgres). ## License Jason is released under the Apache License 2.0 - see the [LICENSE](LICENSE) file. Some elements of tests and benchmarks have their origins in the [Poison library](https://github.com/devinus/poison) and were initially licensed under [CC0-1.0](https://creativecommons.org/publicdomain/zero/1.0/). ``` [← Previous Page API Reference](api-reference.html) [Next Page β†’ Changelog](changelog.html) Jason β€” jason v1.4.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/jason.ex#L1 "View Source") Jason (jason v1.4.1) ================================================================================================================================= A blazing fast JSON parser and generator in pure Elixir. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [decode\_opt()](#t:decode_opt/0) [encode\_opt()](#t:encode_opt/0) [escape()](#t:escape/0) [floats()](#t:floats/0) [keys()](#t:keys/0) [maps()](#t:maps/0) [objects()](#t:objects/0) [strings()](#t:strings/0) [Functions](#functions) ------------------------ [decode!(input, opts \\ [])](#decode!/2) Parses a JSON value from `input` iodata. [decode(input, opts \\ [])](#decode/2) Parses a JSON value from `input` iodata. [encode!(input, opts \\ [])](#encode!/2) Generates JSON corresponding to `input`. [encode(input, opts \\ [])](#encode/2) Generates JSON corresponding to `input`. [encode\_to\_iodata!(input, opts \\ [])](#encode_to_iodata!/2) Generates JSON corresponding to `input` and returns iodata. [encode\_to\_iodata(input, opts \\ [])](#encode_to_iodata/2) Generates JSON corresponding to `input` and returns iodata. [Link to this section](#types) Types ===================================== [Link to this type](#t:decode_opt/0 "Link to this type") decode\_opt() ============= [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/jason.ex#L21 "View Source") ``` @type decode_opt() :: {:keys, [keys](#t:keys/0)()} | {:strings, [strings](#t:strings/0)()} | {:floats, [floats](#t:floats/0)()} | {:objects, [objects](#t:objects/0)()} ``` [Link to this type](#t:encode_opt/0 "Link to this type") encode\_opt() ============= [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/jason.ex#L11 "View Source") ``` @type encode_opt() :: {:escape, [escape](#t:escape/0)()} | {:maps, [maps](#t:maps/0)()} | {:pretty, [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [Jason.Formatter.opts](Jason.Formatter.html#t:opts/0)()} ``` [Link to this type](#t:escape/0 "Link to this type") escape() ======== [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/jason.ex#L8 "View Source") ``` @type escape() :: :json | :unicode_safe | :html_safe | :javascript_safe ``` [Link to this type](#t:floats/0 "Link to this type") floats() ======== [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/jason.ex#L17 "View Source") ``` @type floats() :: :native | :decimals ``` [Link to this type](#t:keys/0 "Link to this type") keys() ====== [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/jason.ex#L13 "View Source") ``` @type keys() :: :atoms | :atoms! | :strings | :copy | ([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() -> [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) ``` [Link to this type](#t:maps/0 "Link to this type") maps() ====== [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/jason.ex#L9 "View Source") ``` @type maps() :: :naive | :strict ``` [Link to this type](#t:objects/0 "Link to this type") objects() ========= [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/jason.ex#L19 "View Source") ``` @type objects() :: :maps | :ordered_objects ``` [Link to this type](#t:strings/0 "Link to this type") strings() ========= [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/jason.ex#L15 "View Source") ``` @type strings() :: :reference | :copy ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#decode!/2 "Link to this function") decode!(input, opts \\ []) ========================== [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/jason.ex#L89 "View Source") ``` @spec decode!([iodata](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [[decode\_opt](#t:decode_opt/0)()]) :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Parses a JSON value from `input` iodata. Similar to [`decode/2`](#decode/2) except it will unwrap the error tuple and raise in case of errors. [examples](#decode!/2-examples) Examples ------------------------------------------ ``` iex> Jason.decode!("{}") %{} iex> Jason.decode!("invalid") \*\* (Jason.DecodeError) unexpected byte at position 0: 0x69 ("i") ``` [Link to this function](#decode/2 "Link to this function") decode(input, opts \\ []) ========================= [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/jason.ex#L68 "View Source") ``` @spec decode([iodata](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [[decode\_opt](#t:decode_opt/0)()]) :: {:ok, [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | {:error, [Jason.DecodeError.t](Jason.DecodeError.html#t:t/0)()} ``` Parses a JSON value from `input` iodata. [options](#decode/2-options) Options -------------------------------------- * `:keys` - controls how keys in objects are decoded. Possible values are: + `:strings` (default) - decodes keys as binary strings, + `:atoms` - keys are converted to atoms using [`String.to_atom/1`](https://hexdocs.pm/elixir/String.html#to_atom/1), + `:atoms!` - keys are converted to atoms using [`String.to_existing_atom/1`](https://hexdocs.pm/elixir/String.html#to_existing_atom/1), + custom decoder - additionally a function accepting a string and returning a key is accepted. * `:strings` - controls how strings (including keys) are decoded. Possible values are: + `:reference` (default) - when possible tries to create a sub-binary into the original + `:copy` - always copies the strings. This option is especially useful when parts of the decoded data will be stored for a long time (in ets or some process) to avoid keeping the reference to the original data. * `:floats` - controls how floats are decoded. Possible values are: + `:native` (default) - Native conversion from binary to float using [`:erlang.binary_to_float/1`](https://www.erlang.org/doc/man/erlang.html#binary_to_float-1), + `:decimals` - uses [`Decimal.new/1`](https://hexdocs.pm/decimal/2.0.0/Decimal.html#new/1) to parse the binary into a Decimal struct with arbitrary precision. * `:objects` - controls how objects are decoded. Possible values are: + `:maps` (default) - objects are decoded as maps + `:ordered_objects` - objects are decoded as [`Jason.OrderedObject`](Jason.OrderedObject.html) structs [decoding-keys-to-atoms](#decode/2-decoding-keys-to-atoms) Decoding keys to atoms ----------------------------------------------------------------------------------- The `:atoms` option uses the [`String.to_atom/1`](https://hexdocs.pm/elixir/String.html#to_atom/1) call that can create atoms at runtime. Since the atoms are not garbage collected, this can pose a DoS attack vector when used on user-controlled data. [examples](#decode/2-examples) Examples ----------------------------------------- ``` iex> Jason.decode("{}") {:ok, %{}} iex> Jason.decode("invalid") {:error, %Jason.DecodeError{data: "invalid", position: 0, token: nil}} ``` [Link to this function](#encode!/2 "Link to this function") encode!(input, opts \\ []) ========================== [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/jason.ex#L161 "View Source") ``` @spec encode!([term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [[encode\_opt](#t:encode_opt/0)()]) :: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Generates JSON corresponding to `input`. Similar to [`encode/1`](#encode/1) except it will unwrap the error tuple and raise in case of errors. [examples](#encode!/2-examples) Examples ------------------------------------------ ``` iex> Jason.encode!(%{a: 1}) ~S|{"a":1}| iex> Jason.encode!("\xFF") \*\* (Jason.EncodeError) invalid byte 0xFF in <<255>> ``` [Link to this function](#encode/2 "Link to this function") encode(input, opts \\ []) ========================= [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/jason.ex#L138 "View Source") ``` @spec encode([term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [[encode\_opt](#t:encode_opt/0)()]) :: {:ok, [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()} | {:error, [Jason.EncodeError.t](Jason.EncodeError.html#t:t/0)() | [Exception.t](https://hexdocs.pm/elixir/Exception.html#t:t/0)()} ``` Generates JSON corresponding to `input`. The generation is controlled by the [`Jason.Encoder`](Jason.Encoder.html) protocol, please refer to the module to read more on how to define the protocol for custom data types. [options](#encode/2-options) Options -------------------------------------- * `:escape` - controls how strings are encoded. Possible values are: + `:json` (default) - the regular JSON escaping as defined by RFC 7159. + `:javascript_safe` - additionally escapes the LINE SEPARATOR (U+2028) and PARAGRAPH SEPARATOR (U+2029) characters to make the produced JSON valid JavaScript. + `:html_safe` - similar to `:javascript_safe`, but also escapes the `/` character to prevent XSS. + `:unicode_safe` - escapes all non-ascii characters. * `:maps` - controls how maps are encoded. Possible values are: + `:strict` - checks the encoded map for duplicate keys and raises if they appear. For example `%{:foo => 1, "foo" => 2}` would be rejected, since both keys would be encoded to the string `"foo"`. + `:naive` (default) - does not perform the check. * `:pretty` - controls pretty printing of the output. Possible values are: + `true` to pretty print with default configuration + a keyword of options as specified by [`Jason.Formatter.pretty_print/2`](Jason.Formatter.html#pretty_print/2). [examples](#encode/2-examples) Examples ----------------------------------------- ``` iex> Jason.encode(%{a: 1}) {:ok, ~S|{"a":1}|} iex> Jason.encode("\xFF") {:error, %Jason.EncodeError{message: "invalid byte 0xFF in <<255>>"}} ``` [Link to this function](#encode_to_iodata!/2 "Link to this function") encode\_to\_iodata!(input, opts \\ []) ====================================== [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/jason.ex#L210 "View Source") ``` @spec encode_to_iodata!([term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [[encode\_opt](#t:encode_opt/0)()]) :: [iodata](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Generates JSON corresponding to `input` and returns iodata. Similar to [`encode_to_iodata/1`](#encode_to_iodata/1) except it will unwrap the error tuple and raise in case of errors. [examples](#encode_to_iodata!/2-examples) Examples ---------------------------------------------------- ``` iex> iodata = Jason.encode\_to\_iodata!(%{a: 1}) iex> IO.iodata\_to\_binary(iodata) ~S|{"a":1}| iex> Jason.encode\_to\_iodata!("\xFF") \*\* (Jason.EncodeError) invalid byte 0xFF in <<255>> ``` [Link to this function](#encode_to_iodata/2 "Link to this function") encode\_to\_iodata(input, opts \\ []) ===================================== [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/jason.ex#L189 "View Source") ``` @spec encode_to_iodata([term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [[encode\_opt](#t:encode_opt/0)()]) :: {:ok, [iodata](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | {:error, [Jason.EncodeError.t](Jason.EncodeError.html#t:t/0)() | [Exception.t](https://hexdocs.pm/elixir/Exception.html#t:t/0)()} ``` Generates JSON corresponding to `input` and returns iodata. This function should be preferred to [`encode/2`](#encode/2), if the generated JSON will be handed over to one of the IO functions or sent over the socket. The Erlang runtime is able to leverage vectorised writes and avoid allocating a continuous buffer for the whole resulting string, lowering memory use and increasing performance. [examples](#encode_to_iodata/2-examples) Examples --------------------------------------------------- ``` iex> {:ok, iodata} = Jason.encode\_to\_iodata(%{a: 1}) iex> IO.iodata\_to\_binary(iodata) ~S|{"a":1}| iex> Jason.encode\_to\_iodata("\xFF") {:error, %Jason.EncodeError{message: "invalid byte 0xFF in <<255>>"}} ``` Jason.DecodeError β€” jason v1.4.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/decoder.ex#L1 "View Source") Jason.DecodeError exception (jason v1.4.1) ========================================================================================================================================================= [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [message(map)](#message/1) Callback implementation for [`Exception.message/1`](https://hexdocs.pm/elixir/Exception.html#c:message/1). [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/decoder.ex#L2 "View Source") ``` @type t() :: %Jason.DecodeError{ __exception__: true, data: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), position: [integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), token: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#message/1 "Link to this function") message(map) ============ [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/decoder.ex#L6 "View Source") Callback implementation for [`Exception.message/1`](https://hexdocs.pm/elixir/Exception.html#c:message/1). Jason.Encode β€” jason v1.4.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/encode.ex#L14 "View Source") Jason.Encode (jason v1.4.1) ========================================================================================================================================== Utilities for encoding elixir values to JSON. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [opts()](#t:opts/0) [Functions](#functions) ------------------------ [atom(atom, arg)](#atom/2) [float(float)](#float/1) [integer(integer)](#integer/1) [keyword(list, arg2)](#keyword/2) [list(list, arg)](#list/2) [map(value, arg)](#map/2) [string(string, arg)](#string/2) [struct(value, arg)](#struct/2) [value(value, arg)](#value/2) Equivalent to calling the [`Jason.Encoder.encode/2`](Jason.Encoder.html#encode/2) protocol function. [Link to this section](#types) Types ===================================== [Link to this opaque](#t:opts/0 "Link to this opaque") opts() ====== [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/encode.ex#L25 "View Source") (opaque) ``` @opaque opts() ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#atom/2 "Link to this function") atom(atom, arg) =============== [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/encode.ex#L115 "View Source") ``` @spec atom([atom](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [opts](#t:opts/0)()) :: [iodata](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this function](#float/1 "Link to this function") float(float) ============ [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/encode.ex#L140 "View Source") ``` @spec float([float](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [iodata](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this function](#integer/1 "Link to this function") integer(integer) ================ [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/encode.ex#L126 "View Source") ``` @spec integer([integer](https://hexdocs.pm/elixir/typespecs.html#basic-types)()) :: [iodata](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this function](#keyword/2 "Link to this function") keyword(list, arg2) =================== [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/encode.ex#L173 "View Source") ``` @spec keyword( [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [opts](#t:opts/0)() ) :: [iodata](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this function](#list/2 "Link to this function") list(list, arg) =============== [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/encode.ex#L150 "View Source") ``` @spec list([list](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [opts](#t:opts/0)()) :: [iodata](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this function](#map/2 "Link to this function") map(value, arg) =============== [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/encode.ex#L179 "View Source") ``` @spec map([map](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [opts](#t:opts/0)()) :: [iodata](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this function](#string/2 "Link to this function") string(string, arg) =================== [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/encode.ex#L276 "View Source") ``` @spec string([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), [opts](#t:opts/0)()) :: [iodata](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this function](#struct/2 "Link to this function") struct(value, arg) ================== [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/encode.ex#L228 "View Source") ``` @spec struct( [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [opts](#t:opts/0)() ) :: [iodata](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this function](#value/2 "Link to this function") value(value, arg) ================= [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/encode.ex#L71 "View Source") ``` @spec value([term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [opts](#t:opts/0)()) :: [iodata](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Equivalent to calling the [`Jason.Encoder.encode/2`](Jason.Encoder.html#encode/2) protocol function. Slightly more efficient for built-in types because of the internal dispatching. Jason.EncodeError β€” jason v1.4.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/encode.ex#L1 "View Source") Jason.EncodeError exception (jason v1.4.1) ======================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [new(arg)](#new/1) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/encode.ex#L4 "View Source") ``` @type t() :: %Jason.EncodeError{__exception__: true, message: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#new/1 "Link to this function") new(arg) ======== [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/encode.ex#L6 "View Source") Jason.Encoder β€” jason v1.4.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/encoder.ex#L1 "View Source") Jason.Encoder protocol (jason v1.4.1) ==================================================================================================================================================== Protocol controlling how a value is encoded to JSON. [deriving](#module-deriving) Deriving --------------------------------------- The protocol allows leveraging the Elixir's `@derive` feature to simplify protocol implementation in trivial cases. Accepted options are: * `:only` - encodes only values of specified keys. * `:except` - encodes all struct fields except specified keys. By default all keys except the `:__struct__` key are encoded. [example](#module-example) Example ------------------------------------ Let's assume a presence of the following struct: ``` defmodule Test do defstruct [:foo, :bar, :baz] end ``` If we were to call `@derive Jason.Encoder` just before `defstruct`, an implementation similar to the following implementation would be generated: ``` defimpl Jason.Encoder, for: Test do def encode(value, opts) do Jason.Encode.map(Map.take(value, [:foo, :bar, :baz]), opts) end end ``` If we called `@derive {Jason.Encoder, only: [:foo]}`, an implementation similar to the following implementation would be generated: ``` defimpl Jason.Encoder, for: Test do def encode(value, opts) do Jason.Encode.map(Map.take(value, [:foo]), opts) end end ``` If we called `@derive {Jason.Encoder, except: [:foo]}`, an implementation similar to the following implementation would be generated: ``` defimpl Jason.Encoder, for: Test do def encode(value, opts) do Jason.Encode.map(Map.take(value, [:bar, :baz]), opts) end end ``` The actually generated implementations are more efficient computing some data during compilation similar to the macros from the [`Jason.Helpers`](Jason.Helpers.html) module. [explicit-implementation](#module-explicit-implementation) Explicit implementation ------------------------------------------------------------------------------------ If you wish to implement the protocol fully yourself, it is advised to use functions from the [`Jason.Encode`](Jason.Encode.html) module to do the actual iodata generation - they are highly optimized and verified to always produce valid JSON. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [opts()](#t:opts/0) [t()](#t:t/0) [Functions](#functions) ------------------------ [encode(value, opts)](#encode/2) Encodes `value` to JSON. [Link to this section](#types) Types ===================================== [Link to this type](#t:opts/0 "Link to this type") opts() ====== [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/encoder.ex#L63 "View Source") ``` @type opts() :: [Jason.Encode.opts](Jason.Encode.html#t:opts/0)() ``` [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/encoder.ex#L62 "View Source") ``` @type t() :: [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#encode/2 "Link to this function") encode(value, opts) =================== [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/encoder.ex#L74 "View Source") ``` @spec encode([t](#t:t/0)(), [opts](#t:opts/0)()) :: [iodata](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Encodes `value` to JSON. The argument `opts` is opaque - it can be passed to various functions in [`Jason.Encode`](Jason.Encode.html) (or to the protocol function itself) for encoding values to JSON. Jason.Formatter β€” jason v1.4.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/formatter.ex#L1 "View Source") Jason.Formatter (jason v1.4.1) =============================================================================================================================================== Pretty-printing and minimizing functions for JSON-encoded data. Input is required to be in an 8-bit-wide encoding such as UTF-8 or Latin-1 in [`iodata/0`](https://hexdocs.pm/elixir/typespecs.html#built-in-types) format. Input must have valid JSON, invalid JSON may produce unexpected results or errors. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [opts()](#t:opts/0) [Functions](#functions) ------------------------ [minimize(input, opts \\ [])](#minimize/2) Minimizes JSON-encoded `input`. [minimize\_to\_iodata(input, opts)](#minimize_to_iodata/2) Minimizes JSON-encoded `input` and returns iodata. [pretty\_print(input, opts \\ [])](#pretty_print/2) Pretty-prints JSON-encoded `input`. [pretty\_print\_to\_iodata(input, opts \\ [])](#pretty_print_to_iodata/2) Pretty-prints JSON-encoded `input` and returns iodata. [Link to this section](#types) Types ===================================== [Link to this type](#t:opts/0 "Link to this type") opts() ====== [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/formatter.ex#L10 "View Source") ``` @type opts() :: [ indent: [iodata](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), line_separator: [iodata](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), record_separator: [iodata](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), after_colon: [iodata](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ] ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#minimize/2 "Link to this function") minimize(input, opts \\ []) =========================== [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/formatter.ex#L96 "View Source") ``` @spec minimize([iodata](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [opts](#t:opts/0)()) :: [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Minimizes JSON-encoded `input`. `input` may contain multiple JSON objects or arrays, optionally separated by whitespace (e.g., one object per line). Minimized output will contain one object per line. No trailing newline is emitted. [options](#minimize/2-options) Options ---------------------------------------- * `:record_separator` - controls the string used as newline (default: `"\n"`). [examples](#minimize/2-examples) Examples ------------------------------------------- ``` iex> Jason.Formatter.minimize(~s|{ "a" : "b" , "c": \n\n 2}|) ~s|{"a":"b","c":2}| ``` [Link to this function](#minimize_to_iodata/2 "Link to this function") minimize\_to\_iodata(input, opts) ================================= [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/formatter.ex#L112 "View Source") ``` @spec minimize_to_iodata([iodata](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [opts](#t:opts/0)()) :: [iodata](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Minimizes JSON-encoded `input` and returns iodata. This function should be preferred to [`minimize/2`](#minimize/2), if the minimized JSON will be handed over to one of the IO functions or sent over the socket. The Erlang runtime is able to leverage vectorised writes and avoid allocating a continuous buffer for the whole resulting string, lowering memory use and increasing performance. [Link to this function](#pretty_print/2 "Link to this function") pretty\_print(input, opts \\ []) ================================ [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/formatter.ex#L51 "View Source") ``` @spec pretty_print([iodata](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [opts](#t:opts/0)()) :: [binary](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Pretty-prints JSON-encoded `input`. `input` may contain multiple JSON objects or arrays, optionally separated by whitespace (e.g., one object per line). Objects in output will be separated by newlines. No trailing newline is emitted. [options](#pretty_print/2-options) Options -------------------------------------------- * `:indent` - used for nested objects and arrays (default: two spaces - `" "`); * `:line_separator` - used in nested objects (default: `"\n"`); * `:record_separator` - separates root-level objects and arrays (default is the value for `:line_separator` option); * `:after_colon` - printed after a colon inside objects (default: one space - `" "`). [examples](#pretty_print/2-examples) Examples ----------------------------------------------- ``` iex> Jason.Formatter.pretty\_print(~s|{"a":{"b": [1, 2]}}|) ~s|{ "a": { "b": [ 1, 2 ] } }| ``` [Link to this function](#pretty_print_to_iodata/2 "Link to this function") pretty\_print\_to\_iodata(input, opts \\ []) ============================================ [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/formatter.ex#L67 "View Source") ``` @spec pretty_print_to_iodata([iodata](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [opts](#t:opts/0)()) :: [iodata](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Pretty-prints JSON-encoded `input` and returns iodata. This function should be preferred to [`pretty_print/2`](#pretty_print/2), if the pretty-printed JSON will be handed over to one of the IO functions or sent over the socket. The Erlang runtime is able to leverage vectorised writes and avoid allocating a continuous buffer for the whole resulting string, lowering memory use and increasing performance. Jason.Fragment β€” jason v1.4.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/fragment.ex#L1 "View Source") Jason.Fragment (jason v1.4.1) ============================================================================================================================================= Provides a way to inject an already-encoded JSON structure into a to-be-encoded structure in optimized fashion. This avoids a decoding/encoding round-trip for the subpart. This feature can be used for caching parts of the JSON, or delegating the generation of the JSON to a third-party system (e.g. Postgres). [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [new(iodata)](#new/1) [Link to this section](#functions) Functions ============================================= [Link to this function](#new/1 "Link to this function") new(iodata) =========== [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/fragment.ex#L14 "View Source") Jason.Helpers β€” jason v1.4.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/helpers.ex#L1 "View Source") Jason.Helpers (jason v1.4.1) =========================================================================================================================================== Provides macro facilities for partial compile-time encoding of JSON. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [json\_map(kv)](#json_map/1) Encodes a JSON map from a compile-time keyword. [json\_map\_take(map, take)](#json_map_take/2) Encodes a JSON map from a variable containing a map and a compile-time list of keys. [Link to this section](#functions) Functions ============================================= [Link to this macro](#json_map/1 "Link to this macro") json\_map(kv) ============= [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/helpers.ex#L32 "View Source") (macro) Encodes a JSON map from a compile-time keyword. Encodes the keys at compile time and strives to create as flat iodata structure as possible to achieve maximum efficiency. Does encoding right at the call site, but returns an `%Jason.Fragment{}` struct that needs to be passed to one of the "main" encoding functions - for example [`Jason.encode/2`](Jason.html#encode/2) for final encoding into JSON - this makes it completely transparent for most uses. Only allows keys that do not require escaping in any of the supported encoding modes. This means only ASCII characters from the range 0x1F..0x7F excluding '\', '/' and '"' are allowed - this also excludes all control characters like newlines. Preserves the order of the keys. [example](#json_map/1-example) Example ---------------------------------------- ``` iex> fragment = json\_map(foo: 1, bar: 2) iex> Jason.encode!(fragment) "{\"foo\":1,\"bar\":2}" ``` [Link to this macro](#json_map_take/2 "Link to this macro") json\_map\_take(map, take) ========================== [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/helpers.ex#L70 "View Source") (macro) Encodes a JSON map from a variable containing a map and a compile-time list of keys. It is equivalent to calling [`Map.take/2`](https://hexdocs.pm/elixir/Map.html#take/2) before encoding. Otherwise works similar to `json_map/2`. [example](#json_map_take/2-example) Example --------------------------------------------- ``` iex> map = %{a: 1, b: 2, c: 3} iex> fragment = json\_map\_take(map, [:c, :b]) iex> Jason.encode!(fragment) "{\"c\":3,\"b\":2}" ``` Jason.OrderedObject β€” jason v1.4.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/ordered_object.ex#L1 "View Source") Jason.OrderedObject (jason v1.4.1) ======================================================================================================================================================== [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [%Jason.OrderedObject{}](#__struct__/0) Struct implementing a JSON object retaining order of properties. [new(values)](#new/1) [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/ordered_object.ex#L14 "View Source") ``` @type t() :: %Jason.OrderedObject{values: [{[String.Chars.t](https://hexdocs.pm/elixir/String.Chars.html#t:t/0)(), [term](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()}]} ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#__struct__/0 "Link to this function") %Jason.OrderedObject{} ====================== [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/ordered_object.ex#L16 "View Source") (struct) Struct implementing a JSON object retaining order of properties. A wrapper around a keyword (that supports non-atom keys) allowing for proper protocol implementations. Implements the [`Access`](https://hexdocs.pm/elixir/Access.html) behaviour and [`Enumerable`](https://hexdocs.pm/elixir/Enumerable.html) protocol with complexity similar to keywords/lists. [Link to this function](#new/1 "Link to this function") new(values) =========== [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/ordered_object.ex#L18 "View Source") Jason.Sigil β€” jason v1.4.1 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/sigil.ex#L1 "View Source") Jason.Sigil (jason v1.4.1) ======================================================================================================================================= [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [sigil\_J(term, modifiers)](#sigil_J/2) Handles the sigil `~J` for raw JSON strings. [sigil\_j(term, modifiers)](#sigil_j/2) Handles the sigil `~j` for JSON strings. [Link to this section](#functions) Functions ============================================= [Link to this macro](#sigil_J/2 "Link to this macro") sigil\_J(term, modifiers) ========================= [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/sigil.ex#L67 "View Source") (macro) Handles the sigil `~J` for raw JSON strings. Decodes a raw string ignoring Elixir interpolations and escape characters at compile-time. [examples](#sigil_J/2-examples) Examples ------------------------------------------ ``` iex> ~J'"#{string}"' "\#{string}" iex> ~J'"\u0078\\y"' "x\\y" iex> ~J'{"#{key}": "#{}"}'a %{"\#{key}": "\#{}"} ``` [Link to this macro](#sigil_j/2 "Link to this macro") sigil\_j(term, modifiers) ========================= [View Source](https://github.com/michalmuskala/jason/blob/v1.4.1/lib/sigil.ex#L40 "View Source") (macro) Handles the sigil `~j` for JSON strings. Calls [`Jason.decode!/2`](Jason.html#decode!/2) with modifiers mapped to options. Given a string literal without interpolations, decodes the string at compile-time. [modifiers](#sigil_j/2-modifiers) Modifiers --------------------------------------------- See [`Jason.decode/2`](Jason.html#decode/2) for detailed descriptions. * `a` - equivalent to `{:keys, :atoms}` option * `A` - equivalent to `{:keys, :atoms!}` option * `r` - equivalent to `{:strings, :reference}` option * `c` - equivalent to `{:strings, :copy}` option [examples](#sigil_j/2-examples) Examples ------------------------------------------ ``` iex> ~j"0" 0 iex> ~j"[1, 2, 3]" [1, 2, 3] iex> ~j'"string"'r "string" iex> ~j"{}" %{} iex> ~j'{"atom": "value"}'a %{atom: "value"} iex> ~j'{"#{:j}": #{'"j"'}}'A %{j: "j"} ```
phx_gen_solid
hex
Overview β€” phx\_gen\_solid v0.3.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/remoteoss/phx_gen_solid/blob/v0.3.0/guides/overview.md#L1 "View Source") Overview =============================================================================================================================== > Still early in development & subject to change > > `mix phx.gen.solid` exists to generate the boilerplate usually required when utilizing the SOLID principles, outlined below, in a larger phoenix project. By default it provides fairly general templates for each of the handlers, services, finders, and values. However, all of the templates are completely overrideable. [currently-supported-generators](#currently-supported-generators) Currently Supported Generators -------------------------------------------------------------------------------------------------- * [`Mix.Tasks.Phx.Gen.Solid.Value`](Mix.Tasks.Phx.Gen.Solid.Value.html) - used to generate a value * `Mix.Tasks.Phx.Gen.Solid.Handler` - TODO * [`Mix.Tasks.Phx.Gen.Solid.Service`](Mix.Tasks.Phx.Gen.Solid.Service.html) - used to generate C~~R~~UD services * `Mix.Tasks.Phx.Gen.Solid.Finder` - TODO [solid-principles](#solid-principles) SOLID Principles -------------------------------------------------------- The best way to contain cyclomatic complexity is by employing SOLID principles whenever applicable: > Single-responsibility principle - A class/module should only have a single responsibility > > > Open-closed principle - Software entities should be open to extension but closed to modification > > > Liskov Substitution principle - Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program. > > > Interface Segregation principle - Many client-specific interfaces are better than one general-purpose interface. > > > Dependency inversion principle - Abstractions over concretions > > [4-patterns](#4-patterns) 4 Patterns -------------------------------------- A way to enforce the SOLID principles is by implementing a combination of 4 design patterns and their interactions to guide codebase scalability. * Handlers * Services * Finders * Values ![Pattern Interaction Map](assets/patterns.png) ### [handlers](#handlers) Handlers Handlers are orchestators. They exist only to dispatch and compose. It orders execution of tasks and/or fetches data to put a response back together. **Do** * Organize by business logic, domain, or sub-domain * Orchestrate high level operations * Command services, finders, values or other handlers * Multiple public functions * Keep controllers thin * Make it easy to read * Flow control (if, case, pattern match, etc.) **Don't** * Directly create/modify data structures * Execute any read/write operations Below is an example of a handler that creates a user, sends a notification, and fetches some data. ``` defmodule Remoteoss.Handler.Registration do alias Remoteoss.Accounts.Service.{CreateUser, SendNotification} alias Remoteoss.Accounts.Finder.SuperHeroName def setup\_user(name) do with {:ok, user} <- CreateUser.call(name), :ok <- SendNotification.call(user), super\_hero\_details <- SuperHeroName.find(name) do {user, super\_hero\_details} else error -> error end end end ``` ### [services](#services) Services Services are the execution arm. Services execute actions, write data, invoke third party services, etc. **Do** * Organize by Application Logic * Reusable across Handlers and other Services * Commands services, finders and values * Focuses on achieving one single goal * Exposes a single public function: `call` * Create/modify data structures * Execute and take actions **Don't** * Use a service to achieve multiple goals * Call Handlers * If too big you need to break it into smaller services or your service is actually a handler Below is an example of a service that creates a user. ``` defmodule Remoteoss.Accounts.Service.CreateUser do alias Remoteoss.Accounts alias Remoteoss.Service.ActivityLog require Logger def call(name) do with {:ok, user} <- Accounts.create\_user(%{name: name}), :ok <- ActivityLog.call(:create\_user) do {:ok, user} else {:error, %Ecto.Changeset{} = changeset} -> {:error, {:invalid\_params, changeset.errors}} error -> error end end end ``` ### [finders](#finders) Finders Finders fetch data, they don't mutate nor write, only read and present. Non-complex database queries may also exist in Phoenix Contexts. A query can be considered complex when their are several conditions for filtering, ordering, and/or pagination. Rule of thumb is when passing a params or opts Map variable to the function, a Finder is more appropriate. **Do** * Organized by Application Logic * Reusable across Handlers and Services * Focuses on achieving one single goal * Exposes a single public function: `find` * Read data structure * Uses Values to return complex data * Finders only read and look up data **Don't** * Call any services * Create/modify data structures Below is an example of a finder that finds a user. ``` defmodule Remoteoss.Accounts.Finder.UserWithName do alias Remoteoss.Accounts def find(name) when is\_binary(name) do case Accounts.get\_user\_by\_name(name) do nil -> {:error, :not\_found} user -> {:ok, user} end end def find(\_), do: {:error, :invalid\_name} end ``` ### [values](#values) Values Values allow us to compose data structures such as responses, intermediate objects, etc. **Do** * Organize by Application Logic * Reusable across Handlers, Services, and Finders * Focuses on composing a data structure * Exposes a single public function: `build` * Use composition to build through simple logic * Only returns a [`List`](https://hexdocs.pm/elixir/List.html) or a [`Map`](https://hexdocs.pm/elixir/Map.html) **Don't** * Call any Services, Handlers or Finders Below is an example of a value that builds a user object to be used in a JSON response. Note this utilizes the helper functions generated with [`Mix.Tasks.Phx.Gen.Solid.Value`](Mix.Tasks.Phx.Gen.Solid.Value.html). ``` defmodule Remoteoss.Accounts.Value.User do alias Remoteoss.Value @valid\_fields [:id, :name] def build(user, valid\_fields \\ @valid\_fields) def build(nil, \_), do: nil def build(user, valid\_fields) do user |> Value.init() |> Value.only(valid\_fields) end end ``` [← Previous Page API Reference](api-reference.html) PhxGenSolid.Generator β€” phx\_gen\_solid v0.3.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/remoteoss/phx_gen_solid/blob/v0.3.0/lib/phx_gen_solid/generator.ex#L1 "View Source") PhxGenSolid.Generator (phx\_gen\_solid v0.3.0) ================================================================================================================================================================================= [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [copy\_new\_files(context, binding, paths, files\_fn)](#copy_new_files/4) [copy\_new\_files(context, binding, paths, files\_fn, opts)](#copy_new_files/5) [paths()](#paths/0) [prompt\_for\_conflicts(context, files\_fn)](#prompt_for_conflicts/2) [prompt\_for\_conflicts(context, files\_fn, opts)](#prompt_for_conflicts/3) [raise\_with\_help(msg)](#raise_with_help/1) [web\_app\_name(context)](#web_app_name/1) [Link to this section](#functions) Functions ============================================= [Link to this function](#copy_new_files/4 "Link to this function") copy\_new\_files(context, binding, paths, files\_fn) ==================================================== [View Source](https://github.com/remoteoss/phx_gen_solid/blob/v0.3.0/lib/phx_gen_solid/generator.ex#L18 "View Source") [Link to this function](#copy_new_files/5 "Link to this function") copy\_new\_files(context, binding, paths, files\_fn, opts) ========================================================== [View Source](https://github.com/remoteoss/phx_gen_solid/blob/v0.3.0/lib/phx_gen_solid/generator.ex#L25 "View Source") [Link to this function](#paths/0 "Link to this function") paths() ======= [View Source](https://github.com/remoteoss/phx_gen_solid/blob/v0.3.0/lib/phx_gen_solid/generator.ex#L8 "View Source") [Link to this function](#prompt_for_conflicts/2 "Link to this function") prompt\_for\_conflicts(context, files\_fn) ========================================== [View Source](https://github.com/remoteoss/phx_gen_solid/blob/v0.3.0/lib/phx_gen_solid/generator.ex#L32 "View Source") [Link to this function](#prompt_for_conflicts/3 "Link to this function") prompt\_for\_conflicts(context, files\_fn, opts) ================================================ [View Source](https://github.com/remoteoss/phx_gen_solid/blob/v0.3.0/lib/phx_gen_solid/generator.ex#L38 "View Source") [Link to this function](#raise_with_help/1 "Link to this function") raise\_with\_help(msg) ====================== [View Source](https://github.com/remoteoss/phx_gen_solid/blob/v0.3.0/lib/phx_gen_solid/generator.ex#L44 "View Source") [Link to this function](#web_app_name/1 "Link to this function") web\_app\_name(context) ======================= [View Source](https://github.com/remoteoss/phx_gen_solid/blob/v0.3.0/lib/phx_gen_solid/generator.ex#L12 "View Source") mix phx.gen.solid.service β€” phx\_gen\_solid v0.3.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/remoteoss/phx_gen_solid/blob/v0.3.0/lib/mix/tasks/phx.gen.solid.service.ex#L1 "View Source") mix phx.gen.solid.service (phx\_gen\_solid v0.3.0) ============================================================================================================================================================================================= Generates C~~R~~UD Services for a resource. ``` mix phx.gen.solid.service Accounts User users ``` The first argument is the context module followed by the schema module and its plural name. This creates the following services: * `MyApp.Accounts.Service.CreateUser` * `MyApp.Accounts.Service.UpdateUser` * `MyApp.Accounts.Service.DeleteUser` For more information about the generated Services, see the [Overview](overview.html). [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [raise\_with\_help(msg)](#raise_with_help/1) [Link to this section](#functions) Functions ============================================= [Link to this function](#raise_with_help/1 "Link to this function") raise\_with\_help(msg) ====================== [View Source](https://github.com/remoteoss/phx_gen_solid/blob/v0.3.0/lib/mix/tasks/phx.gen.solid.service.ex#L54 "View Source") mix phx.gen.solid.value β€” phx\_gen\_solid v0.3.0 try { var settings = JSON.parse(localStorage.getItem('ex\_doc:settings') || '{}'); if (settings.theme === 'dark' || ((settings.theme === 'system' || settings.theme == null) && window.matchMedia('(prefers-color-scheme: dark)').matches) ) { document.body.classList.add('dark') } } catch (error) { } Settings [View Source](https://github.com/remoteoss/phx_gen_solid/blob/v0.3.0/lib/mix/tasks/phx.gen.solid.value.ex#L1 "View Source") mix phx.gen.solid.value (phx\_gen\_solid v0.3.0) ========================================================================================================================================================================================= Generates Value logic for a resource. ``` mix phx.gen.solid.value Accounts User users id name age ``` The first argument is the context module followed by the schema module and its plural name. This creates a new Value in `MyApp.Accounts.Value.User`. By default the allowed fields for this value will be the arguments you passed into the generator, in this case, `@valid_fields [:id, :slug, :name]`. **Options** * `--helpers` - This will generate the Value helpers context in `MyApp.Value`. Module name can be overridden by `--value-context`. * `--value-context MODULE` - This will be the name used for the helpers alias and/or helper modue name when generated. Defaults to `MyApp.Value`. The generated Value relies on a few helper functions also generated by this task. By default it will be placed in your projects context folder. For more information about the generated Value, see the [Overview](overview.html). [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [raise\_with\_help(msg)](#raise_with_help/1) [Link to this section](#functions) Functions ============================================= [Link to this function](#raise_with_help/1 "Link to this function") raise\_with\_help(msg) ====================== [View Source](https://github.com/remoteoss/phx_gen_solid/blob/v0.3.0/lib/mix/tasks/phx.gen.solid.value.ex#L68 "View Source")
google_api_discovery
hex
API Reference β€” google\_api\_discovery v0.12.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } API Reference google\_api\_discovery v0.12.0 ============================================== Modules ---------- [GoogleApi.Discovery.V1](GoogleApi.Discovery.V1.html) API client metadata for GoogleApi.Discovery.V1. [GoogleApi.Discovery.V1.Api.Apis](GoogleApi.Discovery.V1.Api.Apis.html) API calls for all endpoints tagged `Apis`. [GoogleApi.Discovery.V1.Connection](GoogleApi.Discovery.V1.Connection.html) Handle Tesla connections for GoogleApi.Discovery.V1. [GoogleApi.Discovery.V1.Model.DirectoryList](GoogleApi.Discovery.V1.Model.DirectoryList.html) Attributes ------------- * `discoveryVersion` (*type:* `String.t`, *default:* `v1`) - Indicate the version of the Discovery API used to generate this doc. * `items` (*type:* `list(GoogleApi.Discovery.V1.Model.DirectoryListItems.t)`, *default:* `nil`) - The individual directory entries. One entry per api/version pair. * `kind` (*type:* `String.t`, *default:* `discovery#directoryList`) - The kind for this response. [GoogleApi.Discovery.V1.Model.DirectoryListItems](GoogleApi.Discovery.V1.Model.DirectoryListItems.html) Attributes ------------- * `description` (*type:* `String.t`, *default:* `nil`) - The description of this API. * `discoveryLink` (*type:* `String.t`, *default:* `nil`) - A link to the discovery document. * `discoveryRestUrl` (*type:* `String.t`, *default:* `nil`) - The URL for the discovery REST document. * `documentationLink` (*type:* `String.t`, *default:* `nil`) - A link to human readable documentation for the API. * `icons` (*type:* `GoogleApi.Discovery.V1.Model.DirectoryListItemsIcons.t`, *default:* `nil`) - Links to 16x16 and 32x32 icons representing the API. * `id` (*type:* `String.t`, *default:* `nil`) - The id of this API. * `kind` (*type:* `String.t`, *default:* `discovery#directoryItem`) - The kind for this response. * `labels` (*type:* `list(String.t)`, *default:* `nil`) - Labels for the status of this API, such as labs or deprecated. * `name` (*type:* `String.t`, *default:* `nil`) - The name of the API. * `preferred` (*type:* `boolean()`, *default:* `nil`) - True if this version is the preferred version to use. * `title` (*type:* `String.t`, *default:* `nil`) - The title of this API. * `version` (*type:* `String.t`, *default:* `nil`) - The version of the API. [GoogleApi.Discovery.V1.Model.DirectoryListItemsIcons](GoogleApi.Discovery.V1.Model.DirectoryListItemsIcons.html) Links to 16x16 and 32x32 icons representing the API. [GoogleApi.Discovery.V1.Model.JsonSchema](GoogleApi.Discovery.V1.Model.JsonSchema.html) Attributes ------------- * `$ref` (*type:* `String.t`, *default:* `nil`) - A reference to another schema. The value of this property is the "id" of another schema. * `additionalProperties` (*type:* `GoogleApi.Discovery.V1.Model.JsonSchema.t`, *default:* `nil`) - If this is a schema for an object, this property is the schema for any additional properties with dynamic keys on this object. * `annotations` (*type:* `GoogleApi.Discovery.V1.Model.JsonSchemaAnnotations.t`, *default:* `nil`) - Additional information about this property. * `default` (*type:* `String.t`, *default:* `nil`) - The default value of this property (if one exists). * `description` (*type:* `String.t`, *default:* `nil`) - A description of this object. * `enum` (*type:* `list(String.t)`, *default:* `nil`) - Values this parameter may take (if it is an enum). * `enumDescriptions` (*type:* `list(String.t)`, *default:* `nil`) - The descriptions for the enums. Each position maps to the corresponding value in the "enum" array. * `format` (*type:* `String.t`, *default:* `nil`) - An additional regular expression or key that helps constrain the value. For more details see: <http://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.23> * `id` (*type:* `String.t`, *default:* `nil`) - Unique identifier for this schema. * `items` (*type:* `GoogleApi.Discovery.V1.Model.JsonSchema.t`, *default:* `nil`) - If this is a schema for an array, this property is the schema for each element in the array. * `location` (*type:* `String.t`, *default:* `nil`) - Whether this parameter goes in the query or the path for REST requests. * `maximum` (*type:* `String.t`, *default:* `nil`) - The maximum value of this parameter. * `minimum` (*type:* `String.t`, *default:* `nil`) - The minimum value of this parameter. * `pattern` (*type:* `String.t`, *default:* `nil`) - The regular expression this parameter must conform to. Uses Java 6 regex format: <http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html> * `properties` (*type:* `%{optional(String.t) => GoogleApi.Discovery.V1.Model.JsonSchema.t}`, *default:* `nil`) - If this is a schema for an object, list the schema for each property of this object. * `readOnly` (*type:* `boolean()`, *default:* `nil`) - The value is read-only, generated by the service. The value cannot be modified by the client. If the value is included in a POST, PUT, or PATCH request, it is ignored by the service. * `repeated` (*type:* `boolean()`, *default:* `nil`) - Whether this parameter may appear multiple times. * `required` (*type:* `boolean()`, *default:* `nil`) - Whether the parameter is required. * `type` (*type:* `String.t`, *default:* `nil`) - The value type for this schema. A list of values can be found here: <http://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1> * `variant` (*type:* `GoogleApi.Discovery.V1.Model.JsonSchemaVariant.t`, *default:* `nil`) - In a variant data type, the value of one property is used to determine how to interpret the entire entity. Its value must exist in a map of descriminant values to schema names. [GoogleApi.Discovery.V1.Model.JsonSchemaAnnotations](GoogleApi.Discovery.V1.Model.JsonSchemaAnnotations.html) Additional information about this property. [GoogleApi.Discovery.V1.Model.JsonSchemaVariant](GoogleApi.Discovery.V1.Model.JsonSchemaVariant.html) In a variant data type, the value of one property is used to determine how to interpret the entire entity. Its value must exist in a map of descriminant values to schema names. [GoogleApi.Discovery.V1.Model.JsonSchemaVariantMap](GoogleApi.Discovery.V1.Model.JsonSchemaVariantMap.html) Attributes ------------- * `$ref` (*type:* `String.t`, *default:* `nil`) - * `type_value` (*type:* `String.t`, *default:* `nil`) - [GoogleApi.Discovery.V1.Model.RestDescription](GoogleApi.Discovery.V1.Model.RestDescription.html) Attributes ------------- * `auth` (*type:* `GoogleApi.Discovery.V1.Model.RestDescriptionAuth.t`, *default:* `nil`) - Authentication information. * `basePath` (*type:* `String.t`, *default:* `nil`) - [DEPRECATED] The base path for REST requests. * `baseUrl` (*type:* `String.t`, *default:* `nil`) - [DEPRECATED] The base URL for REST requests. * `batchPath` (*type:* `String.t`, *default:* `nil`) - The path for REST batch requests. * `canonicalName` (*type:* `String.t`, *default:* `nil`) - Indicates how the API name should be capitalized and split into various parts. Useful for generating pretty class names. * `description` (*type:* `String.t`, *default:* `nil`) - The description of this API. * `discoveryVersion` (*type:* `String.t`, *default:* `v1`) - Indicate the version of the Discovery API used to generate this doc. * `documentationLink` (*type:* `String.t`, *default:* `nil`) - A link to human readable documentation for the API. * `etag` (*type:* `String.t`, *default:* `nil`) - The ETag for this response. * `exponentialBackoffDefault` (*type:* `boolean()`, *default:* `nil`) - Enable exponential backoff for suitable methods in the generated clients. * `features` (*type:* `list(String.t)`, *default:* `nil`) - A list of supported features for this API. * `icons` (*type:* `GoogleApi.Discovery.V1.Model.RestDescriptionIcons.t`, *default:* `nil`) - Links to 16x16 and 32x32 icons representing the API. * `id` (*type:* `String.t`, *default:* `nil`) - The ID of this API. * `kind` (*type:* `String.t`, *default:* `discovery#restDescription`) - The kind for this response. * `labels` (*type:* `list(String.t)`, *default:* `nil`) - Labels for the status of this API, such as labs or deprecated. * `methods` (*type:* `%{optional(String.t) => GoogleApi.Discovery.V1.Model.RestMethod.t}`, *default:* `nil`) - API-level methods for this API. * `name` (*type:* `String.t`, *default:* `nil`) - The name of this API. * `ownerDomain` (*type:* `String.t`, *default:* `nil`) - The domain of the owner of this API. Together with the ownerName and a packagePath values, this can be used to generate a library for this API which would have a unique fully qualified name. * `ownerName` (*type:* `String.t`, *default:* `nil`) - The name of the owner of this API. See ownerDomain. * `packagePath` (*type:* `String.t`, *default:* `nil`) - The package of the owner of this API. See ownerDomain. * `parameters` (*type:* `%{optional(String.t) => GoogleApi.Discovery.V1.Model.JsonSchema.t}`, *default:* `nil`) - Common parameters that apply across all apis. * `protocol` (*type:* `String.t`, *default:* `rest`) - The protocol described by this document. * `resources` (*type:* `%{optional(String.t) => GoogleApi.Discovery.V1.Model.RestResource.t}`, *default:* `nil`) - The resources in this API. * `revision` (*type:* `String.t`, *default:* `nil`) - The version of this API. * `rootUrl` (*type:* `String.t`, *default:* `nil`) - The root URL under which all API services live. * `schemas` (*type:* `%{optional(String.t) => GoogleApi.Discovery.V1.Model.JsonSchema.t}`, *default:* `nil`) - The schemas for this API. * `servicePath` (*type:* `String.t`, *default:* `nil`) - The base path for all REST requests. * `title` (*type:* `String.t`, *default:* `nil`) - The title of this API. * `version` (*type:* `String.t`, *default:* `nil`) - The version of this API. * `version_module` (*type:* `boolean()`, *default:* `nil`) - [GoogleApi.Discovery.V1.Model.RestDescriptionAuth](GoogleApi.Discovery.V1.Model.RestDescriptionAuth.html) Authentication information. [GoogleApi.Discovery.V1.Model.RestDescriptionAuthOauth2](GoogleApi.Discovery.V1.Model.RestDescriptionAuthOauth2.html) OAuth 2.0 authentication information. [GoogleApi.Discovery.V1.Model.RestDescriptionIcons](GoogleApi.Discovery.V1.Model.RestDescriptionIcons.html) Links to 16x16 and 32x32 icons representing the API. [GoogleApi.Discovery.V1.Model.RestMethod](GoogleApi.Discovery.V1.Model.RestMethod.html) Attributes ------------- * `description` (*type:* `String.t`, *default:* `nil`) - Description of this method. * `etagRequired` (*type:* `boolean()`, *default:* `nil`) - Whether this method requires an ETag to be specified. The ETag is sent as an HTTP If-Match or If-None-Match header. * `flatPath` (*type:* `String.t`, *default:* `nil`) - The URI path of this REST method in (RFC 6570) format without level 2 features ({+var}). Supplementary to the path property. * `httpMethod` (*type:* `String.t`, *default:* `nil`) - HTTP method used by this method. * `id` (*type:* `String.t`, *default:* `nil`) - A unique ID for this method. This property can be used to match methods between different versions of Discovery. * `mediaUpload` (*type:* `GoogleApi.Discovery.V1.Model.RestMethodMediaUpload.t`, *default:* `nil`) - Media upload parameters. * `parameterOrder` (*type:* `list(String.t)`, *default:* `nil`) - Ordered list of required parameters, serves as a hint to clients on how to structure their method signatures. The array is ordered such that the "most-significant" parameter appears first. * `parameters` (*type:* `%{optional(String.t) => GoogleApi.Discovery.V1.Model.JsonSchema.t}`, *default:* `nil`) - Details for all parameters in this method. * `path` (*type:* `String.t`, *default:* `nil`) - The URI path of this REST method. Should be used in conjunction with the basePath property at the api-level. * `request` (*type:* `GoogleApi.Discovery.V1.Model.RestMethodRequest.t`, *default:* `nil`) - The schema for the request. * `response` (*type:* `GoogleApi.Discovery.V1.Model.RestMethodResponse.t`, *default:* `nil`) - The schema for the response. * `scopes` (*type:* `list(String.t)`, *default:* `nil`) - OAuth 2.0 scopes applicable to this method. * `supportsMediaDownload` (*type:* `boolean()`, *default:* `nil`) - Whether this method supports media downloads. * `supportsMediaUpload` (*type:* `boolean()`, *default:* `nil`) - Whether this method supports media uploads. * `supportsSubscription` (*type:* `boolean()`, *default:* `nil`) - Whether this method supports subscriptions. * `useMediaDownloadService` (*type:* `boolean()`, *default:* `nil`) - Indicates that downloads from this method should use the download service URL (i.e. "/download"). Only applies if the method supports media download. [GoogleApi.Discovery.V1.Model.RestMethodMediaUpload](GoogleApi.Discovery.V1.Model.RestMethodMediaUpload.html) Media upload parameters. [GoogleApi.Discovery.V1.Model.RestMethodMediaUploadProtocols](GoogleApi.Discovery.V1.Model.RestMethodMediaUploadProtocols.html) Supported upload protocols. [GoogleApi.Discovery.V1.Model.RestMethodMediaUploadProtocolsResumable](GoogleApi.Discovery.V1.Model.RestMethodMediaUploadProtocolsResumable.html) Supports the Resumable Media Upload protocol. [GoogleApi.Discovery.V1.Model.RestMethodMediaUploadProtocolsSimple](GoogleApi.Discovery.V1.Model.RestMethodMediaUploadProtocolsSimple.html) Supports uploading as a single HTTP request. [GoogleApi.Discovery.V1.Model.RestMethodRequest](GoogleApi.Discovery.V1.Model.RestMethodRequest.html) The schema for the request. [GoogleApi.Discovery.V1.Model.RestMethodResponse](GoogleApi.Discovery.V1.Model.RestMethodResponse.html) The schema for the response. [GoogleApi.Discovery.V1.Model.RestResource](GoogleApi.Discovery.V1.Model.RestResource.html) Attributes ------------- * `methods` (*type:* `%{optional(String.t) => GoogleApi.Discovery.V1.Model.RestMethod.t}`, *default:* `nil`) - Methods on this resource. * `resources` (*type:* `%{optional(String.t) => GoogleApi.Discovery.V1.Model.RestResource.t}`, *default:* `nil`) - Sub-resources on this resource. GoogleApi.Discovery.V1 β€” google\_api\_discovery v0.12.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } GoogleApi.Discovery.V1 (google\_api\_discovery v0.12.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/metadata.ex#L18 "View Source") ============================================================================================================================================================================================================================ API client metadata for GoogleApi.Discovery.V1. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [discovery\_revision()](#discovery_revision/0) [Link to this section](#functions) Functions ============================================= [Link to this function](#discovery_revision/0 "Link to this function") discovery\_revision() ===================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/metadata.ex#L25 "View Source") GoogleApi.Discovery.V1.Api.Apis β€” google\_api\_discovery v0.12.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } GoogleApi.Discovery.V1.Api.Apis (google\_api\_discovery v0.12.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/api/apis.ex#L18 "View Source") ===================================================================================================================================================================================================================================== API calls for all endpoints tagged `Apis`. [Link to this section](#summary) Summary ========================================== [Functions](#functions) ------------------------ [discovery\_apis\_get\_rest(connection, api, version, optional\_params \\ [], opts \\ [])](#discovery_apis_get_rest/5) Retrieve the description of a particular version of an api. [discovery\_apis\_list(connection, optional\_params \\ [], opts \\ [])](#discovery_apis_list/3) Retrieve the list of APIs supported at this endpoint. [Link to this section](#functions) Functions ============================================= [Link to this function](#discovery_apis_get_rest/5 "Link to this function") discovery\_apis\_get\_rest(connection, api, version, optional\_params \\ [], opts \\ []) ======================================================================================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/api/apis.ex#L56 "View Source") Specs ----- ``` discovery_apis_get_rest( [Tesla.Env.client](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:client/0)(), [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ) :: {:ok, [GoogleApi.Discovery.V1.Model.RestDescription.t](GoogleApi.Discovery.V1.Model.RestDescription.html#t:t/0)()} | {:ok, [Tesla.Env.t](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:t/0)()} | {:ok, [list](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | {:error, [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` Retrieve the description of a particular version of an api. Parameters ------------- * `connection` (*type:* `GoogleApi.Discovery.V1.Connection.t`) - Connection to server * `api` (*type:* `String.t`) - The name of the API. * `version` (*type:* `String.t`) - The version of the API. * `optional_params` (*type:* `keyword()`) - Optional parameters + `:alt` (*type:* `String.t`) - Data format for the response. + `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response. + `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user. + `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks. + `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead. * `opts` (*type:* `keyword()`) - Call options Returns ---------- * `{:ok, %GoogleApi.Discovery.V1.Model.RestDescription{}}` on success * `{:error, info}` on failure [Link to this function](#discovery_apis_list/3 "Link to this function") discovery\_apis\_list(connection, optional\_params \\ [], opts \\ []) ===================================================================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/api/apis.ex#L110 "View Source") Specs ----- ``` discovery_apis_list([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:client/0)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: {:ok, [GoogleApi.Discovery.V1.Model.DirectoryList.t](GoogleApi.Discovery.V1.Model.DirectoryList.html#t:t/0)()} | {:ok, [Tesla.Env.t](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:t/0)()} | {:ok, [list](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()} | {:error, [any](https://hexdocs.pm/elixir/typespecs.html#basic-types)()} ``` Retrieve the list of APIs supported at this endpoint. Parameters ------------- * `connection` (*type:* `GoogleApi.Discovery.V1.Connection.t`) - Connection to server * `optional_params` (*type:* `keyword()`) - Optional parameters + `:alt` (*type:* `String.t`) - Data format for the response. + `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response. + `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user. + `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks. + `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters. + `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead. + `:name` (*type:* `String.t`) - Only include APIs with the given name. + `:preferred` (*type:* `boolean()`) - Return only the preferred version of an API. * `opts` (*type:* `keyword()`) - Call options Returns ---------- * `{:ok, %GoogleApi.Discovery.V1.Model.DirectoryList{}}` on success * `{:error, info}` on failure GoogleApi.Discovery.V1.Connection β€” google\_api\_discovery v0.12.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } GoogleApi.Discovery.V1.Connection (google\_api\_discovery v0.12.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/connection.ex#L18 "View Source") ========================================================================================================================================================================================================================================= Handle Tesla connections for GoogleApi.Discovery.V1. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [option()](#t:option/0) Options that may be passed to a request function. See [`request/2`](#request/2) for detailed descriptions. [t()](#t:t/0) [Functions](#functions) ------------------------ [delete(client, url, opts)](#delete/3) Perform a DELETE request. [delete!(client, url, opts)](#delete!/3) Perform a DELETE request. [execute(connection, request)](#execute/2) Execute a request on this connection [get(client, url, opts)](#get/3) Perform a GET request. [get!(client, url, opts)](#get!/3) Perform a GET request. [head(client, url, opts)](#head/3) Perform a HEAD request. [head!(client, url, opts)](#head!/3) Perform a HEAD request. [new()](#new/0) Configure an authless client connection [new(token)](#new/1) Configure a client connection using a function which yields a Bearer token. [options(client, url, opts)](#options/3) Perform a OPTIONS request. [options!(client, url, opts)](#options!/3) Perform a OPTIONS request. [patch(client, url, body, opts)](#patch/4) Perform a PATCH request. [patch!(client, url, body, opts)](#patch!/4) Perform a PATCH request. [post(client, url, body, opts)](#post/4) Perform a POST request. [post!(client, url, body, opts)](#post!/4) Perform a POST request. [put(client, url, body, opts)](#put/4) Perform a PUT request. [put!(client, url, body, opts)](#put!/4) Perform a PUT request. [request(client \\ %Tesla.Client{}, options)](#request/2) Perform a request. [request!(client \\ %Tesla.Client{}, options)](#request!/2) Perform request and raise in case of error. [trace(client, url, opts)](#trace/3) Perform a TRACE request. [trace!(client, url, opts)](#trace!/3) Perform a TRACE request. [Link to this section](#types) Types ===================================== [Link to this type](#t:option/0 "Link to this type") option() ======== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/connection.ex#L25 "View Source") Specs ----- ``` option() :: {:method, [Tesla.Env.method](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:method/0)()} | {:url, [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:url/0)()} | {:query, [Tesla.Env.query](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:query/0)()} | {:headers, [Tesla.Env.headers](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:headers/0)()} | {:body, [Tesla.Env.body](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:body/0)()} | {:opts, [Tesla.Env.opts](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:opts/0)()} ``` Options that may be passed to a request function. See [`request/2`](#request/2) for detailed descriptions. [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/connection.ex#L23 "View Source") Specs ----- ``` t() :: [Tesla.Env.client](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:client/0)() ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#delete/3 "Link to this function") delete(client, url, opts) ========================= [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/connection.ex#L25 "View Source") Specs ----- ``` delete([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:url/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.result](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:result/0)() ``` Perform a DELETE request. See [`request/1`](#request/1) or [`request/2`](#request/2) for options definition. ``` delete("/users") delete("/users", query: [scope: "admin"]) delete(client, "/users") delete(client, "/users", query: [scope: "admin"]) delete(client, "/users", body: %{name: "Jon"}) ``` [Link to this function](#delete!/3 "Link to this function") delete!(client, url, opts) ========================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/connection.ex#L25 "View Source") Specs ----- ``` delete!([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:url/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.t](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:t/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Perform a DELETE request. See [`request!/1`](#request!/1) or [`request!/2`](#request!/2) for options definition. ``` delete!("/users") delete!("/users", query: [scope: "admin"]) delete!(client, "/users") delete!(client, "/users", query: [scope: "admin"]) delete!(client, "/users", body: %{name: "Jon"}) ``` [Link to this function](#execute/2 "Link to this function") execute(connection, request) ============================ [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/connection.ex#L25 "View Source") Specs ----- ``` execute([Tesla.Client.t](https://hexdocs.pm/tesla/1.4.1/Tesla.Client.html#t:t/0)(), [GoogleApi.Gax.Request.t](https://hexdocs.pm/google_gax/0.4.0/GoogleApi.Gax.Request.html#t:t/0)()) :: {:ok, [Tesla.Env.t](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:t/0)()} ``` Execute a request on this connection Returns ---------- * `{:ok, Tesla.Env.t}` - If the call was successful * `{:error, reason}` - If the call failed [Link to this function](#get/3 "Link to this function") get(client, url, opts) ====================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/connection.ex#L25 "View Source") Specs ----- ``` get([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:url/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.result](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:result/0)() ``` Perform a GET request. See [`request/1`](#request/1) or [`request/2`](#request/2) for options definition. ``` get("/users") get("/users", query: [scope: "admin"]) get(client, "/users") get(client, "/users", query: [scope: "admin"]) get(client, "/users", body: %{name: "Jon"}) ``` [Link to this function](#get!/3 "Link to this function") get!(client, url, opts) ======================= [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/connection.ex#L25 "View Source") Specs ----- ``` get!([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:url/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.t](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:t/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Perform a GET request. See [`request!/1`](#request!/1) or [`request!/2`](#request!/2) for options definition. ``` get!("/users") get!("/users", query: [scope: "admin"]) get!(client, "/users") get!(client, "/users", query: [scope: "admin"]) get!(client, "/users", body: %{name: "Jon"}) ``` [Link to this function](#head/3 "Link to this function") head(client, url, opts) ======================= [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/connection.ex#L25 "View Source") Specs ----- ``` head([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:url/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.result](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:result/0)() ``` Perform a HEAD request. See [`request/1`](#request/1) or [`request/2`](#request/2) for options definition. ``` head("/users") head("/users", query: [scope: "admin"]) head(client, "/users") head(client, "/users", query: [scope: "admin"]) head(client, "/users", body: %{name: "Jon"}) ``` [Link to this function](#head!/3 "Link to this function") head!(client, url, opts) ======================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/connection.ex#L25 "View Source") Specs ----- ``` head!([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:url/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.t](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:t/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Perform a HEAD request. See [`request!/1`](#request!/1) or [`request!/2`](#request!/2) for options definition. ``` head!("/users") head!("/users", query: [scope: "admin"]) head!(client, "/users") head!(client, "/users", query: [scope: "admin"]) head!(client, "/users", body: %{name: "Jon"}) ``` [Link to this function](#new/0 "Link to this function") new() ===== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/connection.ex#L25 "View Source") Specs ----- ``` new() :: [Tesla.Client.t](https://hexdocs.pm/tesla/1.4.1/Tesla.Client.html#t:t/0)() ``` Configure an authless client connection Returns ---------- * `Tesla.Env.client` [Link to this function](#new/1 "Link to this function") new(token) ========== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/connection.ex#L25 "View Source") Specs ----- ``` new([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) :: [Tesla.Client.t](https://hexdocs.pm/tesla/1.4.1/Tesla.Client.html#t:t/0)() ``` ``` new(([[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] -> [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)())) :: [Tesla.Client.t](https://hexdocs.pm/tesla/1.4.1/Tesla.Client.html#t:t/0)() ``` Configure a client connection using a function which yields a Bearer token. Parameters ------------- * `token_fetcher` (*type:* `list(String.t()) -> String.t()`) - Callback which provides an OAuth2 token given a list of scopes Returns ---------- * `Tesla.Env.client` [Link to this function](#options/3 "Link to this function") options(client, url, opts) ========================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/connection.ex#L25 "View Source") Specs ----- ``` options([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:url/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.result](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:result/0)() ``` Perform a OPTIONS request. See [`request/1`](#request/1) or [`request/2`](#request/2) for options definition. ``` options("/users") options("/users", query: [scope: "admin"]) options(client, "/users") options(client, "/users", query: [scope: "admin"]) options(client, "/users", body: %{name: "Jon"}) ``` [Link to this function](#options!/3 "Link to this function") options!(client, url, opts) =========================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/connection.ex#L25 "View Source") Specs ----- ``` options!([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:url/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.t](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:t/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Perform a OPTIONS request. See [`request!/1`](#request!/1) or [`request!/2`](#request!/2) for options definition. ``` options!("/users") options!("/users", query: [scope: "admin"]) options!(client, "/users") options!(client, "/users", query: [scope: "admin"]) options!(client, "/users", body: %{name: "Jon"}) ``` [Link to this function](#patch/4 "Link to this function") patch(client, url, body, opts) ============================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/connection.ex#L25 "View Source") Specs ----- ``` patch([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:url/0)(), [Tesla.Env.body](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:body/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.result](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:result/0)() ``` Perform a PATCH request. See [`request/1`](#request/1) or [`request/2`](#request/2) for options definition. ``` patch("/users", %{name: "Jon"}) patch("/users", %{name: "Jon"}, query: [scope: "admin"]) patch(client, "/users", %{name: "Jon"}) patch(client, "/users", %{name: "Jon"}, query: [scope: "admin"]) ``` [Link to this function](#patch!/4 "Link to this function") patch!(client, url, body, opts) =============================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/connection.ex#L25 "View Source") Specs ----- ``` patch!([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:url/0)(), [Tesla.Env.body](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:body/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.t](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:t/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Perform a PATCH request. See [`request!/1`](#request!/1) or [`request!/2`](#request!/2) for options definition. ``` patch!("/users", %{name: "Jon"}) patch!("/users", %{name: "Jon"}, query: [scope: "admin"]) patch!(client, "/users", %{name: "Jon"}) patch!(client, "/users", %{name: "Jon"}, query: [scope: "admin"]) ``` [Link to this function](#post/4 "Link to this function") post(client, url, body, opts) ============================= [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/connection.ex#L25 "View Source") Specs ----- ``` post([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:url/0)(), [Tesla.Env.body](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:body/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.result](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:result/0)() ``` Perform a POST request. See [`request/1`](#request/1) or [`request/2`](#request/2) for options definition. ``` post("/users", %{name: "Jon"}) post("/users", %{name: "Jon"}, query: [scope: "admin"]) post(client, "/users", %{name: "Jon"}) post(client, "/users", %{name: "Jon"}, query: [scope: "admin"]) ``` [Link to this function](#post!/4 "Link to this function") post!(client, url, body, opts) ============================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/connection.ex#L25 "View Source") Specs ----- ``` post!([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:url/0)(), [Tesla.Env.body](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:body/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.t](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:t/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Perform a POST request. See [`request!/1`](#request!/1) or [`request!/2`](#request!/2) for options definition. ``` post!("/users", %{name: "Jon"}) post!("/users", %{name: "Jon"}, query: [scope: "admin"]) post!(client, "/users", %{name: "Jon"}) post!(client, "/users", %{name: "Jon"}, query: [scope: "admin"]) ``` [Link to this function](#put/4 "Link to this function") put(client, url, body, opts) ============================ [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/connection.ex#L25 "View Source") Specs ----- ``` put([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:url/0)(), [Tesla.Env.body](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:body/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.result](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:result/0)() ``` Perform a PUT request. See [`request/1`](#request/1) or [`request/2`](#request/2) for options definition. ``` put("/users", %{name: "Jon"}) put("/users", %{name: "Jon"}, query: [scope: "admin"]) put(client, "/users", %{name: "Jon"}) put(client, "/users", %{name: "Jon"}, query: [scope: "admin"]) ``` [Link to this function](#put!/4 "Link to this function") put!(client, url, body, opts) ============================= [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/connection.ex#L25 "View Source") Specs ----- ``` put!([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:url/0)(), [Tesla.Env.body](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:body/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.t](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:t/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Perform a PUT request. See [`request!/1`](#request!/1) or [`request!/2`](#request!/2) for options definition. ``` put!("/users", %{name: "Jon"}) put!("/users", %{name: "Jon"}, query: [scope: "admin"]) put!(client, "/users", %{name: "Jon"}) put!(client, "/users", %{name: "Jon"}, query: [scope: "admin"]) ``` [Link to this function](#request/2 "Link to this function") request(client \\ %Tesla.Client{}, options) =========================================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/connection.ex#L25 "View Source") Specs ----- ``` request([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:client/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.result](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:result/0)() ``` Perform a request. Options ---------- * `:method` - the request method, one of [`:head`, `:get`, `:delete`, `:trace`, `:options`, `:post`, `:put`, `:patch`] * `:url` - either full url e.g. "[http://example.com/some/path"](http://example.com/some/path%22) or just "/some/path" if using [`Tesla.Middleware.BaseUrl`](https://hexdocs.pm/tesla/1.4.1/Tesla.Middleware.BaseUrl.html) * `:query` - a keyword list of query params, e.g. `[page: 1, per_page: 100]` * `:headers` - a keyworld list of headers, e.g. `[{"content-type", "text/plain"}]` * `:body` - depends on used middleware: + by default it can be a binary + if using e.g. JSON encoding middleware it can be a nested map + if adapter supports it it can be a Stream with any of the above * `:opts` - custom, per-request middleware or adapter options Examples ----------- ``` ExampleApi.request(method: :get, url: "/users/path") # use shortcut methods ExampleApi.get("/users/1") ExampleApi.post(client, "/users", %{name: "Jon"}) ``` [Link to this function](#request!/2 "Link to this function") request!(client \\ %Tesla.Client{}, options) ============================================ [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/connection.ex#L25 "View Source") Specs ----- ``` request!([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:client/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.t](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:t/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Perform request and raise in case of error. This is similar to [`request/2`](#request/2) behaviour from Tesla 0.x See [`request/2`](#request/2) for list of available options. [Link to this function](#trace/3 "Link to this function") trace(client, url, opts) ======================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/connection.ex#L25 "View Source") Specs ----- ``` trace([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:url/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.result](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:result/0)() ``` Perform a TRACE request. See [`request/1`](#request/1) or [`request/2`](#request/2) for options definition. ``` trace("/users") trace("/users", query: [scope: "admin"]) trace(client, "/users") trace(client, "/users", query: [scope: "admin"]) trace(client, "/users", body: %{name: "Jon"}) ``` [Link to this function](#trace!/3 "Link to this function") trace!(client, url, opts) ========================= [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/connection.ex#L25 "View Source") Specs ----- ``` trace!([Tesla.Env.client](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:client/0)(), [Tesla.Env.url](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:url/0)(), [[option](#t:option/0)()]) :: [Tesla.Env.t](https://hexdocs.pm/tesla/1.4.1/Tesla.Env.html#t:t/0)() | [no\_return](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() ``` Perform a TRACE request. See [`request!/1`](#request!/1) or [`request!/2`](#request!/2) for options definition. ``` trace!("/users") trace!("/users", query: [scope: "admin"]) trace!(client, "/users") trace!(client, "/users", query: [scope: "admin"]) trace!(client, "/users", body: %{name: "Jon"}) ``` GoogleApi.Discovery.V1.Model.DirectoryList β€” google\_api\_discovery v0.12.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } GoogleApi.Discovery.V1.Model.DirectoryList (google\_api\_discovery v0.12.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/directory_list.ex#L18 "View Source") ============================================================================================================================================================================================================================================================ Attributes ------------- * `discoveryVersion` (*type:* `String.t`, *default:* `v1`) - Indicate the version of the Discovery API used to generate this doc. * `items` (*type:* `list(GoogleApi.Discovery.V1.Model.DirectoryListItems.t)`, *default:* `nil`) - The individual directory entries. One entry per api/version pair. * `kind` (*type:* `String.t`, *default:* `discovery#directoryList`) - The kind for this response. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [decode(value, options)](#decode/2) Unwrap a decoded JSON object into its complex fields. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/directory_list.ex#L31 "View Source") Specs ----- ``` t() :: %GoogleApi.Discovery.V1.Model.DirectoryList{ discoveryVersion: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, items: [[GoogleApi.Discovery.V1.Model.DirectoryListItems.t](GoogleApi.Discovery.V1.Model.DirectoryListItems.html#t:t/0)()] | nil, kind: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#decode/2 "Link to this function") decode(value, options) ====================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/directory_list.ex#L18 "View Source") Specs ----- ``` decode([struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Unwrap a decoded JSON object into its complex fields. GoogleApi.Discovery.V1.Model.DirectoryListItems β€” google\_api\_discovery v0.12.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } GoogleApi.Discovery.V1.Model.DirectoryListItems (google\_api\_discovery v0.12.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/directory_list_items.ex#L18 "View Source") ======================================================================================================================================================================================================================================================================= Attributes ------------- * `description` (*type:* `String.t`, *default:* `nil`) - The description of this API. * `discoveryLink` (*type:* `String.t`, *default:* `nil`) - A link to the discovery document. * `discoveryRestUrl` (*type:* `String.t`, *default:* `nil`) - The URL for the discovery REST document. * `documentationLink` (*type:* `String.t`, *default:* `nil`) - A link to human readable documentation for the API. * `icons` (*type:* `GoogleApi.Discovery.V1.Model.DirectoryListItemsIcons.t`, *default:* `nil`) - Links to 16x16 and 32x32 icons representing the API. * `id` (*type:* `String.t`, *default:* `nil`) - The id of this API. * `kind` (*type:* `String.t`, *default:* `discovery#directoryItem`) - The kind for this response. * `labels` (*type:* `list(String.t)`, *default:* `nil`) - Labels for the status of this API, such as labs or deprecated. * `name` (*type:* `String.t`, *default:* `nil`) - The name of the API. * `preferred` (*type:* `boolean()`, *default:* `nil`) - True if this version is the preferred version to use. * `title` (*type:* `String.t`, *default:* `nil`) - The title of this API. * `version` (*type:* `String.t`, *default:* `nil`) - The version of the API. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [decode(value, options)](#decode/2) Unwrap a decoded JSON object into its complex fields. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/directory_list_items.ex#L40 "View Source") Specs ----- ``` t() :: %GoogleApi.Discovery.V1.Model.DirectoryListItems{ description: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, discoveryLink: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, discoveryRestUrl: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, documentationLink: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, icons: [GoogleApi.Discovery.V1.Model.DirectoryListItemsIcons.t](GoogleApi.Discovery.V1.Model.DirectoryListItemsIcons.html#t:t/0)() | nil, id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, kind: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, labels: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil, name: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, preferred: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, title: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, version: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#decode/2 "Link to this function") decode(value, options) ====================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/directory_list_items.ex#L18 "View Source") Specs ----- ``` decode([struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Unwrap a decoded JSON object into its complex fields. GoogleApi.Discovery.V1.Model.DirectoryListItemsIcons β€” google\_api\_discovery v0.12.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } GoogleApi.Discovery.V1.Model.DirectoryListItemsIcons (google\_api\_discovery v0.12.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/directory_list_items_icons.ex#L18 "View Source") ================================================================================================================================================================================================================================================================================== Links to 16x16 and 32x32 icons representing the API. Attributes ------------- * `x16` (*type:* `String.t`, *default:* `nil`) - The URL of the 16x16 icon. * `x32` (*type:* `String.t`, *default:* `nil`) - The URL of the 32x32 icon. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [decode(value, options)](#decode/2) Unwrap a decoded JSON object into its complex fields. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/directory_list_items_icons.ex#L30 "View Source") Specs ----- ``` t() :: %GoogleApi.Discovery.V1.Model.DirectoryListItemsIcons{ x16: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, x32: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#decode/2 "Link to this function") decode(value, options) ====================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/directory_list_items_icons.ex#L18 "View Source") Specs ----- ``` decode([struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Unwrap a decoded JSON object into its complex fields. GoogleApi.Discovery.V1.Model.JsonSchema β€” google\_api\_discovery v0.12.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } GoogleApi.Discovery.V1.Model.JsonSchema (google\_api\_discovery v0.12.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/json_schema.ex#L18 "View Source") ====================================================================================================================================================================================================================================================== Attributes ------------- * `$ref` (*type:* `String.t`, *default:* `nil`) - A reference to another schema. The value of this property is the "id" of another schema. * `additionalProperties` (*type:* `GoogleApi.Discovery.V1.Model.JsonSchema.t`, *default:* `nil`) - If this is a schema for an object, this property is the schema for any additional properties with dynamic keys on this object. * `annotations` (*type:* `GoogleApi.Discovery.V1.Model.JsonSchemaAnnotations.t`, *default:* `nil`) - Additional information about this property. * `default` (*type:* `String.t`, *default:* `nil`) - The default value of this property (if one exists). * `description` (*type:* `String.t`, *default:* `nil`) - A description of this object. * `enum` (*type:* `list(String.t)`, *default:* `nil`) - Values this parameter may take (if it is an enum). * `enumDescriptions` (*type:* `list(String.t)`, *default:* `nil`) - The descriptions for the enums. Each position maps to the corresponding value in the "enum" array. * `format` (*type:* `String.t`, *default:* `nil`) - An additional regular expression or key that helps constrain the value. For more details see: <http://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.23> * `id` (*type:* `String.t`, *default:* `nil`) - Unique identifier for this schema. * `items` (*type:* `GoogleApi.Discovery.V1.Model.JsonSchema.t`, *default:* `nil`) - If this is a schema for an array, this property is the schema for each element in the array. * `location` (*type:* `String.t`, *default:* `nil`) - Whether this parameter goes in the query or the path for REST requests. * `maximum` (*type:* `String.t`, *default:* `nil`) - The maximum value of this parameter. * `minimum` (*type:* `String.t`, *default:* `nil`) - The minimum value of this parameter. * `pattern` (*type:* `String.t`, *default:* `nil`) - The regular expression this parameter must conform to. Uses Java 6 regex format: <http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html> * `properties` (*type:* `%{optional(String.t) => GoogleApi.Discovery.V1.Model.JsonSchema.t}`, *default:* `nil`) - If this is a schema for an object, list the schema for each property of this object. * `readOnly` (*type:* `boolean()`, *default:* `nil`) - The value is read-only, generated by the service. The value cannot be modified by the client. If the value is included in a POST, PUT, or PATCH request, it is ignored by the service. * `repeated` (*type:* `boolean()`, *default:* `nil`) - Whether this parameter may appear multiple times. * `required` (*type:* `boolean()`, *default:* `nil`) - Whether the parameter is required. * `type` (*type:* `String.t`, *default:* `nil`) - The value type for this schema. A list of values can be found here: <http://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1> * `variant` (*type:* `GoogleApi.Discovery.V1.Model.JsonSchemaVariant.t`, *default:* `nil`) - In a variant data type, the value of one property is used to determine how to interpret the entire entity. Its value must exist in a map of descriminant values to schema names. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [decode(value, options)](#decode/2) Unwrap a decoded JSON object into its complex fields. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/json_schema.ex#L48 "View Source") Specs ----- ``` t() :: %GoogleApi.Discovery.V1.Model.JsonSchema{ "$ref": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, additionalProperties: [GoogleApi.Discovery.V1.Model.JsonSchema.t](#t:t/0)() | nil, annotations: [GoogleApi.Discovery.V1.Model.JsonSchemaAnnotations.t](GoogleApi.Discovery.V1.Model.JsonSchemaAnnotations.html#t:t/0)() | nil, default: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, description: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, enum: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil, enumDescriptions: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil, format: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, items: [GoogleApi.Discovery.V1.Model.JsonSchema.t](#t:t/0)() | nil, location: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, maximum: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, minimum: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, pattern: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, properties: %{optional([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) => [GoogleApi.Discovery.V1.Model.JsonSchema.t](#t:t/0)()} | nil, readOnly: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, repeated: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, required: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, type: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, variant: [GoogleApi.Discovery.V1.Model.JsonSchemaVariant.t](GoogleApi.Discovery.V1.Model.JsonSchemaVariant.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#decode/2 "Link to this function") decode(value, options) ====================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/json_schema.ex#L18 "View Source") Specs ----- ``` decode([struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Unwrap a decoded JSON object into its complex fields. GoogleApi.Discovery.V1.Model.JsonSchemaAnnotations β€” google\_api\_discovery v0.12.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } GoogleApi.Discovery.V1.Model.JsonSchemaAnnotations (google\_api\_discovery v0.12.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/json_schema_annotations.ex#L18 "View Source") ============================================================================================================================================================================================================================================================================= Additional information about this property. Attributes ------------- * `required` (*type:* `list(String.t)`, *default:* `nil`) - A list of methods for which this property is required on requests. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [decode(value, options)](#decode/2) Unwrap a decoded JSON object into its complex fields. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/json_schema_annotations.ex#L29 "View Source") Specs ----- ``` t() :: %GoogleApi.Discovery.V1.Model.JsonSchemaAnnotations{ required: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#decode/2 "Link to this function") decode(value, options) ====================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/json_schema_annotations.ex#L18 "View Source") Specs ----- ``` decode([struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Unwrap a decoded JSON object into its complex fields. GoogleApi.Discovery.V1.Model.JsonSchemaVariant β€” google\_api\_discovery v0.12.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } GoogleApi.Discovery.V1.Model.JsonSchemaVariant (google\_api\_discovery v0.12.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/json_schema_variant.ex#L18 "View Source") ===================================================================================================================================================================================================================================================================== In a variant data type, the value of one property is used to determine how to interpret the entire entity. Its value must exist in a map of descriminant values to schema names. Attributes ------------- * `discriminant` (*type:* `String.t`, *default:* `nil`) - The name of the type discriminant property. * `map` (*type:* `list(GoogleApi.Discovery.V1.Model.JsonSchemaVariantMap.t)`, *default:* `nil`) - The map of discriminant value to schema to use for parsing.. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [decode(value, options)](#decode/2) Unwrap a decoded JSON object into its complex fields. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/json_schema_variant.ex#L30 "View Source") Specs ----- ``` t() :: %GoogleApi.Discovery.V1.Model.JsonSchemaVariant{ discriminant: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, map: [[GoogleApi.Discovery.V1.Model.JsonSchemaVariantMap.t](GoogleApi.Discovery.V1.Model.JsonSchemaVariantMap.html#t:t/0)()] | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#decode/2 "Link to this function") decode(value, options) ====================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/json_schema_variant.ex#L18 "View Source") Specs ----- ``` decode([struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Unwrap a decoded JSON object into its complex fields. GoogleApi.Discovery.V1.Model.JsonSchemaVariantMap β€” google\_api\_discovery v0.12.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } GoogleApi.Discovery.V1.Model.JsonSchemaVariantMap (google\_api\_discovery v0.12.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/json_schema_variant_map.ex#L18 "View Source") ============================================================================================================================================================================================================================================================================ Attributes ------------- * `$ref` (*type:* `String.t`, *default:* `nil`) - * `type_value` (*type:* `String.t`, *default:* `nil`) - [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [decode(value, options)](#decode/2) Unwrap a decoded JSON object into its complex fields. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/json_schema_variant_map.ex#L30 "View Source") Specs ----- ``` t() :: %GoogleApi.Discovery.V1.Model.JsonSchemaVariantMap{ "$ref": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, type_value: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#decode/2 "Link to this function") decode(value, options) ====================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/json_schema_variant_map.ex#L18 "View Source") Specs ----- ``` decode([struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Unwrap a decoded JSON object into its complex fields. GoogleApi.Discovery.V1.Model.RestDescription β€” google\_api\_discovery v0.12.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } GoogleApi.Discovery.V1.Model.RestDescription (google\_api\_discovery v0.12.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_description.ex#L18 "View Source") ================================================================================================================================================================================================================================================================ Attributes ------------- * `auth` (*type:* `GoogleApi.Discovery.V1.Model.RestDescriptionAuth.t`, *default:* `nil`) - Authentication information. * `basePath` (*type:* `String.t`, *default:* `nil`) - [DEPRECATED] The base path for REST requests. * `baseUrl` (*type:* `String.t`, *default:* `nil`) - [DEPRECATED] The base URL for REST requests. * `batchPath` (*type:* `String.t`, *default:* `nil`) - The path for REST batch requests. * `canonicalName` (*type:* `String.t`, *default:* `nil`) - Indicates how the API name should be capitalized and split into various parts. Useful for generating pretty class names. * `description` (*type:* `String.t`, *default:* `nil`) - The description of this API. * `discoveryVersion` (*type:* `String.t`, *default:* `v1`) - Indicate the version of the Discovery API used to generate this doc. * `documentationLink` (*type:* `String.t`, *default:* `nil`) - A link to human readable documentation for the API. * `etag` (*type:* `String.t`, *default:* `nil`) - The ETag for this response. * `exponentialBackoffDefault` (*type:* `boolean()`, *default:* `nil`) - Enable exponential backoff for suitable methods in the generated clients. * `features` (*type:* `list(String.t)`, *default:* `nil`) - A list of supported features for this API. * `icons` (*type:* `GoogleApi.Discovery.V1.Model.RestDescriptionIcons.t`, *default:* `nil`) - Links to 16x16 and 32x32 icons representing the API. * `id` (*type:* `String.t`, *default:* `nil`) - The ID of this API. * `kind` (*type:* `String.t`, *default:* `discovery#restDescription`) - The kind for this response. * `labels` (*type:* `list(String.t)`, *default:* `nil`) - Labels for the status of this API, such as labs or deprecated. * `methods` (*type:* `%{optional(String.t) => GoogleApi.Discovery.V1.Model.RestMethod.t}`, *default:* `nil`) - API-level methods for this API. * `name` (*type:* `String.t`, *default:* `nil`) - The name of this API. * `ownerDomain` (*type:* `String.t`, *default:* `nil`) - The domain of the owner of this API. Together with the ownerName and a packagePath values, this can be used to generate a library for this API which would have a unique fully qualified name. * `ownerName` (*type:* `String.t`, *default:* `nil`) - The name of the owner of this API. See ownerDomain. * `packagePath` (*type:* `String.t`, *default:* `nil`) - The package of the owner of this API. See ownerDomain. * `parameters` (*type:* `%{optional(String.t) => GoogleApi.Discovery.V1.Model.JsonSchema.t}`, *default:* `nil`) - Common parameters that apply across all apis. * `protocol` (*type:* `String.t`, *default:* `rest`) - The protocol described by this document. * `resources` (*type:* `%{optional(String.t) => GoogleApi.Discovery.V1.Model.RestResource.t}`, *default:* `nil`) - The resources in this API. * `revision` (*type:* `String.t`, *default:* `nil`) - The version of this API. * `rootUrl` (*type:* `String.t`, *default:* `nil`) - The root URL under which all API services live. * `schemas` (*type:* `%{optional(String.t) => GoogleApi.Discovery.V1.Model.JsonSchema.t}`, *default:* `nil`) - The schemas for this API. * `servicePath` (*type:* `String.t`, *default:* `nil`) - The base path for all REST requests. * `title` (*type:* `String.t`, *default:* `nil`) - The title of this API. * `version` (*type:* `String.t`, *default:* `nil`) - The version of this API. * `version_module` (*type:* `boolean()`, *default:* `nil`) - [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [decode(value, options)](#decode/2) Unwrap a decoded JSON object into its complex fields. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_description.ex#L58 "View Source") Specs ----- ``` t() :: %GoogleApi.Discovery.V1.Model.RestDescription{ auth: [GoogleApi.Discovery.V1.Model.RestDescriptionAuth.t](GoogleApi.Discovery.V1.Model.RestDescriptionAuth.html#t:t/0)() | nil, basePath: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, baseUrl: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, batchPath: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, canonicalName: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, description: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, discoveryVersion: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, documentationLink: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, etag: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, exponentialBackoffDefault: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, features: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil, icons: [GoogleApi.Discovery.V1.Model.RestDescriptionIcons.t](GoogleApi.Discovery.V1.Model.RestDescriptionIcons.html#t:t/0)() | nil, id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, kind: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, labels: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil, methods: %{optional([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) => [GoogleApi.Discovery.V1.Model.RestMethod.t](GoogleApi.Discovery.V1.Model.RestMethod.html#t:t/0)()} | nil, name: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, ownerDomain: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, ownerName: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, packagePath: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, parameters: %{optional([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) => [GoogleApi.Discovery.V1.Model.JsonSchema.t](GoogleApi.Discovery.V1.Model.JsonSchema.html#t:t/0)()} | nil, protocol: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, resources: %{optional([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) => [GoogleApi.Discovery.V1.Model.RestResource.t](GoogleApi.Discovery.V1.Model.RestResource.html#t:t/0)()} | nil, revision: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, rootUrl: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, schemas: %{optional([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) => [GoogleApi.Discovery.V1.Model.JsonSchema.t](GoogleApi.Discovery.V1.Model.JsonSchema.html#t:t/0)()} | nil, servicePath: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, title: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, version: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, version_module: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#decode/2 "Link to this function") decode(value, options) ====================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_description.ex#L18 "View Source") Specs ----- ``` decode([struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Unwrap a decoded JSON object into its complex fields. GoogleApi.Discovery.V1.Model.RestDescriptionAuth β€” google\_api\_discovery v0.12.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } GoogleApi.Discovery.V1.Model.RestDescriptionAuth (google\_api\_discovery v0.12.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_description_auth.ex#L18 "View Source") ========================================================================================================================================================================================================================================================================= Authentication information. Attributes ------------- * `oauth2` (*type:* `GoogleApi.Discovery.V1.Model.RestDescriptionAuthOauth2.t`, *default:* `nil`) - OAuth 2.0 authentication information. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [decode(value, options)](#decode/2) Unwrap a decoded JSON object into its complex fields. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_description_auth.ex#L29 "View Source") Specs ----- ``` t() :: %GoogleApi.Discovery.V1.Model.RestDescriptionAuth{ oauth2: [GoogleApi.Discovery.V1.Model.RestDescriptionAuthOauth2.t](GoogleApi.Discovery.V1.Model.RestDescriptionAuthOauth2.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#decode/2 "Link to this function") decode(value, options) ====================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_description_auth.ex#L18 "View Source") Specs ----- ``` decode([struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Unwrap a decoded JSON object into its complex fields. GoogleApi.Discovery.V1.Model.RestDescriptionAuthOauth2 β€” google\_api\_discovery v0.12.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } GoogleApi.Discovery.V1.Model.RestDescriptionAuthOauth2 (google\_api\_discovery v0.12.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_description_auth_oauth2.ex#L18 "View Source") ====================================================================================================================================================================================================================================================================================== OAuth 2.0 authentication information. Attributes ------------- * `scopes` (*type:* `map()`, *default:* `nil`) - Available OAuth 2.0 scopes. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [decode(value, options)](#decode/2) Unwrap a decoded JSON object into its complex fields. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_description_auth_oauth2.ex#L29 "View Source") Specs ----- ``` t() :: %GoogleApi.Discovery.V1.Model.RestDescriptionAuthOauth2{ scopes: [map](https://hexdocs.pm/elixir/typespecs.html#basic-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#decode/2 "Link to this function") decode(value, options) ====================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_description_auth_oauth2.ex#L18 "View Source") Specs ----- ``` decode([struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Unwrap a decoded JSON object into its complex fields. GoogleApi.Discovery.V1.Model.RestDescriptionIcons β€” google\_api\_discovery v0.12.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } GoogleApi.Discovery.V1.Model.RestDescriptionIcons (google\_api\_discovery v0.12.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_description_icons.ex#L18 "View Source") =========================================================================================================================================================================================================================================================================== Links to 16x16 and 32x32 icons representing the API. Attributes ------------- * `x16` (*type:* `String.t`, *default:* `nil`) - The URL of the 16x16 icon. * `x32` (*type:* `String.t`, *default:* `nil`) - The URL of the 32x32 icon. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [decode(value, options)](#decode/2) Unwrap a decoded JSON object into its complex fields. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_description_icons.ex#L30 "View Source") Specs ----- ``` t() :: %GoogleApi.Discovery.V1.Model.RestDescriptionIcons{ x16: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, x32: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#decode/2 "Link to this function") decode(value, options) ====================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_description_icons.ex#L18 "View Source") Specs ----- ``` decode([struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Unwrap a decoded JSON object into its complex fields. GoogleApi.Discovery.V1.Model.RestMethod β€” google\_api\_discovery v0.12.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } GoogleApi.Discovery.V1.Model.RestMethod (google\_api\_discovery v0.12.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_method.ex#L18 "View Source") ====================================================================================================================================================================================================================================================== Attributes ------------- * `description` (*type:* `String.t`, *default:* `nil`) - Description of this method. * `etagRequired` (*type:* `boolean()`, *default:* `nil`) - Whether this method requires an ETag to be specified. The ETag is sent as an HTTP If-Match or If-None-Match header. * `flatPath` (*type:* `String.t`, *default:* `nil`) - The URI path of this REST method in (RFC 6570) format without level 2 features ({+var}). Supplementary to the path property. * `httpMethod` (*type:* `String.t`, *default:* `nil`) - HTTP method used by this method. * `id` (*type:* `String.t`, *default:* `nil`) - A unique ID for this method. This property can be used to match methods between different versions of Discovery. * `mediaUpload` (*type:* `GoogleApi.Discovery.V1.Model.RestMethodMediaUpload.t`, *default:* `nil`) - Media upload parameters. * `parameterOrder` (*type:* `list(String.t)`, *default:* `nil`) - Ordered list of required parameters, serves as a hint to clients on how to structure their method signatures. The array is ordered such that the "most-significant" parameter appears first. * `parameters` (*type:* `%{optional(String.t) => GoogleApi.Discovery.V1.Model.JsonSchema.t}`, *default:* `nil`) - Details for all parameters in this method. * `path` (*type:* `String.t`, *default:* `nil`) - The URI path of this REST method. Should be used in conjunction with the basePath property at the api-level. * `request` (*type:* `GoogleApi.Discovery.V1.Model.RestMethodRequest.t`, *default:* `nil`) - The schema for the request. * `response` (*type:* `GoogleApi.Discovery.V1.Model.RestMethodResponse.t`, *default:* `nil`) - The schema for the response. * `scopes` (*type:* `list(String.t)`, *default:* `nil`) - OAuth 2.0 scopes applicable to this method. * `supportsMediaDownload` (*type:* `boolean()`, *default:* `nil`) - Whether this method supports media downloads. * `supportsMediaUpload` (*type:* `boolean()`, *default:* `nil`) - Whether this method supports media uploads. * `supportsSubscription` (*type:* `boolean()`, *default:* `nil`) - Whether this method supports subscriptions. * `useMediaDownloadService` (*type:* `boolean()`, *default:* `nil`) - Indicates that downloads from this method should use the download service URL (i.e. "/download"). Only applies if the method supports media download. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [decode(value, options)](#decode/2) Unwrap a decoded JSON object into its complex fields. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_method.ex#L44 "View Source") Specs ----- ``` t() :: %GoogleApi.Discovery.V1.Model.RestMethod{ description: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, etagRequired: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, flatPath: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, httpMethod: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, id: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, mediaUpload: [GoogleApi.Discovery.V1.Model.RestMethodMediaUpload.t](GoogleApi.Discovery.V1.Model.RestMethodMediaUpload.html#t:t/0)() | nil, parameterOrder: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil, parameters: %{optional([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) => [GoogleApi.Discovery.V1.Model.JsonSchema.t](GoogleApi.Discovery.V1.Model.JsonSchema.html#t:t/0)()} | nil, path: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, request: [GoogleApi.Discovery.V1.Model.RestMethodRequest.t](GoogleApi.Discovery.V1.Model.RestMethodRequest.html#t:t/0)() | nil, response: [GoogleApi.Discovery.V1.Model.RestMethodResponse.t](GoogleApi.Discovery.V1.Model.RestMethodResponse.html#t:t/0)() | nil, scopes: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil, supportsMediaDownload: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, supportsMediaUpload: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, supportsSubscription: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, useMediaDownloadService: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#decode/2 "Link to this function") decode(value, options) ====================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_method.ex#L18 "View Source") Specs ----- ``` decode([struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Unwrap a decoded JSON object into its complex fields. GoogleApi.Discovery.V1.Model.RestMethodMediaUpload β€” google\_api\_discovery v0.12.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } GoogleApi.Discovery.V1.Model.RestMethodMediaUpload (google\_api\_discovery v0.12.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_method_media_upload.ex#L18 "View Source") ============================================================================================================================================================================================================================================================================== Media upload parameters. Attributes ------------- * `accept` (*type:* `list(String.t)`, *default:* `nil`) - MIME Media Ranges for acceptable media uploads to this method. * `maxSize` (*type:* `String.t`, *default:* `nil`) - Maximum size of a media upload, such as "1MB", "2GB" or "3TB". * `protocols` (*type:* `GoogleApi.Discovery.V1.Model.RestMethodMediaUploadProtocols.t`, *default:* `nil`) - Supported upload protocols. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [decode(value, options)](#decode/2) Unwrap a decoded JSON object into its complex fields. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_method_media_upload.ex#L31 "View Source") Specs ----- ``` t() :: %GoogleApi.Discovery.V1.Model.RestMethodMediaUpload{ accept: [[String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()] | nil, maxSize: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, protocols: [GoogleApi.Discovery.V1.Model.RestMethodMediaUploadProtocols.t](GoogleApi.Discovery.V1.Model.RestMethodMediaUploadProtocols.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#decode/2 "Link to this function") decode(value, options) ====================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_method_media_upload.ex#L18 "View Source") Specs ----- ``` decode([struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Unwrap a decoded JSON object into its complex fields. GoogleApi.Discovery.V1.Model.RestMethodMediaUploadProtocols β€” google\_api\_discovery v0.12.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } GoogleApi.Discovery.V1.Model.RestMethodMediaUploadProtocols (google\_api\_discovery v0.12.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_method_media_upload_protocols.ex#L18 "View Source") ================================================================================================================================================================================================================================================================================================= Supported upload protocols. Attributes ------------- * `resumable` (*type:* `GoogleApi.Discovery.V1.Model.RestMethodMediaUploadProtocolsResumable.t`, *default:* `nil`) - Supports the Resumable Media Upload protocol. * `simple` (*type:* `GoogleApi.Discovery.V1.Model.RestMethodMediaUploadProtocolsSimple.t`, *default:* `nil`) - Supports uploading as a single HTTP request. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [decode(value, options)](#decode/2) Unwrap a decoded JSON object into its complex fields. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_method_media_upload_protocols.ex#L30 "View Source") Specs ----- ``` t() :: %GoogleApi.Discovery.V1.Model.RestMethodMediaUploadProtocols{ resumable: [GoogleApi.Discovery.V1.Model.RestMethodMediaUploadProtocolsResumable.t](GoogleApi.Discovery.V1.Model.RestMethodMediaUploadProtocolsResumable.html#t:t/0)() | nil, simple: [GoogleApi.Discovery.V1.Model.RestMethodMediaUploadProtocolsSimple.t](GoogleApi.Discovery.V1.Model.RestMethodMediaUploadProtocolsSimple.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#decode/2 "Link to this function") decode(value, options) ====================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_method_media_upload_protocols.ex#L18 "View Source") Specs ----- ``` decode([struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Unwrap a decoded JSON object into its complex fields. GoogleApi.Discovery.V1.Model.RestMethodMediaUploadProtocolsResumable β€” google\_api\_discovery v0.12.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } GoogleApi.Discovery.V1.Model.RestMethodMediaUploadProtocolsResumable (google\_api\_discovery v0.12.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_method_media_upload_protocols_resumable.ex#L18 "View Source") ==================================================================================================================================================================================================================================================================================================================== Supports the Resumable Media Upload protocol. Attributes ------------- * `multipart` (*type:* `boolean()`, *default:* `true`) - True if this endpoint supports uploading multipart media. * `path` (*type:* `String.t`, *default:* `nil`) - The URI path to be used for upload. Should be used in conjunction with the basePath property at the api-level. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [decode(value, options)](#decode/2) Unwrap a decoded JSON object into its complex fields. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_method_media_upload_protocols_resumable.ex#L30 "View Source") Specs ----- ``` t() :: %GoogleApi.Discovery.V1.Model.RestMethodMediaUploadProtocolsResumable{ multipart: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, path: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#decode/2 "Link to this function") decode(value, options) ====================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_method_media_upload_protocols_resumable.ex#L18 "View Source") Specs ----- ``` decode([struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Unwrap a decoded JSON object into its complex fields. GoogleApi.Discovery.V1.Model.RestMethodMediaUploadProtocolsSimple β€” google\_api\_discovery v0.12.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } GoogleApi.Discovery.V1.Model.RestMethodMediaUploadProtocolsSimple (google\_api\_discovery v0.12.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_method_media_upload_protocols_simple.ex#L18 "View Source") ============================================================================================================================================================================================================================================================================================================== Supports uploading as a single HTTP request. Attributes ------------- * `multipart` (*type:* `boolean()`, *default:* `true`) - True if this endpoint supports upload multipart media. * `path` (*type:* `String.t`, *default:* `nil`) - The URI path to be used for upload. Should be used in conjunction with the basePath property at the api-level. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [decode(value, options)](#decode/2) Unwrap a decoded JSON object into its complex fields. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_method_media_upload_protocols_simple.ex#L30 "View Source") Specs ----- ``` t() :: %GoogleApi.Discovery.V1.Model.RestMethodMediaUploadProtocolsSimple{ multipart: [boolean](https://hexdocs.pm/elixir/typespecs.html#built-in-types)() | nil, path: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#decode/2 "Link to this function") decode(value, options) ====================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_method_media_upload_protocols_simple.ex#L18 "View Source") Specs ----- ``` decode([struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Unwrap a decoded JSON object into its complex fields. GoogleApi.Discovery.V1.Model.RestMethodRequest β€” google\_api\_discovery v0.12.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } GoogleApi.Discovery.V1.Model.RestMethodRequest (google\_api\_discovery v0.12.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_method_request.ex#L18 "View Source") ===================================================================================================================================================================================================================================================================== The schema for the request. Attributes ------------- * `$ref` (*type:* `String.t`, *default:* `nil`) - Schema ID for the request schema. * `parameterName` (*type:* `String.t`, *default:* `nil`) - parameter name. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [decode(value, options)](#decode/2) Unwrap a decoded JSON object into its complex fields. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_method_request.ex#L30 "View Source") Specs ----- ``` t() :: %GoogleApi.Discovery.V1.Model.RestMethodRequest{ "$ref": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil, parameterName: [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#decode/2 "Link to this function") decode(value, options) ====================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_method_request.ex#L18 "View Source") Specs ----- ``` decode([struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Unwrap a decoded JSON object into its complex fields. GoogleApi.Discovery.V1.Model.RestMethodResponse β€” google\_api\_discovery v0.12.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } GoogleApi.Discovery.V1.Model.RestMethodResponse (google\_api\_discovery v0.12.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_method_response.ex#L18 "View Source") ======================================================================================================================================================================================================================================================================= The schema for the response. Attributes ------------- * `$ref` (*type:* `String.t`, *default:* `nil`) - Schema ID for the response schema. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [decode(value, options)](#decode/2) Unwrap a decoded JSON object into its complex fields. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_method_response.ex#L29 "View Source") Specs ----- ``` t() :: %GoogleApi.Discovery.V1.Model.RestMethodResponse{ "$ref": [String.t](https://hexdocs.pm/elixir/String.html#t:t/0)() | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#decode/2 "Link to this function") decode(value, options) ====================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_method_response.ex#L18 "View Source") Specs ----- ``` decode([struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Unwrap a decoded JSON object into its complex fields. GoogleApi.Discovery.V1.Model.RestResource β€” google\_api\_discovery v0.12.0 try { if (localStorage.getItem('night-mode') === 'true') { document.body.classList.add('night-mode'); } } catch (error) { } GoogleApi.Discovery.V1.Model.RestResource (google\_api\_discovery v0.12.0) [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_resource.ex#L18 "View Source") ========================================================================================================================================================================================================================================================== Attributes ------------- * `methods` (*type:* `%{optional(String.t) => GoogleApi.Discovery.V1.Model.RestMethod.t}`, *default:* `nil`) - Methods on this resource. * `resources` (*type:* `%{optional(String.t) => GoogleApi.Discovery.V1.Model.RestResource.t}`, *default:* `nil`) - Sub-resources on this resource. [Link to this section](#summary) Summary ========================================== [Types](#types) ---------------- [t()](#t:t/0) [Functions](#functions) ------------------------ [decode(value, options)](#decode/2) Unwrap a decoded JSON object into its complex fields. [Link to this section](#types) Types ===================================== [Link to this type](#t:t/0 "Link to this type") t() === [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_resource.ex#L30 "View Source") Specs ----- ``` t() :: %GoogleApi.Discovery.V1.Model.RestResource{ methods: %{optional([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) => [GoogleApi.Discovery.V1.Model.RestMethod.t](GoogleApi.Discovery.V1.Model.RestMethod.html#t:t/0)()} | nil, resources: %{optional([String.t](https://hexdocs.pm/elixir/String.html#t:t/0)()) => [GoogleApi.Discovery.V1.Model.RestResource.t](#t:t/0)()} | nil } ``` [Link to this section](#functions) Functions ============================================= [Link to this function](#decode/2 "Link to this function") decode(value, options) ====================== [View Source](https://github.com/googleapis/elixir-google-api/tree/master/clients/discovery/blob/master/lib/google_api/discovery/v1/model/rest_resource.ex#L18 "View Source") Specs ----- ``` decode([struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)(), [keyword](https://hexdocs.pm/elixir/typespecs.html#built-in-types)()) :: [struct](https://hexdocs.pm/elixir/typespecs.html#basic-types)() ``` Unwrap a decoded JSON object into its complex fields.