Module

Code

Changes by version

Elixir 1.19.0

· 6 changes

Enhancement Tool: Elixir

Add :migrate_call_parens_on_pipe formatter option

Enhancement Tool: Elixir

Add :indentation option to Code.string_to_quoted/2

Bugfix Tool: Elixir

Return error on invalid unicode sequences in Code.string_to_quoted/2 instead of raising

Bugfix Tool: Elixir

Properly handle column annotation for in in not in expressions

Hard Deprecation Tool: Elixir

Warn if line-break characters outside of \r and \r\n are found in strings according to UX#55. This warning will be fast-tracked into an error for security reasons in Elixir v1.20, following a similar rule to bidirectional control characters. They will already raise if found in comments

Hard Deprecation Tool: Elixir

The on_undefined_variable: :warn is deprecated. Relying on undefined variables becoming function calls will not be supported in the future

Elixir 1.18.0

· 5 changes

Enhancement Tool: Elixir

Support several migration options in Code.format_string!/2

Enhancement Tool: Elixir

Add parenthesis around -- and --- in Code.format_string!/2 to make precedence clearer

Enhancement Tool: Elixir

Include more metadata in Code.string_to_quoted/2 when token_metadata: true to help compute ranges from the AST

Bugfix Tool: Elixir

Fix delimiter metadata for single quoted atoms and remote calls in Code.string_to_quoted/2

Hard Deprecation Tool: Elixir

Setting :warnings_as_errors is deprecated via Code.put_compiler_option/2. This must not affect developers, as the :warnings_as_errors option is managed by Mix tasks, and not directly used via the Code module

Elixir 1.17.0

· 2 changes

Enhancement Tool: Elixir

Support cursor inside fn/rescue/catch/else/after inside Code.Fragment.container_cursor_to_quoted/2

Bugfix Tool: Elixir

Address a bug where AST nodes for (a -> b) were not wrapped as part of the literal encoder

Elixir 1.16.2

· 2 changes

Enhancement Tool: Elixir

Emit :defmodule tracing event on module definition

Bugfix Tool: Elixir

Fix charlist formatting issue when a single-quoted charlist escapes a double-quote character

Elixir 1.16.1

· 1 change

Bugfix Tool: Elixir

Fix Code.quoted_to_algebra/2 for operator with :do key as operand

Elixir 1.16.0

· 4 changes

Enhancement Tool: Elixir

Add :emit_warnings for Code.string_to_quoted/2

Enhancement Tool: Elixir

Automatically include columns in parsing options

Enhancement Tool: Elixir

Introduce MismatchedDelimiterError for handling mismatched delimiter exceptions

Bugfix Tool: Elixir

Keep quotes for atom keys in formatter

Elixir 1.15.6

· 2 changes

Bugfix Tool: Elixir

Fix formatter for nested * in bitstrings

Bugfix Tool: Elixir

Improve feedback when an invalid block is given Code.quoted_to_algebra/2

Elixir 1.15.3

· 1 change

Bugfix Tool: Elixir

Ensure with_diagnostics propagate warnings from inner Erlang passes

Elixir 1.15.1

· 1 change

Enhancement Tool: Elixir

Code.string_to_quoted/2 honors :static_atoms_encoder for multi-letter sigils

Elixir 1.15.0

· 5 changes

Enhancement Tool: Elixir

Code.format_string!/2 now converts 'charlists' into ~c"charlists" by default

Enhancement Tool: Elixir

Add :on_undefined_variable to the compiler options to preserve the warning behaviour which was deprecated back in Elixir v1.4

Enhancement Tool: Elixir

Add Code.loaded?/1 and Code.ensure_all_loaded(!)/1

Enhancement Tool: Elixir

Add Code.prepend_paths/1, Code.append_paths/1, and Code.delete_paths/1

Enhancement Tool: Elixir

Add Code.with_diagnostics/2 to return diagnostics when compiling and evaluating code

Elixir 1.14.4

· 1 change

Enhancement Tool: Elixir

Properly handle blocks with comments in all cases in Code.quoted_to_string_with_comments/2

Elixir 1.14.2

· 1 change

Enhancement Tool: Elixir

Add Code.eval_quoted_with_env/4 with support for the :prune_binding option

Elixir 1.14.0

· 6 changes

Enhancement Tool: Elixir

