### Install Erlang with Documentation via mise Source: https://github.com/kronicdeth/intellij-elixir/blob/main/README.md Use this command to install a specific Erlang version with documentation support using mise. Ensure to replace X.Y.Z with your desired OTP version. ```bash KERL_BUILD_DOCS=yes MISE_ERLANG_COMPILE=true mise install erlang@X.Y.Z ``` -------------------------------- ### Install Erlang with Documentation via asdf Source: https://github.com/kronicdeth/intellij-elixir/blob/main/README.md Use this command to install a specific Erlang version with documentation support using asdf. Ensure to replace X.Y.Z with your desired OTP version. ```bash KERL_BUILD_DOCS=yes asdf install erlang X.Y.Z ``` -------------------------------- ### Install doctoc Globally Source: https://github.com/kronicdeth/intellij-elixir/blob/main/CONTRIBUTING.md Install the doctoc tool globally using npm. This is required for regenerating documentation tables of contents. ```sh npm install -g doctoc ``` -------------------------------- ### Start Release as Daemon Source: https://github.com/kronicdeth/intellij-elixir/blob/main/README.md Starts the Elixir release as a background daemon process. This is suitable for production environments. ```bash _build/ENV/rel/NAME/bin/NAME start ``` -------------------------------- ### Troubleshoot Erlang Quoter Start on Windows Source: https://github.com/kronicdeth/intellij-elixir/blob/main/CONTRIBUTING.md Commands to check for and kill orphaned Erlang processes if the quoter fails to start on Windows. Ensure no antivirus is blocking the process. ```bash # Verify no orphaned Erlang processes: tasklist | findstr erl # Kill orphaned processes: taskkill /F /IM erl.exe ``` -------------------------------- ### Base32 Encoding Example Source: https://github.com/kronicdeth/intellij-elixir/blob/main/base.txt Demonstrates how to encode a string using Base32. This is the default behavior when no specific padding is requested. ```elixir iex> Base.encode32("foobar") ``` -------------------------------- ### Heredoc String Example Source: https://github.com/kronicdeth/intellij-elixir/blob/main/base.txt Demonstrates the use of heredoc syntax for multi-line strings in Elixir. ```elixir """ foobar """ ``` -------------------------------- ### Run Release Interactively Source: https://github.com/kronicdeth/intellij-elixir/blob/main/README.md Starts an interactive shell with the release loaded, similar to `iex -S mix`. This is useful for debugging and development. ```bash _build/ENV/rel/NAME/bin/NAME console ``` -------------------------------- ### Elixir Base64 Decode Example Source: https://github.com/kronicdeth/intellij-elixir/blob/main/base.txt Demonstrates decoding a Base64 string using `Base.decode64/1`. The output indicates success and the decoded string. ```elixir iex> Base.decode64("Zm9vYmFy") {:ok, "foobar"} ``` -------------------------------- ### Announcing on ElixirStatus.com Source: https://github.com/kronicdeth/intellij-elixir/blob/main/RELEASING.md Post an announcement on ElixirStatus.com with the version, key enhancements, and a link to installation instructions. ```markdown [Installation Instructions](https://github.com/KronicDeth/intellij-elixir/blob/VERSION/README.md#installation) ``` -------------------------------- ### Create Elixir Application Module Source: https://github.com/kronicdeth/intellij-elixir/wiki/Features Generates an Elixir module that can be started as an application. Includes a `start/2` function to initiate the application's supervisor. ```elixir defmodule MyNamespace.MyModule do @moduledoc false use Application def start(_type, _args) do MyNamespace.MyModule.Supervisor.start_link() end end ``` -------------------------------- ### Heredoc Alignment Example Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/heredoc_alignment_before.txt Demonstrates the alignment of heredoc content and the terminator. Notice the whitespace before the content and the terminator. ```Elixir def interpolated_charlist_sigil_heredoc do to_string(~c''' One Two Three ''' ) end ``` -------------------------------- ### Elixir Enum.with_index Example Source: https://github.com/kronicdeth/intellij-elixir/blob/main/base.txt Demonstrates how to use Enum.with_index to iterate over a collection and get both the element and its index. This is useful for scenarios where the position of an element is important. ```Elixir alphabet = Enum.with_index(alphabet) ``` -------------------------------- ### Troubleshoot 'getQuoterDeps' in PowerShell Source: https://github.com/kronicdeth/intellij-elixir/blob/main/CONTRIBUTING.md If 'erl' is not found in PowerShell, run the task from Git Bash. This example shows how to navigate to the project directory and execute the Gradle task. It also includes an example of adding Erlang to the Git Bash PATH. ```bash # Example: cd /c/Users/user/IdeaProjects/intellij-elixir # ./gradlew.bat getQuoterDeps --rerun-tasks --no-build-cache --no-configuration-cache # If needed, add Erlang to Git Bash PATH, e.g. export PATH="/c/Program Files/erl-24.3.4.6/bin:$PATH" ``` -------------------------------- ### Elixir Map Construction with Keyword Pairs Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/map_and_struct_update_one_key_per_line_before.txt This example demonstrates constructing an Elixir map using keyword pairs, where each pair is on a new line. It highlights the use of the '%' prefix and the colon ':' for keyword keys. ```elixir %{ one: %{three: "four"} } ``` -------------------------------- ### Elixir Bitstring Pattern Matching Example Source: https://github.com/kronicdeth/intellij-elixir/blob/main/base.txt This snippet shows a basic example of bitstring pattern matching in Elixir. It defines a bitstring with different types and uses pattern matching to extract values. ```elixir case rest do <> -> IO.inspect([c1, c2]) end ``` -------------------------------- ### Launch EAP Snapshot of JetBrains IDEs Source: https://github.com/kronicdeth/intellij-elixir/blob/main/CONTRIBUTING.md To test with the latest Early Access Program (EAP) snapshot of an IDE, use the corresponding Gradle task with the '-PuseDynamicEapVersion=true' property. This example shows launching the RubyMine EAP. ```bash ./gradlew runRubyMineEAP -PuseDynamicEapVersion=true ``` -------------------------------- ### Start IEx interactive shell Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/cli/elixir_cli_base_args.txt Launches the IEx interactive shell with various configurations for Elixir and OTP versions. Includes options for enabling ANSI colors and disabling the shell. ```bash iex|1.13.0|erl -pa {elixirHomePath}/bin/../lib/eex/ebin {elixirHomePath}/bin/../lib/elixir/ebin {elixirHomePath}/bin/../lib/ex_unit/ebin {elixirHomePath}/bin/../lib/iex/ebin {elixirHomePath}/bin/../lib/logger/ebin {elixirHomePath}/bin/../lib/mix/ebin -elixir ansi_enabled true -noshell -user Elixir.IEx.CLI -extra --no-halt +iex ``` ```bash iex|1.13.0-otp-22|erl -pa {elixirHomePath}/bin/../lib/eex/ebin {elixirHomePath}/bin/../lib/elixir/ebin {elixirHomePath}/bin/../lib/ex_unit/ebin {elixirHomePath}/bin/../lib/iex/ebin {elixirHomePath}/bin/../lib/logger/ebin {elixirHomePath}/bin/../lib/mix/ebin -elixir ansi_enabled true -noshell -user Elixir.IEx.CLI -extra --no-halt +iex ``` ```bash iex|1.15.0|erl -noshell -elixir_root {elixirHomePath}/bin/../lib -pa {elixirHomePath}/bin/../lib/elixir/ebin -s elixir start_cli -elixir ansi_enabled true -user elixir -extra --no-halt -e :elixir.start_iex() +iex ``` ```bash iex|1.15.0-otp-24|erl -noshell -elixir_root {elixirHomePath}/bin/../lib -pa {elixirHomePath}/bin/../lib/elixir/ebin -s elixir start_cli -elixir ansi_enabled true -user elixir -extra --no-halt -e :elixir.start_iex() +iex ``` ```bash iex|1.15.1|erl -noshell -elixir_root {elixirHomePath}/bin/../lib -pa {elixirHomePath}/bin/../lib/elixir/ebin -s elixir start_iex -elixir ansi_enabled true -user elixir -extra --no-halt +iex ``` ```bash iex|1.15.1-otp-24|erl -noshell -elixir_root {elixirHomePath}/bin/../lib -pa {elixirHomePath}/bin/../lib/elixir/ebin -s elixir start_iex -elixir ansi_enabled true -user elixir -extra --no-halt +iex ``` ```bash iex|1.17.0|erl -noshell -elixir_root {elixirHomePath}/bin/../lib -pa {elixirHomePath}/bin/../lib/elixir/ebin -elixir ansi_enabled true -user elixir -extra --no-halt +iex ``` ```bash iex|1.17.0-otp-25|erl -noshell -elixir_root {elixirHomePath}/bin/../lib -pa {elixirHomePath}/bin/../lib/elixir/ebin -elixir ansi_enabled true -user elixir -extra --no-halt +iex ``` ```bash iex|1.19.0-otp-26|erl -noshell -elixir_root {elixirHomePath}/bin/../lib -pa {elixirHomePath}/bin/../lib/elixir/ebin -user elixir -extra --no-halt +iex ``` ```bash iex|1.19.5-otp-28|erl -noshell -elixir_root {elixirHomePath}/bin/../lib -pa {elixirHomePath}/bin/../lib/elixir/ebin -user elixir -extra --no-halt +iex ``` -------------------------------- ### Elixir Base64 Decoding Example Source: https://github.com/kronicdeth/intellij-elixir/blob/main/base.txt Demonstrates decoding a base64 string using `Base.decode64/1`. This function is useful for handling encoded data. ```elixir iex> Base.decode64!("Zm9vYmFy") "foobar" ``` -------------------------------- ### Base32 Decoding Example Source: https://github.com/kronicdeth/intellij-elixir/blob/main/base.txt Demonstrates decoding a Base32 encoded string. The `true` option indicates that the input string requires padding to the nearest multiple of 8. ```elixir iex> Base.decode32("MZXW6YTBOI======") {:ok, "foobar"} ``` ```elixir iex> Base.decode32("mzxw6ytboi======", case: :lower) {:ok, "foobar"} ``` -------------------------------- ### Announcing on Elixir Forums Source: https://github.com/kronicdeth/intellij-elixir/blob/main/RELEASING.md Format the announcement for the Elixir forums, including the version, sponsor link, release notes, and installation instructions. ```markdown # Version VERSION ``` ```markdown [❤️ Sponsor](https://github.com/sponsors/KronicDeth) Historical One-time/Monthly Donations: | Stat | Amount | |:--------|--------:| | Minimum | $1.00 | | Median | $6.25 | | Mean | $12.52 | | Maximum | $200.00 | ``` ```markdown [Installation Instructions](https://github.com/KronicDeth/intellij-elixir/blob/VERSION/README.md#installation) ``` -------------------------------- ### Heredoc Alignment Example Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/heredoc_alignment_after.txt Demonstrates how Elixir aligns heredoc content based on indentation. The leading whitespace before the heredoc content is preserved. ```Elixir def interpolated_words_heredoc do """ One Two Three """ end ``` -------------------------------- ### Troubleshoot Elixir Build Failures Source: https://github.com/kronicdeth/intellij-elixir/blob/main/CONTRIBUTING.md Verify that 'make' is installed and accessible in your PATH. If issues persist, try running build commands from Git Bash instead of PowerShell or cmd. ```bash # Ensure 'make' is on PATH: make --version ``` -------------------------------- ### Updating a Map with Multiple Key-Value Pairs Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/map_and_struct_update_one_key_per_line_after.txt This example demonstrates updating a map with multiple key-value pairs. Each new or updated pair is placed on a separate line, making the update operation easier to follow. ```Elixir %{ one => two three => four } ``` -------------------------------- ### Elixir Type Specification for decode32! Source: https://github.com/kronicdeth/intellij-elixir/blob/main/base.txt This example shows a type specification for the `decode32!` function, indicating it expects a binary and returns a binary. ```elixir @spec decode32!(binary, keyword) :: binary ``` -------------------------------- ### Elixir Tuple Creation Source: https://github.com/kronicdeth/intellij-elixir/blob/main/base.txt Shows how to create a tuple in Elixir, commonly used for returning results from functions. This example specifically creates a success tuple with a value. ```Elixir {:ok, decode16!(string, opts)} ``` -------------------------------- ### URL-Safe Base64 Decoding Example Source: https://github.com/kronicdeth/intellij-elixir/blob/main/base.txt Demonstrates how to decode a URL-safe base64 encoded string using Base.url_decode64. The function returns a tuple with :ok and the decoded binary if successful. ```elixir iex> Base.url_decode64("_3_-_A==") {:ok, <<255, 127, 254, 252>>} ``` -------------------------------- ### Elixir Bitstring Construction with Type Annotations Source: https://github.com/kronicdeth/intellij-elixir/blob/main/base.txt Constructs a bitstring with specified types and values. This example uses '::' to annotate types within the bitstring. ```Elixir <
> ``` -------------------------------- ### Elixir Parameter Variable Syntax Highlighting Source: https://github.com/kronicdeth/intellij-elixir/wiki/Features Highlights variables used as parameters in Elixir function definitions. Examples include 'a' and 'b'. ```elixir a ``` ```elixir b ``` -------------------------------- ### Elixir Map Construction with Association List (Alternative Formatting) Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/map_construction_arguments_associations_base_and_keywords_all_wrap_if_any_wraps_after.txt Constructs a map using an association list, similar to the first example but with different key-value pairs. This highlights alternative data within the same construction pattern. ```elixir %{ one => 1, three: 3 } ``` -------------------------------- ### Aligning Guard Clauses Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/align_guards_to_right_of_when_false.txt This example shows how multiple guard clauses are aligned to the right of the `when` keyword. This formatting is applied automatically by the Elixir formatter. ```elixir defmodule Example do def do_something(arg) when is_integer(arg) and size(arg) > 0 do %{:page => "content"} end end ``` -------------------------------- ### Bit String Indentation with Multiple Elements in No Parentheses Call Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/bit_string_indent.txt Provides an example of indentation for bit strings with multiple elements in a no-parentheses function call. ```elixir one ( two, << three, four >> ) ``` -------------------------------- ### Elixir Base.hex_decode32 Example Source: https://github.com/kronicdeth/intellij-elixir/blob/main/base.txt Demonstrates how to use Base.hex_decode32 to decode a base32 encoded string. The function returns a tuple indicating success or failure. ```elixir iex> Base.hex_decode32("CPNMUOJ1E8====== ``` ```elixir {:ok, "foobar"} ``` -------------------------------- ### Elixir Bitstring Construction with Unquote Source: https://github.com/kronicdeth/intellij-elixir/blob/main/base.txt Demonstrates the construction of Elixir bitstrings using the << >> syntax. The unquote function is used here, typically within macros, to dynamically insert values or expressions into the bitstring definition. This example shows defining a bitstring with specific types and values. ```elixir <> ``` -------------------------------- ### Function Call with Multiple Arguments and Spaces Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/with_space_after_comma.txt Illustrates a function call with multiple arguments, including spaces after commas. This example highlights the flexibility in spacing around commas in function calls. ```elixir one(two, three) ``` -------------------------------- ### Binary Operators in Elixir Source: https://github.com/kronicdeth/intellij-elixir/blob/main/README.md Examples of various binary operators and their corresponding Elixir syntax. These are used in contexts where special handling of call definition names might be relevant. ```Elixir left >>> right ``` ```Elixir left \ right ``` ```Elixir left ^ right ``` ```Elixir left ^^^ right ``` ```Elixir left and right ``` ```Elixir left in right ``` ```Elixir left or right ``` ```Elixir left |> right ``` ```Elixir left || right ``` ```Elixir left ||| right ``` ```Elixir left ~= right ``` ```Elixir left ~> right ``` ```Elixir left ~>> right ``` -------------------------------- ### Elixir String Interpolation Example Source: https://github.com/kronicdeth/intellij-elixir/blob/main/base.txt Demonstrates how to use string interpolation in Elixir to embed dynamic values within strings. This is useful for creating formatted output or constructing dynamic strings. ```elixir "dec#{base}" ``` ```elixir ":do_decode"<>"'do_decode#{base}'" ``` -------------------------------- ### Map with Keyword Pair Initialization Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/map_and_struct_compact_empty.txt Demonstrates initializing a map with a keyword pair using compact syntax. ```elixir %{one: %{}} ``` -------------------------------- ### Elixir Repo.all Query Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/parser_definition/general_parsing_test_case/Realistic.txt Demonstrates how to fetch all records from a repository using Repo.all. ```elixir Repo.all(query()) ``` -------------------------------- ### Elixir Type Specification Example Source: https://github.com/kronicdeth/intellij-elixir/blob/main/base.txt This example demonstrates an Elixir type specification using the `@spec` decorator. It defines the expected return type for a function as a tuple containing an atom `:ok` and a string. ```elixir @spec decode16(binary, keyword) :: {:ok, String.t()} | {:error, atom()} ``` -------------------------------- ### Configure IEx Mix Run Configuration Source: https://github.com/kronicdeth/intellij-elixir/wiki/Features This describes the steps to set up an 'IEx Mix' run configuration in IntelliJ IDEA. It allows running `iex -S mix` within the project context. ```text Run > Edit Configurations... + IEx Mix (Optionally) fill in "mix arguments", such as `phx.server` if you want to launch [Phoenix](https://github.com/phoenixframework/phoenix) inside of `iex`. (Optionally) fill in "iex arguments" with arguments to `iex` before `-S mix`. (Optionally) full in "erl arguments" with arguments to `erl` before it runs `iex`. Fill in the "Working directory" * Type the absolute path to the directory. * Select the path using directory picker by clicking the `...` button (Optionally) click the `...` button on the "Environment variables" line to add environment variables. OK ``` -------------------------------- ### Empty Struct Initialization Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/map_and_struct_compact_empty.txt Illustrates the compact syntax for initializing an empty struct in Elixir. ```elixir %Two{} ``` -------------------------------- ### Elixir Callback with Aligned Pipe Operands Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/align_pipe_operands_false.txt Example of an Elixir callback function demonstrating how pipe operands are aligned when `align_pipe_operands` is set to false. This is useful for complex return types or when explicit alignment is not desired. ```elixir defmodule Calcinator.Resources do @callback get(id, query_options) :: {:ok, struct} | {:error, :not_found} when is_atom(query_options) end ``` -------------------------------- ### Elixir Grammar Parsing - Anonymous Function Calls Source: https://github.com/kronicdeth/intellij-elixir/blob/main/README.md Examples of anonymous function calls `.()` with various argument types. ```Elixir .() ``` ```Elixir .() positional, key: value ``` ```Elixir .() key: value ``` -------------------------------- ### Build IntelliJ Elixir Plugin on Windows Source: https://github.com/kronicdeth/intellij-elixir/blob/main/CONTRIBUTING.md Use these Gradle tasks to build the plugin on Windows. The first command performs a full build including tests, while the second builds only the plugin without running tests. ```bash # Full build with tests ./gradlew test # Build plugin only (no tests) ./gradlew buildPlugin ``` -------------------------------- ### Launch IntelliJ IDEA for Development Source: https://github.com/kronicdeth/intellij-elixir/blob/main/CONTRIBUTING.md Use this Gradle task to launch an instance of IntelliJ IDEA for development and testing. Refer to the JetBrains documentation for the specific task details. ```bash ./gradlew runIntellijIdea ``` -------------------------------- ### Elixir Bitstring Definition Source: https://github.com/kronicdeth/intellij-elixir/blob/main/base.txt Example of defining a bitstring with type specifications for different parts. This syntax is used for low-level binary manipulation. ```Elixir <>)::binary>> ``` -------------------------------- ### Elixir Map Construction with One Key Per Line Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/map_and_struct_construction_one_key_per_line_after.txt Demonstrates the formatting for constructing a map where each key-value pair is on a new line. This applies to literal map syntax. ```elixir %{ one => %{ three: "four" } } ``` -------------------------------- ### Map with Struct Initialization Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/map_and_struct_compact_empty.txt Shows initializing a map with a struct using compact syntax. ```elixir %{one: %Two{}} ``` -------------------------------- ### Elixir Sigil Concatenation Example Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/sigil_concatenation.txt Demonstrates the concatenation of a variable with a sigil in Elixir. This is useful when dynamically constructing strings using sigils. ```elixir one = ~s"two" <> ~s"three" ``` -------------------------------- ### Elixir Config with Positional and Keyword Arguments Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/no_parentheses_call_positional_and_keyword_wrap_before.txt This snippet shows how to configure a database connection in Elixir using the `config` function. It demonstrates the formatting for calls without parentheses when multiple keyword arguments are provided, requiring line breaks for readability. ```elixir config :retort, Retort.Repo, adapter: Ecto.Adapters.Postgres, database: "retort", hostname: "localhost", password: "postgres", pool: ``` -------------------------------- ### Elixir Kernel and Kernel.SpecialForms Highlighting Source: https://github.com/kronicdeth/intellij-elixir/wiki/Features Configuration for highlighting predefined Elixir functions and macros from Kernel and Kernel.SpecialForms. ```text Kernel functions macros Kernel.SpecialForms macros ``` -------------------------------- ### Interpolated Heredoc Example Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/heredoc_alignment_after.txt Shows an interpolated heredoc with varying indentation. The heredoc content is aligned based on the terminator's indentation. ```Elixir defmodule Example do def my_func do """ Three """ end end ``` -------------------------------- ### Build IntelliJ Elixir Plugin Package Source: https://github.com/kronicdeth/intellij-elixir/blob/main/CONTRIBUTING.md Generate a distributable package (.zip file) for the IntelliJ Elixir plugin. The first command includes tests, while the second excludes them to speed up the build. ```bash # Build with tests ./gradlew build # Or without tests ./gradlew build -x test ``` -------------------------------- ### Create Empty Elixir Module Source: https://github.com/kronicdeth/intellij-elixir/wiki/Features Generates a basic Elixir module with no predefined functions or behavior. Use this for simple modules or as a starting point. ```elixir defmodule MyNamespace.MyModule do @moduledoc false end ``` -------------------------------- ### Empty Map Initialization Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/map_and_struct_compact_empty.txt Shows the compact syntax for initializing an empty map in Elixir. ```elixir %{} ``` -------------------------------- ### Run IntelliJ Community Edition Source: https://github.com/kronicdeth/intellij-elixir/blob/main/CONTRIBUTING.md Instructions for running the Elixir plugin within the IntelliJ Community Edition for testing purposes. ```bash cd /c/Users/steve/IdeaProjects/intellij-elixir/intellij-elixir find gen -type f | xargs dos2unix.exe ``` -------------------------------- ### Unpack Settings JAR Source: https://github.com/kronicdeth/intellij-elixir/blob/main/CONTRIBUTING.md Unpack the exported settings JAR file into a 'settings' directory to access color scheme configurations. ```bash mkdir settings cd settings jar xf $SAVE_DIRECTORY/settings.jar ``` -------------------------------- ### Heredoc with Module Documentation Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/heredoc_alignment_after.txt Demonstrates the alignment of a heredoc used for module documentation. Notice the indentation of each line within the heredoc. ```Elixir defmodule One do @moduledoc """ One Two Three """ end ``` -------------------------------- ### Incorrect Type Specification with '=' Source: https://github.com/kronicdeth/intellij-elixir/blob/main/resources/inspectionDescriptions/MatchOperatorInsteadOfTypeOperator.html This example shows the incorrect usage of the type operator (=) in an Elixir type specification. It should be replaced with the match operator (::). ```elixir @type name = definition ``` -------------------------------- ### Unquoted Capitalized Function Names Source: https://github.com/kronicdeth/intellij-elixir/wiki/Features Functions starting with a capital letter, common in OTP libraries, need to be unquoted to prevent Elixir from parsing them as aliases. ```Elixir unquote(:Capitalized)(p0, ...) ``` -------------------------------- ### Elixir Map Construction with Keyword Pairs Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/map_and_struct_update_one_key_per_line_after.txt Shows the formatting for constructing a map using keyword pairs, where each pair is on a new line. ```elixir %{ one: 1, two: 2 } ``` -------------------------------- ### Elixir Split Function Call Source: https://github.com/kronicdeth/intellij-elixir/blob/main/base.txt A basic example of calling the 'split' function in Elixir. This snippet is likely part of a larger decoding or parsing process. ```elixir split ``` -------------------------------- ### Elixir Stream.filter Example Source: https://github.com/kronicdeth/intellij-elixir/blob/main/base.txt Shows how to use Stream.filter to lazily filter elements from a stream. This is efficient for large datasets as it processes elements one by one. ```Elixir lowers = alphabet |> Stream.filter(fn {:ok, _} -> true _ -> false end) ``` -------------------------------- ### Function Definition with Interpolated Sigil Heredoc Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/heredoc_alignment_after.txt Shows a function definition that uses an interpolated string sigil heredoc. This example highlights the structure of such definitions. ```Elixir def interpolated_string_sigil_heredoc do to_charlist ~s""" ``` -------------------------------- ### Tagging a Release Source: https://github.com/kronicdeth/intellij-elixir/blob/main/RELEASING.md Create an annotated Git tag for the release version and push it to the remote repository, including tags. ```bash git tag -a vVERSION -m "Version VERSION" git push git push --tags ``` -------------------------------- ### Correct Type Specification with '::' Source: https://github.com/kronicdeth/intellij-elixir/blob/main/resources/inspectionDescriptions/MatchOperatorInsteadOfTypeOperator.html This example demonstrates the correct usage of the match operator (::) for Elixir type specifications. This is the preferred and conventional way to define types. ```elixir @type name :: definition ``` -------------------------------- ### Elixir Module Definition with Use and Configuration Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/parser_definition/general_parsing_test_case/Realistic.txt Defines an Elixir module 'Repo' and configures it to use Ecto.Adapters.Postgres. Demonstrates the 'use' macro with keyword arguments. ```elixir defmodule Repo do use Ecto.Adapters.Postgres, adapter: Ecto.Adapters.Postgres end ``` -------------------------------- ### Incorrect Type Specification with Single Colon Source: https://github.com/kronicdeth/intellij-elixir/blob/main/resources/inspectionDescriptions/KeywordPairColonInsteadOfTypeOperator.html This example shows the incorrect usage of a single colon ':' in an Elixir type specification. Replace ':' with '::' for correct syntax. ```elixir @type name: definition ``` -------------------------------- ### Define Application Directory Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/parser_definition/general_parsing_test_case/Realistic.txt Defines the application directory using `defpriv` and `app_dir` with a specific path. ```Elixir defpriv :app_dir, "priv/repo" ``` -------------------------------- ### Heredoc with Single Quotes and Consistent Indentation Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/heredoc_alignment_before.txt This example uses a heredoc with triple single quotes. The content lines are indented consistently, and the terminator aligns with this indentation. ```elixir def charlist do to_string(''' One ''') ``` -------------------------------- ### Basic Tuple Indentation Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/tuple_indent.txt Demonstrates the standard indentation for a multi-line Elixir tuple. ```elixir { \ one, \ two \ } ``` -------------------------------- ### Elixir Map Construction with Keyword Syntax Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/map_and_struct_construction_one_key_per_line_after.txt Illustrates an Elixir map construction using keyword syntax for one of the key-value pairs. This style is often used when keys are atoms. ```elixir %{ one => %{ two: three } } ``` -------------------------------- ### Keywords in Parentheses - Incorrect Spacing Source: https://github.com/kronicdeth/intellij-elixir/blob/main/resources/inspectionDescriptions/NoParenthesesStrict.html This example demonstrates keywords within parentheses with incorrect spacing, which is invalid Elixir syntax. The fix involves removing the space. ```elixir function (key: value) ``` -------------------------------- ### Elixir Corrected Syntax: Keywords at End of List Source: https://github.com/kronicdeth/intellij-elixir/blob/main/resources/inspectionDescriptions/KeywordsNotAtEnd.html This example demonstrates the correct Elixir syntax for handling keyword arguments by placing them at the end of the argument list. ```elixir one.( one, two, three, key: value ) ``` -------------------------------- ### Elixir Map Construction with One Key Per Line Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/map_and_struct_construction_one_key_per_line_before.txt Illustrates the syntax for constructing an Elixir map where each key-value pair is on its own line. This is useful for maps with multiple entries. ```elixir %{ three: four } ``` -------------------------------- ### Create Elixir Supervisor Module Source: https://github.com/kronicdeth/intellij-elixir/wiki/Features Generates an Elixir Supervisor module. It includes `start_link/1` and `init/1` functions to set up child specifications for supervised processes, defaulting to a temporary `:one_for_one` strategy. ```elixir defmodule MyNamespace.MyModule.Supervisor do @moduledoc false use Supervisor def start_link(arg) do Supervisor.start_link(__MODULE__, arg) end def init(arg) do children = [ worker(MyWorker, [arg], restart: :temporary) ] supervise(children, strategy: :one_for_one) end end ``` -------------------------------- ### Elixir Macro Definition Example Source: https://github.com/kronicdeth/intellij-elixir/blob/main/README.md This macro definition in Elixir demonstrates how macros are declared. The compiled BEAM format represents macros with a 'MACRO-' prefix in exported functions. ```elixir defmacro binding(context \\ nil) do in_match? = Macro.Env.in_match?(__CALLER__) for {v, c} <- __CALLER__.vars, c == context do {v, wrap_binding(in_match?, {v, [generated: true], c})} end end ``` -------------------------------- ### Elixir test Live Template Source: https://github.com/kronicdeth/intellij-elixir/wiki/Features Creates a basic test case structure. The cursor jumps to the placeholder for the test description and then to the end of the test body. ```Elixir test "TESTDESC" do END end ``` -------------------------------- ### Tuple Indentation in Function Call Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/tuple_indent.txt Example of tuple indentation within a function call context. The formatter ensures consistent alignment of tuple elements and the closing brace. ```elixir one({ two, three }) ``` -------------------------------- ### Elixir Literal Sigil Heredoc Alignment Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/heredoc_alignment_after.txt Illustrates heredoc alignment with a literal sigil. This example shows basic heredoc usage without specific sigil formatting. ```elixir def literal_sigil_heredoc do ~s""" One Two Three """ end ``` -------------------------------- ### Elixir Struct Construction (One Key Per Line) Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/map_and_struct_construction_one_key_per_line_after.txt This demonstrates the formatting for Elixir structs when each field is defined on a new line. The formatter ensures consistency for struct definitions. ```elixir %{ one: %Two{ three: four } } ``` -------------------------------- ### Map with arguments not wrapped Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/map_construction_arguments_associations_all_wrap_if_any_wraps_before.txt This example demonstrates a map where arguments are not wrapped onto new lines. This occurs when no preceding argument necessitates wrapping, and the 'all_wrap_if_any_wraps_before' rule does not trigger. ```elixir %{ two: 2, three: 3 } ``` -------------------------------- ### Basic List Indentation Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/list_indent.txt Demonstrates the default indentation for a simple list with one element. ```elixir [ three ] ``` -------------------------------- ### Struct Construction with Empty Map Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/map_and_struct_compact_empty.txt Illustrates creating a struct with an empty map as a value, using compact formatting. ```elixir %{one: %Two{}} ``` -------------------------------- ### Elixir Struct Operation with Unaligned Operands Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/align_two_operands_false.txt When 'align_two_operands' is false, Elixir does not align consecutive two-operand operations. This example shows a struct operation where the operands are not aligned vertically. ```elixir %Error{detail: "`%{pointer}` contains quoted integer (`%{integer}`)", } <> "but also excess text (`%{inspect remainder_of_binary}`)` ``` -------------------------------- ### Elixir Struct Construction with One Key Per Line Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/map_and_struct_construction_one_key_per_line_after.txt Illustrates the formatting for constructing a struct where each field is defined on a new line. This uses the map-like syntax for structs. ```elixir %Two{ one: %{ two => "three" } } ``` -------------------------------- ### Map Indentation within Function Calls Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/map_indent.txt Shows how maps are indented when they are the sole argument to a function call without parentheses. This example highlights the structure when a map is passed as an argument. ```Elixir one two %{ three: 3, four: 4 } ``` -------------------------------- ### Run All IntelliJ Elixir Tests Source: https://github.com/kronicdeth/intellij-elixir/blob/main/CONTRIBUTING.md Execute all tests for the IntelliJ Elixir plugin using the Gradle wrapper. This command ensures comprehensive testing of the plugin's functionality. ```bash ./gradlew test ``` -------------------------------- ### Incorrect spacing in Elixir 'receive' block Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/incorrect_spaces_after_after_keyword.txt This snippet shows an example of incorrect spacing within an Elixir 'receive' block, specifically after the 'do' keyword and before the '->' operator in a stab. ```elixir receive do _ -> :flushed end ``` -------------------------------- ### GrammarKit BNF Rule Collision Example Source: https://github.com/kronicdeth/intellij-elixir/blob/main/CONTRIBUTING.md Illustrates a common error in GrammarKit where a rule name and an implemented interface name collide, leading to infinite recursion in the visitor pattern. ```java // BAD: rule "heredoc" implements interface "Heredoc" - visitor generates: // visitHeredoc(ElixirHeredoc) { visitHeredoc(this); } ← infinite recursion! // GOOD: rule "heredoc" implements interface "HeredocLiteral" - visitor generates: // visitHeredoc(ElixirHeredoc) { visitHeredocLiteral(this); } ← safe dispatch ``` -------------------------------- ### Map Indentation with Keyword Pairs Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/map_indent.txt Demonstrates how Elixir formats maps containing keyword pairs, ensuring proper alignment and indentation. ```elixir one = %{ two: 2, three: 3 } ``` -------------------------------- ### Positional Arguments in Parentheses - Incorrect Spacing Source: https://github.com/kronicdeth/intellij-elixir/blob/main/resources/inspectionDescriptions/NoParenthesesStrict.html This example shows a list of positional arguments within parentheses with incorrect spacing, which is not valid Elixir syntax. The solution is to remove the space. ```elixir function (first_positional, second_positional) ``` -------------------------------- ### Empty Parentheses - Incorrect Spacing Source: https://github.com/kronicdeth/intellij-elixir/blob/main/resources/inspectionDescriptions/NoParenthesesStrict.html This example shows the incorrect spacing before parentheses in a function call, which can lead to ambiguity. Remove the space or add outer parentheses if the first argument should be `()`. ```elixir function () ``` -------------------------------- ### Elixir Case Statement with Keyword Arguments Source: https://github.com/kronicdeth/intellij-elixir/blob/main/base.txt Demonstrates a case statement in Elixir, matching against a value and calling a function with keyword arguments. ```Elixir case 2 == 0 do Keyword.get(opts, :case), Keyword.get(opts, :upper) do_decode16(case, ``` -------------------------------- ### Elixir Keyword Call with Options Source: https://github.com/kronicdeth/intellij-elixir/blob/main/base.txt Demonstrates calling a keyword function with specific options. This pattern is common for configuring behavior in Elixir libraries. ```elixir Keyword.get(opts, :padding, true) ``` -------------------------------- ### Elixir Private Function Definition with Arguments Source: https://github.com/kronicdeth/intellij-elixir/blob/main/base.txt Defines a private function `decode_mixed_clauses` that accepts arguments. This example shows a function definition with a `do` block, indicating a more complex body or multiple clauses. ```elixir defp decode_mixed_clauses(first, second) do first_clauses = decode_clauses(first) end ``` -------------------------------- ### Elixir Anonymous Function with Block Syntax (Simple) Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/parser_definition/anonymous_function_parsing_test_case/Block.txt An example of a basic Elixir anonymous function using the 'fn ... end' block syntax. This function calls 'one' and 'two'. ```elixir fn one; two end ``` -------------------------------- ### Elixir Map Construction (One Key Per Line) Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/map_and_struct_construction_one_key_per_line_after.txt Use this format when constructing maps with multiple key-value pairs, and you want each pair on its own line for readability. This is automatically applied by Elixir formatters. ```elixir %{ one: %{ two: three } } ``` -------------------------------- ### Find Function Usages Source: https://github.com/kronicdeth/intellij-elixir/wiki/Features Use this to find all usages of a function. Place the cursor on the function name and activate the action. ```Elixir def hd([h | t]]) do # ... end list = [1, 2, 3] hd(list) ``` -------------------------------- ### Decode Base32 String with Options Source: https://github.com/kronicdeth/intellij-elixir/blob/main/base.txt Demonstrates decoding a Base32 encoded string using `Base.decode32/2` with a `:case` option. The function returns `{:ok, decoded_string}` on success. ```elixir iex> Base.decode32("mzXW6ytBOi=====", case: :mixed) {:ok, "foobar"} ``` -------------------------------- ### Elixir Syntax Error: Keywords Before Positional Arguments Source: https://github.com/kronicdeth/intellij-elixir/blob/main/resources/inspectionDescriptions/KeywordsNotAtEnd.html This example demonstrates the syntax error in Elixir when keyword arguments precede positional arguments in a function call or list. This is invalid syntax. ```elixir one.( one, two positional, key: value, three ) ``` -------------------------------- ### Elixir Try/Rescue Block Formatting Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/incorrect_spaces_after_rescue_keyword.txt Demonstrates the correct formatting for a try/rescue block in Elixir, specifically highlighting the spacing after the 'rescue' keyword. This ensures that the subsequent code is properly aligned and readable. ```elixir try do raises() rescue any -> Logger.error(any) end ``` -------------------------------- ### Decompiled Anonymous Function Name Source: https://github.com/kronicdeth/intellij-elixir/wiki/Features Anonymous functions in BEAM are compiled as named functions. Their names start with '-', followed by the parent function's name, a '/', and a unique scope number. ```elixir defp unquote(:'-MACRO-binding/2-fun-0-')(p0, p1, p2, p3) do # body not decompiled end ``` -------------------------------- ### Basic Bit String Indentation Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/bit_string_indent.txt Demonstrates standard indentation for elements within a bit string literal. ```elixir << one, two >> ``` -------------------------------- ### Elixir Struct Update with Nested Map Update Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/map_and_struct_update_one_key_per_line_after.txt This example shows updating a struct where one of the fields is itself a map that is being updated. It illustrates nested map update syntax within a struct context. ```elixir %One{ two: %Three{ four: five } } ``` -------------------------------- ### Basic Multi-line Elixir List Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/list_indent.txt Demonstrates a standard multi-line list with elements on separate lines, indented for readability. ```elixir [ one, two ] ``` -------------------------------- ### Elixir Anonymous Function with Stab Syntax and Newline Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/anonymous_function_with_single_clause.txt An Elixir anonymous function that takes one argument 'a' and returns 'a'. This example demonstrates the stab arrow syntax with a newline within the function body. ```elixir fn a -> a end ``` -------------------------------- ### Set Code Loading Mode to Embedded Source: https://github.com/kronicdeth/intellij-elixir/blob/main/README.md Configures the release to load all code immediately on boot. This is done by setting the `CODE_LOADING_MODE` environment variable. ```bash CODE_LOADING_MODE=embedded ``` -------------------------------- ### Resolving Ambiguity with Parentheses (Inner Function Keywords) Source: https://github.com/kronicdeth/intellij-elixir/blob/main/resources/inspectionDescriptions/NoParenthesesManyStrict.html This example shows how to resolve ambiguity by adding parentheses around the arguments of the inner function call. This clearly associates the keywords with the inner function. ```elixir # keywords are for inner function outer_function first_outer_argument inner_function( first_inner_argument ambiguous_keyword_key: ambiguous_keyword_value ) ``` -------------------------------- ### Elixir Corrected Syntax: Parentheses Around Expression Source: https://github.com/kronicdeth/intellij-elixir/blob/main/resources/inspectionDescriptions/KeywordsNotAtEnd.html This example shows how to correct the Elixir syntax error by enclosing the expression containing positional and keyword arguments within parentheses, allowing for a mix. ```elixir one.( one two(positional, key: value), three ) ``` -------------------------------- ### Elixir defimpl Live Template Source: https://github.com/kronicdeth/intellij-elixir/wiki/Features Generates a defimpl structure for implementing a protocol for a specific type. The cursor moves to the protocol placeholder, then the type placeholder, and finally to the end of the implementation block. ```Elixir defimpl PROTOCOL, for: TYPE do END end ``` -------------------------------- ### Set Code Loading Mode to Interactive Source: https://github.com/kronicdeth/intellij-elixir/blob/main/README.md Configures the release to load code on-demand as it is needed. This is achieved by setting the `CODE_LOADING_MODE` environment variable. ```bash CODE_LOADING_MODE=interactive ``` -------------------------------- ### Elixir Map with Space After Comma Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/with_space_after_comma.txt This snippet shows a correctly formatted Elixir map where a space is present after the comma separating key-value pairs. This adheres to standard Elixir style guides for improved readability. ```elixir %{ one => 1, two => 2 } ``` -------------------------------- ### Elixir Bitstring and Keyword Pair Source: https://github.com/kronicdeth/intellij-elixir/blob/main/base.txt Demonstrates the parsing of a bitstring and a keyword pair with a bitstring value in Elixir AST. ```elixir UNMATCHED_UNQUALIFIED_NO_ARGUMENTS_CALL( ElixirIdentifierImpl(IDENTIFIER)(24309,24310), ElixirAccessExpressionImpl(ACCESS_EXPRESSION)( ElixirBitStringImpl(BIT_STRING)(24312,24314), ElixirBitStringImpl(BIT_STRING)(24314,24316) ) ) ElixirNoParenthesesKeywordsImpl(NO_PARENTHESES_KEYWORDS)( ElixirNoParenthesesKeywordPairImpl(NO_PARENTHESES_KEYWORD_PAIR)( ElixirKeywordKeyImpl(KEYWORD_KEY)(24319,24321), ElixirAccessExpressionImpl(ACCESS_EXPRESSION)( ElixirBitStringImpl(BIT_STRING)(24323,24325), ElixirBitStringImpl(BIT_STRING)(24325,24327) ) ) ) ``` -------------------------------- ### Elixir Function Call with Keyword Value Heredoc Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/parser_definition/no_parentheses_many_arguments_call_parsing_test_case/KeywordValueCharListHeredoc.txt Demonstrates parsing of an Elixir function call where the arguments are not enclosed in parentheses. This specific example showcases a keyword argument whose value is a heredoc containing a charlist. ```elixir function positional, keyword_key: ''' charList heredoc ''' ``` -------------------------------- ### Elixir Map Construction with Keyword Pair Source: https://github.com/kronicdeth/intellij-elixir/blob/main/testData/org/elixir_lang/formatting/map_and_struct_construction_one_key_per_line_before.txt Illustrates an Elixir map construction using a keyword pair (key: value) for one of the entries, with each entry on a new line. This is common for structs or maps where keys are atoms. ```elixir %{ one => % { two: three } } ```