intellij-elixir

Elixir plugin for JetBrain's IntelliJ Platform (including Rubymine)

OTHER License

Stars
1.8K
Committers
55

Bot releases are visible (Hide)

intellij-elixir - v10.6.0

Published by KronicDeth over 5 years ago

Thanks

  • For reporting that Evaluate was broken in the Debugger for Elixir 1.8 because the private APIs changed.
  • For reporting that the SDK home directory suggestions did not cover Linux Mint.

Changelog

v10.6.0

Enhancements

  • #1492 - Add Linux Mint Erlang and Elixir home paths to SDK home path suggestions. Linux Mint installs to /usr/lib/erlang and /usr/lib/elixir instead of /usr/local/lib/erlang and /usr/local/lib/elixir. - @KronicDeth

Bug Fixes

  • #1491 - @KronicDeth
    • Elixir 1.8 made :elixir.quoted_to_erl/3 private, so in Elixir 1.8+, the debugger needs to inline the private version to maintain < 1.8 and >= 1.8 compatibility.
    • Reformat debugger for Elixir 1.8
intellij-elixir - https://github.com/KronicDeth/intellij-elixir/releases/tag/v10.5.1-pre+20190526023654

Published by KronicDeth over 5 years ago

intellij-elixir - v10.5.1

Published by KronicDeth over 5 years ago

Thanks

Changelog

v10.5.1

Bug Fixes

  • #1483 - @KronicDeth
    • Numerous users have reported that annotation can encounter a StackOverflowError. A reproduction case shows that they are called by Phoenix Web modules where one function containing quote block uses the same module again, such as an admin_view depending on the base view through use App.Web, :view. When the use App.Web, :view is resolving, the defmacro __using__ is re-entered as is the admin_view because there was no tracking of already visited PsiElements. The fix is to track the visited elements and not re-enter the visited elements so that admin_view is skipped and the other call definition clauses can be checked to find view.
intellij-elixir - https://github.com/KronicDeth/intellij-elixir/releases/tag/v10.5.1-pre+20190520204331

Published by KronicDeth over 5 years ago

intellij-elixir - v10.5.0

Published by KronicDeth over 5 years ago

Thanks

Changelog

v10.5.0

Enhancements

  • #1445 - @KronicDeth
    • Replace comparator with Comparator.reverseOrder()
    • The correct home path for kiex is ~/.kiex/elixirs/elixir-VERSION/lib/elixir as that contains the true lib and bin directory, but users may select other directories by mistake, so doing the following adjustments:
      • Adjust bin home path to lib/elixir.
      • Adjust elixirs/elixir-VERSION home path to elixirs/elixir-VERSION/lib/elixir.
  • #1462 - Use reflections to allow saving settings when creating the projects before in 2018.3 and 2019.1 even though the API changed. - @KronicDeth