Add :normalize_bitstring_modifiers to Code.format_string!/2

Enhancement Tool: Elixir

Emit deprecation and type warnings for invalid options in on Code.compile_string/2 and Code.compile_quoted/2

Enhancement Tool: Elixir

Warn if an outdated lexical tracker is given on eval

Enhancement Tool: Elixir

Add Code.env_for_eval/1 and Code.eval_quoted_with_env/3

Enhancement Tool: Elixir

Improve stacktraces from eval operations on Erlang/OTP 25+

Bugfix Tool: Elixir

Do not emit warnings when formatting code

Elixir 1.13.4

· 2 changes

Enhancement Tool: Elixir

Allow iodata to be returned in sigil formatting functions

Enhancement Tool: Elixir

Pass opening delimiter information to sigil formatting functions

Elixir 1.13.3

· 1 change

Bugfix Tool: Elixir

Fix duplicate bindings causing errors during evaluation

Elixir 1.13.2

· 1 change

Bugfix Tool: Elixir

Do not emit warnings on Code.Fragment.container_cursor_to_quoted/2

Elixir 1.13.1

· 1 change

Bugfix Tool: Elixir

Do not show code snippets in SyntaxError and TokenMissingError if line is empty

Elixir 1.13.0

· 9 changes

Enhancement Tool: Elixir

Add Code.string_to_quoted_with_comments/2 and Code.quoted_to_algebra/2

Enhancement Tool: Elixir

Add more :token_metadata to aliases and remote calls when parsing strings

Enhancement Tool: Elixir

Add Code.Fragment module to provide best-effort information from code fragments. The module currently provides an updated Code.Fragment.cursor_context/2 with operator support and Code.Fragment.surround_context/2 which looks at a given position in a fragment and find its surrounding delimiters

Enhancement Tool: Elixir

Allow custom sigil formatting on Code.format_string!/2

Enhancement Tool: Elixir

Add {:on_module, bytecode, :none} trace to compilation tracers

Bugfix Tool: Elixir

Make sure :static_atoms_encoder in Code.string_to_quoted/2 also applies to quoted keyword keys

Bugfix Tool: Elixir

Ensure bindings with no context are returned as atoms instead of {binding, nil} in eval operations

Enhancement Tool: Elixir

Environment options in Code.eval_quoted/3 and Code.eval_string/3, such as :aliases and :tracers, have been deprecated in favor of passing an environment

Enhancement Tool: Elixir

Code.cursor_context/2 is deprecated, use Code.Fragment.cursor_context/2 instead

Elixir 1.12.3

· 1 change

Bugfix Tool: Elixir

Make sure that bindings in the default context returned by Code.eval_* functions are not returned as tagged tuples

Elixir 1.12.1

· 1 change

Bugfix Tool: Elixir

Make sure Code.format_string!/2 formats multiline expression inside interpolation on the first run

Elixir 1.12.0

· 4 changes

Enhancement Tool: Elixir

Add Code.cursor_context/2 to return the context of a code snippet

Enhancement Tool: Elixir

Do not add newlines around interpolation on code formatting. Note this means formatted code that has interpolation after the line length on Elixir v1.12 won't be considered as formatted on earlier Elixir versions

Enhancement Tool: Elixir

Do not add brackets when keywords is used in the access syntax

Enhancement Tool: Elixir

Improve evaluation performance on systems running on Erlang/OTP 24+

Elixir 1.11.3

· 1 change

Bugfix Tool: Elixir

Do not raise when checking for operator ambiguity when :static_atoms_encoder is set in Code.string_to_quoted

Elixir 1.11.2

· 1 change

Bugfix Tool: Elixir

Do not crash when getting docs for missing erts appdir

Elixir 1.11.1

· 1 change

Bugfix Tool: Elixir

Ignore tracers if lexical tracker is dead or explicitly nil when evaling code with an environment

Elixir 1.11.0

· 3 changes

Enhancement Tool: Elixir

Add :column to Code.string_to_quoted*/2

Enhancement Tool: Elixir

Add Code.can_await_module_compilation?/0 to check if the parallel compiler is enabled and it can await for other modules to be compiled

Bugfix Tool: Elixir

Do not send language keyword through the :static_atoms_encoder in Code.string_to_quoted

Elixir 1.10.3

· 2 changes

