Thanks
- Thanks to Jake Becker (@JakeBecker) for adding Mix ExUnit Run Configurations and create from context.
- Thanks to @andyl for requesting Navigate > Test and Navigate > Test Subject as it was a good complement to Jake Becker’s new Mix ExUnit Run Configurations
- Thanks to Alexander Merkulov (@merqlove) for outline the testing workflow that Jack Becker ended up implementing
- Thanks to @davit55 and Matt Briggs (@mbriggs) for confirming that lookup name could exceed the element text and it wasn’t just an artifact of my development environment
- Thanks to @taorg for a full test case to show how MultipleAliases would need to be supported in
isVariable
- Thanks to Josh Taylor (@joshuataylor for posting a screenshot of the bad lookup formatting for variables.
- Thanks to Matt Briggs (@mbriggs) for posting an error about the error reporter
- Thanks to Josh Taylor (@joshuataylor, Matt Briggs (@mbriggs), Cris (@crisonyx), @sngyai, @lucdang, Cris (@crisonyx), Sven Marquardt (@Eiamnacken), and Aaron Eikenberry (@aeikenberry) for reporting that
CallDefinitionClause(Call)
needed between error handling to avoid a NullPointerException
- Thanks to Matt Briggs (@mbriggs) for posting the source for a reproduction-case for the StackOverflow that was plaguing @andshape, Robert Hencke (@rhencke), Alexander Merkulov (@merqlove), @fieldinrain, Roman (@roman462), Andrei Dziahel (@develop7), and Josué Henrique Ferreira da Silva (@josuehenrique)
- Thanks to Tiziano Puppi (@tizpuppi) for demonstrating how a typing a typo could cause an error in variable use scope.
- Thanks to nsm (@nsmuffin) for posting that working directory being null wasn’t treated the same as not being a directory.
- Thanks to Ryan Scheel (@Havvy for showing how missing a
:
in type specs could break the highlighting, which led to the inspections and quick fixes in this release.
Changelog
v4.7.0
Enhancements
-
#523 - Use the
CommonProgramParametersPanel
to get the working directory and environment variables the same way the JUnit form does. Replace the custom “Command” input with the “Program arguments” input built into the CommonProgramParametersPanel
. CommonProgramParametersPanel
expects to store the “Program Arguments” in a “ProgramParameters” field, so old run configurations will lose their “Command” option value and it will be migrated to the new “ProgramParameters”. - @KronicDeth
-
#482 - @JakeBecker, @KronicDeth
- Create / Run Mix ExUnit Run Configurations
- Run Configuration from Directory
- Run Configuration from File
- Run Configuration from LIne
- Run Configurations support Common Program Parameters
- Program Arguments
- Working directory
- Environment variables
-
#531 - @KronicDeth
-
enclosingMacroCall
returns enclosing macro call when parent is ElixirDoBlock
, so that end
element goes to the macro call.
-
Navigate > Test
will go to the Module that has the same canonical name as the current defimpl
, defmodule
, defprotocol
, or quote
with a Test
suffix added
-
Navigate > Test Subject
will go to the defimpl
, defmodule
, defprotocol
, or quote
that has the same canonical name as the current Module with the Test
suffix removed.
-
#533 - Regression test for #500 - @KronicDeth
-
#545 - Regression test for #517 - @KronicDeth
-
#548 - Regression test for #521 - @KronicDeth
-
#549 - @KronicDeth
- Regression test for #525
- If
:
is used instead of ::
for a type specification, mark it as an error with a Quick Fix to convert :
to ::
.
- Highlight
=
operands the same as ::
operands in type specifications.
- If
=
is used instead of ::
in a type specification, mark it as an error with a Quick Fix to convert =
to ::
.
Bug Fixes
-
#523 - Fix typo:
myRunInModuleChekcBox
=> myRunInModuleCheckBox
- @KronicDeth
-
#532 - Don’t log error when name length exceeds presentable text length because it appears to be common for normal users and not a development environment artifact. - @KronicDeth
-
#533 - Check parent of
ElixirMultipleAliases
for isVariable
because ElixirMultipleAliases
can be hit in isVariable
when MyAlias.
is added on a line above a pre-existing tuple, such as when typing a new qualified call. - @KronicDeth
-
#534 - Add space between variable and match in lookup element presentation - @KronicDeth
-
#535 - Check
VirtualFile
is not null before creating attachment because PsiFile
can lack a VirtualFile
if the PsiFile
only exists in memory. - @KronicDeth
-
#537 - Convert
CallDefinitionClause(Call)
to CallDefinitionClause.fromCall(Call)
, so that null
can be returned when CallDefinitionClause.enclosingModular(Call)
returns null
. - @KronicDeth
-
#539 - @KronicDeth
- Use
functionName
instead of getName
when multiresolving unqualified functions because getName
will return the Alias when called on defmodule
.
-
maybeQualifiedCallToModular
returned null
BOTH (1) if the call was unqualified OR (2) if the call was qualified, but its modular could not be resolved, so qualified calls to .beam
-only modules, like File.read!
returned null
because File
could not be resolved to a modular. Remove maybeqQualifiedToModular
and call qualifiedToModular
when myElement
is qualified. If the modular is null
, then return an empty ResolveResult[]
instead of looking for unqualified matches.
- Pass
maxScope
to Module
reference. maxScope
is generally the containing file for the element, but when using Module
to resolve import
s, it is the import
call’s parent element, so that the resolve doesn’t ricochet between the defmodule
and its child, the import
call until StackOverflowError
.
-
#545 - A variable cannot be declared in update arguments, so return
LocalSearchScope.EMPTY
, the same as interpolation. - @KronicDeth
-
#548 -
ElixirSystemUtil.getProcessOutput
already allowed for an empty, invalid ProcessOutput
when the workDir
wasn’t a directory, so allow it to also be null
and return the empty ProcessOutput
. - @KronicDeth
-
#549 - @KronicDeth
- If a single keyword pair is used for a type spec, treat
:
as a type for ::
- Limit variable use scope for variables “declared” in module attributes to the module attribute because the variable can’t be declared there and it is really a variable usage without declaration.
README Changes
Inspections
Keyword pair colon (:
) used in type spec instead of type operator (::
)
Type specifications separate the name from the definition using ::
.
@type name: definition
Replace the :
with ::
@type name :: definition
Match operator (=
) used in type spec instead of type operator (::
)
Type specifications separate the name from the definition using ::
.
@type name = definition
Replace the =
with ::
@type name :: definition
Quick Fixes
Convert :
to ::
in type specs
If a type specification uses a single :
instead of ::
, then hit Alt+Enter on the :
to change it to ::
and fix the type spec.
Convert =
to ::
in type specs
If a type specification uses =
instead of ::
, then hit Alt+Enter on the =
to change it to ::
and fix the type spec.
Run Configurations
mix test
The mix test
task gets a special type of Run Configuration, Elixir Mix ExUnit
. Using this Run Configuration type instead, of the basic Elixir Mix
Run Configuration will cause the IDE to attach a special formatter to mix test
, so that you get the standard graphical tree of Test Results
Creating mix test
Run Configurations Manually
- Run > Edit Configurations…
- Click +
- Select “Elixir Mix ExUnit”
- Fill in the “Program arguments” with the argument(s) to pass to
mix test
. Normally, this will be a directory like test
, relative to the “Working directory”
- 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.
- Click “OK” to save the Run Configuration and close the dialog
- Click the RUn arrow in the Toolbar to run the
mix test
task
- The Run pane will open showing the Test Results
While you can create Elixir Mix ExUnit
run configurations manually using the Run > Edit Configurations...
menu, it is probably more convenient to use the context menu.
Creating mix test
Run Configurations from context
The context menu must know that the the directory, file, or line you are right-clicking is a test. It does this by checking if the current directory or an ancestor is marked as a Test Sources Root.
- In the Project pane, ensure your OTP application’s
test
directory is marked as a Test Sources Root
- Check if the
test
directory is green. If it is, it is likely a Test Sources Root. This color may differ in different themes, so to be sure you can check the context menu
- Right-click the
test
directory.
- Hover over “Mark Directory As >”
* If "Unmark as Test Sources Root" is shown, then the directory is already configured correctly, and create from context will work.
* If "Test Sources Root" is shown, then the directory need to be configured by clicking that entry
Creating/Running mix test
Run Configurations from directory
- Right-click the directory in the Project pane
- Click “Run Mix ExUnit”, which will both create the Run Configuration and Run it.
- If you want to only create the Run Configuration, select “Create Mix ExUnit” instead
Alternatively, you can use keyboard shortcuts
- Select the directory in the Project pane.
-
Ctrl+Shift+R
will create the Run Configuration and Run it.
Creating/Running mix test
Run Configurations from file
- Right-click the file in the Project pane
- Click “Run Mix ExUnit”, which will both create the Run Configuration and Run it.
- If you want to only create the Run Configuration, select “Create Mix ExUnit” instead
Alternatively, you can use keyboard shortcuts
- Select the directory in the Project pane.
-
Ctrl+Shift+R
will create the Run Configuration and Run it.
Finally, you can use the editor tabs
- Right-click the editor tab for the test file you want to run
- Click “Run Mix ExUnit”, which will both create the Run Configuration and Run it.
- If you want to only create the Run Configuration, select “Create Mix ExUnit” instead
Creating/Running mix test
Run Configurations from line
If you want to be able to run a single test, you can create a Run Configuration for a line in that test
- Right-click a line in the test file
- Click “Run Mix ExUnit”, which will both create the Run Configuration and Run it.
- If you want to only create the Run Configuration, select “Create Mix ExUnit” instead
Alternatively, you can use keyboard shortcuts
- Place the cursor on the line you want to test
-
Ctrl+Shift+R
will create the Run Configuration and Run it.
Installation
Inside IDE using JetBrains repository
- Preferences
- Plugins
- Browse Repositories
- Select Elixir
- Install plugin
- Apply
- Restart the IDE
Inside IDE using Github releases
In browser
- Go to releases.
- Download the lastest zip.
In IDE
- Preferences
- Plugins
- Install plugin from disk…
- Select the downloaded zip.
- Apply
- Restart the IDE.