Bug Fixes

  • #1443 - @KronicDeth
    • In RubyMine, attach OTP applications as separate projects with Elixir facets instead of directly creating ELIXIR_MODULE modules in DirectoryConfigurator. This matches the manual steps of opening the OTP apps as separate directories after opening the root of the project.
      • Mark directories when adding facet
      • Sync libraries when adding facet or attaching to root project. Ensures External Libraries show up for all OTP applications.
    • Convert Small IDE projects with ELIXIR_MODULEs:
      1. Remove ELIXIR_MODULE *.iml files
      2. Remove ELIXIR_MODULE entries root project's modules.xml file.
      3. Lack of modules in project in doOpenProject will trigger DirectoryProjectConfigurators to be run, which will setup the project and run DirectoryConfigurator to attach the apps OTP apps and Elixir facets.
        • Only support automatic attaching multiple OTP apps as separate projects in Rubymine. In IntelliJ normal support for multiple Modules in one Project still works.
  • #1444 - Increase suspect nameSet size to 15 to support geo. geo has 13 String.Chars implementations. - @KronicDeth
  • #1445 - @KronicDeth
    • Remove obsolete SdkType. I keep confusing it with its replacement org.elixir_lang.sdk.elixir.Type!
    • Check that HomePath has ebin paths when validation. Prevents selecting false HomePaths for kiex.
  • #1446 - Adding missing ESpec template. When reviewing #1410 I missed that the template wasn't in resources. 🤦‍♂️ - @KronicDeth
  • #1447 - Ignore targets when calculating Dep path. - @KronicDeth
  • #1448 - Ignore organization when calculating Dep path. - @KronicDeth
  • #1449 - Get view provider document in read action. - @KronicDeth
  • #1450 - Support rebar.config deps that are name only. - @KronicDeth
  • #1456 - Always use containingFile for QualifiableAlias maxScope for getReference. Prevents cache capturing maxScope, which can vary based on invocation. - @KronicDeth
  • #1462 - @KronicDeth
    • Create new project before attaching it in Small IDEs.
      When attaching a directory to a project during startup, saving is disallowed, so the attached directory only has a workspace.xml in its .idea when the attach is attempted. Attaching requires the .idea/*.iml Module file, so the attaching fails, saying the directory is an unsupported format.

      Experimentation showed that manually attaching the directory also did not work, but opening the directory in a separate window, then opening and attaching it again would make the directory have the full project files. To mimic this manual process:

      1. The internals of doOpenProject are copied
      2. A save of the project files is forced, bypassing the normal "startup" save blocker
      3. The project is attached to the root project.

      Tested to work when upgrading from 10.4.0 to 10.5.0-pre in Rubymine when no project was already open.

    • Check if project can be attached instead of if RubyMine
      Although GoLand supports attaching projects, it doesn't work for non-Go projects, so it is also excluded. How the support appears in each non-IntelliJ IDEA is shown below:

      IDE Works?
      Android Studio YES Android Studio is built on top of IntelliJ, so it has full multi-Module support. It is not Small IDE.
      CLion NO No Attach to Project support to multiple module support.
      DataGrip No DataGrip doesn't have a Project View and doesn't support Attach to Project. You can still run tests if you directly open the file.
      GoLand NO Modules show up, but independent projects are not attached as in other Small IDEs, so disabled. In general, the Go settings, like Test Runners always win, so it is recommended to not use GoLand at all for Elixir development.
      PHPStorm YES The projects are listed in Directories. The Languages & Frameworks > Elixir shows all 3 projects. Right-clicking on the marked Test directory will not show the Elixir Run Configuration, Python ones win, but subdirectories and *_test.exs will show up in the context menu.
      PyCharm YES The root project is listed in Project. app/* projects are listed listed as Project Dependencies of the root Project. The Languages & Frameworks > Elixir shows all 3 projects. Right-clicking on the marked Test directory will not show the Elixir Run Configuration, Python ones win, but subdirectories and *_test.exs will show up in the context menu.
      Rider No Solution system is separate from Project system.
      Rubymine YES The projects are listed in Project Structure. The Languages & Frameworks > Elixir shows all 3 projects. Right-clicking on the marked Test directory will not show the Elixir Run Configuration, Python ones win, but subdirectories and *_test.exs will show up in the context menu.
      WebStorm NO No Attach to Project support or multiple module support.
    • Don't count Android Studio as a Small IDE. It includes Project Structure menu with multiple-language, multiple-Module per Project support from IntelliJ.

intellij-elixir - https://github.com/KronicDeth/intellij-elixir/releases/tag/v10.5.0-pre+20190429012348

Published by KronicDeth over 5 years ago

intellij-elixir - https://github.com/KronicDeth/intellij-elixir/releases/tag/v10.5.0-pre+20190429010519

Published by KronicDeth over 5 years ago

intellij-elixir - https://github.com/KronicDeth/intellij-elixir/releases/tag/v10.5.0-pre+20190421140049

Published by KronicDeth over 5 years ago

intellij-elixir - https://github.com/KronicDeth/intellij-elixir/releases/tag/v10.5.0-pre+20190421140021

Published by KronicDeth over 5 years ago

intellij-elixir - https://github.com/KronicDeth/intellij-elixir/releases/tag/v10.5.0-pre+20190419202228

Published by KronicDeth over 5 years ago

intellij-elixir - https://github.com/KronicDeth/intellij-elixir/releases/tag/v10.5.0-pre+20190415014140

Published by KronicDeth over 5 years ago

intellij-elixir - https://github.com/KronicDeth/intellij-elixir/releases/tag/v10.5.0-pre+20190414182350

Published by KronicDeth over 5 years ago

intellij-elixir - https://github.com/KronicDeth/intellij-elixir/releases/tag/v10.5.0-pre+20190414175149

Published by KronicDeth over 5 years ago

intellij-elixir - https://github.com/KronicDeth/intellij-elixir/releases/tag/v10.5.0-pre+20190414170343

Published by KronicDeth over 5 years ago

intellij-elixir - https://github.com/KronicDeth/intellij-elixir/releases/tag/v10.5.0-pre+20190414161107

Published by KronicDeth over 5 years ago

intellij-elixir - https://github.com/KronicDeth/intellij-elixir/releases/tag/v10.5.0-pre+20190413211141

Published by KronicDeth over 5 years ago

intellij-elixir - https://github.com/KronicDeth/intellij-elixir/releases/tag/v10.4.1-pre+20190413020326

Published by KronicDeth over 5 years ago

intellij-elixir - https://github.com/KronicDeth/intellij-elixir/releases/tag/v10.4.1-pre+20190413014801

Published by KronicDeth over 5 years ago

intellij-elixir - https://github.com/KronicDeth/intellij-elixir/releases/tag/v10.4.1-pre+20190412205800

Published by KronicDeth over 5 years ago

intellij-elixir - v10.4.0

Published by KronicDeth over 5 years ago

Thanks

  • For requesting espec support
  • For reporting missing runReadAction

Changelog

v10.4.0

Enhancements

Bug Fixes

  • #1410 - @KronicDeth
    • Only show Run/Debug ExUnit when *_test.exs files exist.
    • Only show Run/Debug ESpec when *_spec.exs files exist.
  • #1415 - Wrap UnqualifiedNoArgumentCall.quote identifier.text in runReadAction. - @KronicDeth
  • #1419 - Fix typos in CONTRIBUTING.md - @nschulzke
  • #1420 - Prevent the module attribute annotator from running in EEx files. - @nschulzke

README Changes

Features

Run/Debug Configurations

mix espec

The mix espec task gets a special type of Run Configuration, Elixir Mix Espec. Using this Run Configuration type instead, of the basic Elixir Mix Run Configuration will cause the IDE to attach a special formatter to mix espec, so that you get the standard graphical tree of Test Results.

The Run pane will show Test Results. If there is a compilation error before or during mix espec, it will be shown as a test failure. If the compilation failure is in a _spec.exs file can it can be inferred from the stacktrace, the compilation error will show up as a test failure in that specific module.

Using graphical formatter

If you override the default formatters you will need to add the following code to your spec_helper.exs.

If you override formatters similar to below

ESpec.configure fn(config) ->
  config.formatters ...
ESpec.configure fn(config) ->
  config.formatters [
      {ESpec.Formatters.Json, %{out_path: "results.json"}},
      {ESpec.Formatters.Html, %{out_path: "results.html"}},
      {ESpec.Formatters.Doc, %{details: true, out_path: "results.txt"}},
      {ESpec.Formatters.Doc, %{details: true, diff_enabled?: false, out_path: "results-no-diff.txt"}},
      {ESpec.CustomFormatter, %{a: 1, b: 2}},
    ]
end

Replace them with code that checks for the graphical formatter TeamCityESpecFormatter and uses only it when available.

ESpec.configure fn(config) ->
  config.formatters(if Code.ensure_loaded?(TeamCityESpecFormatter) do
    [{TeamCityESpecFormatter, %{}}]
  else
    ...
  end)
end
ESpec.configure fn(config) ->
  config.formatters(if Code.ensure_loaded?(TeamCityESpecFormatter) do
    [{TeamCityESpecFormatter, %{}}]
  else
    [
      {ESpec.Formatters.Json, %{out_path: "results.json"}},
      {ESpec.Formatters.Html, %{out_path: "results.html"}},
      {ESpec.Formatters.Doc, %{details: true, out_path: "results.txt"}},
      {ESpec.Formatters.Doc, %{details: true, diff_enabled?: false, out_path: "results-no-diff.txt"}},
      {ESpec.CustomFormatter, %{a: 1, b: 2}},
    ]
  end)
end
Creating mix espce Run Configurations Manually
  1. Run > Edit Configurations...

    Edit Run Configurations

  2. Click +

  3. Select "Elixir Mix ESpec"

    Add New Elixir Mix ESpec

  4. Fill in the "mix espec arguments" with the argument(s) to pass to mix espec. Normally, this will be list of *_spec.exs files, relative to the "Working directory".

    NOTE: Unlike mix test, mix espec does not support directories as arguments.

  5. (Optionally) fill in "elixir arguments" with the arguments to elixir before it runs mix test.

  6. (Optionally) fill in "erl arguments"with the arguments toerlbefore it runselixir`.

  7. Fill in the "Working directory"

    • Type the absolute path to the directory.
    • Select the path using directory picker by clicking the ... button
  8. (Optionally) click the ... button on the "Environment variables" line to add environment variables.

  9. Click "OK" to save the Run Configuration and close the dialog

With the Run Configuration defined you can either Run or Debug the mix especs

Running
  1. Click the Run arrow in the Toolbar to run the mix test task
  2. The Run pane will open showing the Test Results
    Test Results
Debugging
  1. (Optionally) before debugging, customize the modules that will be interpreted.
    1. Run > Edit Configurations...
    2. Click the "Interpreted Modules" tab next to default "Configuration" tab.
    3. Enable/Disable "Inherit Application Module Filters". Will change the Module Filters show in the below "Do not interpreter modules matching patterns" list.
    4. Uncheck any inherited module filters that you would rather be interpreted and therefore debuggable
    5. Click + to add module filters that are specific to this configuration. This can be useful if you know interpreting a specific module in your project's dependencies or project leads to too much slowdown when debugging or causes the debugger to hang/crash.
    6. Click - to remove configuration-specific module filters added with +. Inherited module filters cannot be removed with -, they can only be disabled by unchecking.
  2. For how to use the debugger, including how to set breakpoints see the Debugger section.
  3. Click the Debug bug in the Toolbar to debug the mix tests

While you can create Elixir Mix ESpec run configurations manually using the Run > Edit Configurations... menu, it is probably more convenient to use the context menu.

Creating mix espec 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 and contains or is a *_spec.exs file(s)

  1. In the Project pane, ensure your OTP application's espec directory is marked as a Test Sources Root
  2. Check if the espec 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
  3. Right-click the test directory.
  4. 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.

      Mark Directory As > Unmark as Test Sources Root

    • If "Test Sources Root" is shown, then the directory need to be configured by clicking that entry

      Mark Directory As > Test Sources Root

Creating/Running mix espec Run Configurations from directory
  1. Right-click the directory in the Project pane

  2. Click "Run Mix ExUnit", which will both create the Run Configuration and Run it.

    Run Mix ESpec

    • If you want to only create the Run Configuration, select "Create Mix ESpec" instead

Alternatively, you can use keyboard shortcuts

  1. Select the directory in the Project pane.
  2. Ctrl+Shift+R will create the Run Configuration and Run it.
Creating/Running mix espec Run Configurations from file
  1. Right-click the file in the Project pane
  2. Click "Run Mix ESpec", which will both create the Run Configuration and Run it.
    • If you want to only create the Run Configuration, select "Create Mix ESpec" instead

Alternatively, you can use keyboard shortcuts

  1. Select the directory in the Project pane.
  2. Ctrl+Shift+R will create the Run Configuration and Run it.

Finally, you can use the editor tabs

  1. Right-click the editor tab for the test file you want to run

    Run Mix ESpec

  2. Click "Run Mix ESpec", which will both create the Run Configuration and Run it.

    • If you want to only create the Run Configuration, select "Create Mix ESpec" instead
Creating/Running mix espec 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

  1. Right-click a line in the test file

    Run Mix ESpec

  2. Click "Run Mix ESpec", which will both create the Run Configuration and Run it.

    • If you want to only create the Run Configuration, select "Create Mix ESpec" instead

Alternatively, you can use keyboard shortcuts

  1. Place the cursor on the line you want to test
  2. Ctrl+Shift+R will create the Run Configuration and Run it.