Bugfix Tool: Elixir

Return [{mod, bin}] from Code.compile_file/2, Code.require_file/2, Code.load_file/2

Bugfix Tool: Elixir

Make sure the formatter respects newlines before and after module attributes

Elixir 1.10.1

· 1 change

Bugfix Tool: Elixir

Do not emit invalid code when formatting nil, false, and true keys in maps

Elixir 1.10.0

· 7 changes

Enhancement Tool: Elixir

Add :token_metadata and :literal_encoder support to Code.string_to_quoted/2

Enhancement Tool: Elixir

Add compiler tracing to lift events done by the compiler

Enhancement Tool: Elixir

Return {:error, :unavailable} in Code.ensure_compiled/1 if module is in a deadlock

Enhancement Tool: Elixir

compiler_options/0 is deprecated in favor of compiler_option/1

Enhancement Tool: Elixir

Code.load_file/2 has been deprecated in favor of Code.require_file/2 or Code.compile_file/2

Enhancement Tool: Elixir

Code.loaded_files/0 and Code.unload_file/1 have been deprecated in favor of Code.required_files/0 and Code.unrequire_file/1 respectively

Enhancement Tool: Elixir

Code.ensure_compiled?/1 is deprecated in favor of Code.ensure_compiled/1

Elixir 1.9.1

· 1 change

Bugfix Tool: Elixir

Fix formatter wrongly removing nested parens in nested calls

Elixir 1.9.0

· 5 changes

Enhancement Tool: Elixir

Add static_atom_encoder option to Code.string_to_quoted/2

Enhancement Tool: Elixir

Support :force_do_end_blocks on Code.format_string!/2 and Code.format_file!/2

Enhancement Tool: Elixir

Do not raise on deadlocks on Code.ensure_compiled/1

Bugfix Tool: Elixir

Quote :: in Code.format_string!/1 to avoid ambiguity

Bugfix Tool: Elixir

Do not crash formatter on false positive sigils

Elixir 1.7.0

· 8 changes

Enhancement Tool: Elixir

Add Code.compile_file/2 that compiles files without leaving footprints on the system

Enhancement Tool: Elixir

Add Code.purge_compiler_modules/0 that purges any compiler module left behind. This is useful for live systems dynamically compiling code

Enhancement Tool: Elixir

Add Code.fetch_docs/1 that returns docs in the EEP 48 format

Bugfix Tool: Elixir

Ensure string_to_quoted returns error tuples instead of raising in certain constructs

Enhancement Tool: Elixir

Deprecate Code.load_file/2 in favor of Code.compile_file/2

Enhancement Tool: Elixir

Deprecate Code.loaded_files/0 in favor of Code.required_files/0

Enhancement Tool: Elixir

Deprecate Code.unload_files/1 in favor of Code.unrequire_files/1

Enhancement Tool: Elixir

Code.get_docs/2 is deprecated in favor of Code.fetch_docs/1

Elixir 1.6.6

· 1 change

Bugfix Tool: Elixir

Preserve the user's choice when fn is followed by a newline and it has only a single clause

Elixir 1.6.5

· 3 changes

Bugfix Tool: Elixir

Preserve the user's choice in the formatter on parens call with next break fits

Bugfix Tool: Elixir

Preserve the user's choice in the formatter on calls without parens when we have one argument per line

Bugfix Tool: Elixir

Fix formatting when there is a tilde in the first element of a bitstring

Elixir 1.6.0

· 2 changes

Enhancement Tool: Elixir

Add format_string!/2 and format_file!/2 for automatic code formatting

Enhancement Tool: Elixir

Support column annotations in quoted expressions with columns: true in Code.string_to_quoted/2

Elixir 1.1.0

· 2 changes

Bugfix Tool: Elixir

:delegate_locals_to failed to delegate to the chosen module in many situations and messed up stacktraces. This option has therefore been replaced by imports

Bugfix Tool: Elixir

Store the documentation line in the metadata returned by Code.get_docs/2

Elixir 0.13.2

· 1 change

Enhancement Tool: Elixir

Ensure we don't lose the caller stacktrace on code evaluation

Elixir 0.13.0

· 1 change

Enhancement Tool: Elixir

Add Code.eval_file/2

Elixir 0.11.0

· 1 change

Enhancement Tool: Elixir

Eval now returns variables from other contexts