KronicDeth
IntelliJ Elixir - Elixir plugin for JetBrain's IntelliJ Platform
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine)
This is a plugin that adds support for Elixir to JetBrains IntelliJ IDEA platform IDEs (DataGrip, AppCode, IntelliJ IDEA, PHPStorm, PyCharm, Rubymine, WebStorm).
It works with the free, open source Community edition of IntelliJ IDEA in addition to the paid JetBrains IDEs like Ultimate edition of IntelliJ. No feature is locked to a the paid version of the IDEs, but the plugin works best in IntelliJ because only IntelliJ supports projects with different languages than the default (Java for IntelliJ, Ruby for Rubymine, etc).
The plugin itself is free. Once you have your IDE of choice installed, you can install this plugin.
Trending in Announcing
You may know https://ui.shadcn.com/, a UI component library for React. I really love it’s design style and components. I’ve built some co...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
The Chelekom project is a library of Phoenix and LiveView components generated via Mix tasks to fit developer needs seamlessly.
One of i...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
Introducing AshStorage! Attachment and file management that slots directly into your resources :smiling_face_with_sunglasses:
I had hope...
New
Other Trending Topics
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
We want to introduce a new native datatype to Erlang: native records. Although replacing all tuple records with native records is not our...
New
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
Introduction
Founded in 2017 by landscape ecologist and fire mitigation expert Harry Statter, Frontline developed the first fully integra...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #elixirconf-us
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex











First 10 of 110 Posts!
KronicDeth
Thanks
isVariableCallDefinitionClause(Call)needed between error handling to avoid aNullPointerException:in type specs could break the highlighting, which led to the inspections and quick fixes in this release.Changelog
v4.7.0
Enhancements
CommonProgramParametersPanelto 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 theCommonProgramParametersPanel.CommonProgramParametersPanelexpects 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”. - @KronicDethenclosingMacroCallreturns enclosing macro call when parent isElixirDoBlock, so thatendelement goes to the macro call.Navigate > Testwill go to the Module that has the same canonical name as the currentdefimpl,defmodule,defprotocol, orquotewith aTestsuffix addedNavigate > Test Subjectwill go to thedefimpl,defmodule,defprotocol, orquotethat has the same canonical name as the current Module with theTestsuffix removed.:is used instead of::for a type specification, mark it as an error with a Quick Fix to convert:to::.=operands the same as::operands in type specifications.=is used instead of::in a type specification, mark it as an error with a Quick Fix to convert=to::.Bug Fixes
myRunInModuleChekcBox=>myRunInModuleCheckBox- @KronicDethElixirMultipleAliasesforisVariablebecauseElixirMultipleAliasescan be hit inisVariablewhenMyAlias.is added on a line above a pre-existing tuple, such as when typing a new qualified call. - @KronicDethVirtualFileis not null before creating attachment becausePsiFilecan lack aVirtualFileif thePsiFileonly exists in memory. - @KronicDethCallDefinitionClause(Call)toCallDefinitionClause.fromCall(Call), so thatnullcan be returned whenCallDefinitionClause.enclosingModular(Call)returnsnull. - @KronicDethfunctionNameinstead ofgetNamewhen multiresolving unqualified functions becausegetNamewill return the Alias when called ondefmodule.maybeQualifiedCallToModularreturnednullBOTH (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, likeFile.read!returnednullbecauseFilecould not be resolved to a modular. RemovemaybeqQualifiedToModularand callqualifiedToModularwhenmyElementis qualified. If the modular isnull, then return an emptyResolveResult[]instead of looking for unqualified matches.maxScopetoModulereference.maxScopeis generally the containing file for the element, but when usingModuleto resolveimports, it is theimportcall’s parent element, so that the resolve doesn’t ricochet between thedefmoduleand its child, theimportcall untilStackOverflowError.LocalSearchScope.EMPTY, the same as interpolation. - @KronicDethElixirSystemUtil.getProcessOutputalready allowed for an empty, invalidProcessOutputwhen theworkDirwasn’t a directory, so allow it to also benulland return the emptyProcessOutput. - @KronicDeth:as a type for::README Changes
Inspections
Keyword pair colon (
:) used in type spec instead of type operator (::)Type specifications separate the name from the definition using
::.Replace the
:with::Match operator (
=) used in type spec instead of type operator (::)Type specifications separate the name from the definition using
::.Replace the
=with::Quick Fixes
Convert
:to::in type specsIf 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 specsIf a type specification uses
=instead of::, then hit Alt+Enter on the=to change it to::and fix the type spec.Run Configurations
mix testThe
mix testtask gets a special type of Run Configuration,Elixir Mix ExUnit. Using this Run Configuration type instead, of the basicElixir MixRun Configuration will cause the IDE to attach a special formatter tomix test, so that you get the standard graphical tree of Test ResultsCreating
mix testRun Configurations Manuallymix test. Normally, this will be a directory liketest, relative to the “Working directory”...button...button on the “Environment variables” line to add environment variables.mix testtaskWhile you can create
Elixir Mix ExUnitrun configurations manually using theRun > Edit Configurations...menu, it is probably more convenient to use the context menu.Creating
mix testRun Configurations from contextThe 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.
testdirectory is marked as a Test Sources Roottestdirectory 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 menutestdirectory.* 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 testRun Configurations from directoryAlternatively, you can use keyboard shortcuts
Ctrl+Shift+Rwill create the Run Configuration and Run it.Creating/Running
mix testRun Configurations from fileAlternatively, you can use keyboard shortcuts
Ctrl+Shift+Rwill create the Run Configuration and Run it.Finally, you can use the editor tabs
Creating/Running
mix testRun Configurations from lineIf you want to be able to run a single test, you can create a Run Configuration for a line in that test
Alternatively, you can use keyboard shortcuts
Ctrl+Shift+Rwill create the Run Configuration and Run it.Installation
Inside IDE using JetBrains repository
Inside IDE using Github releases
In browser
In IDE
KronicDeth
Thanks
A.{B, C}) support. Special thanks to Alexander Merkulov (@merqlove) for guilting me to support this Elixir 1.2 (!) feature that I knew about since September 2015 after he let me know not having it broke parsing on over half his code and for supplying test repositories.PsiElements werenull, as can happen with error handling recovery.isParameterfailedmix --versionoutput changed AGAIN for Elixir 1.3. Thanks to Christian Meter (@n2o), Gonzalo Gabriel Jiménez Fuentes (@mendrugory), Roeland (@r03), Serhij Korochanskyj (@webzepter) for confirming the fixed worked in the Canary build.Match#processDeclarations.Changelog
v4.1.0
Enhancements
do endblocks to fold todo: ...->operator and the right operand to fold to-> ...@doc,@moduledocand@typedocvalue to fold to"...".alias,import,require, oruseto be followed to a singlealias,import,require, orusefollowed by....@doc,@specanddef,defp,defmacro, anddefmacrop(call definition clauses) of the same name and arity range. Arity range will be used if one of the call definition clauses uses default arguments.@forfolds to the resolved module name indefimpl@protocolfolds to the protocol name indefimplmixandelixirversion parsing. - @KronicDethgenfolder using Grammar Kit 1.4.1 and fix some bugs (including JetBrains/Grammar-Kit#126) manually.QualifiedBracketOperationandUnqualifiedBracketOperationextendBracketOperation, so thatBracketOperationcan be used to match both when the qualification does not matter. - @KronicDethRegenerate parser with GrammarKit 1.4.2
ElixirSdkReleaseis nowComparable, so version checks can be done for tests to restrict them to Elixir 1.2+ for multiple alias support.Resolve Multiple Aliases with unqualified Alias in tuples.
canonicalNameborrows from the idea ofPsiReference#canonicalText: an element can have both a Name (fromgetName), which is the literal name in the code, which can be renamed, and a Canonical Name, which is the name to refer to the element without need for imports or aliases. For this change,defimpl,defmodule, anddefprotocolwill show their full module Alias for their Canonical Name.This change addresses the use case of Go To Declaration that should resolved to a nested
defmodule.Bug Fixes
parameterisnullbeforeVariable#executecall inVariable#execute(PsiElement[], ResolveState). - @KronicDethisVariableandvariableUseScopeforvar!(name)[...]- @KronicDeth@foris no longer marked as unresolved indefimpland instead resolve to the either the<name>infor: <name>or the module name for the enclosing module whenfor:is not given.@protocolis no longer marked as unresolved indefimpland instead resolve to the<name>indefimpl <name>.assert checkRight || checkLeftinMatch#processDeclaraions, do the normal code ifcheckRight || checkLeftand log an error report otherwise, so that the exact code that trigger this error can be reported and the method fixed to handle that form ofMatchlater.mix --version, so that it includes the Erlang header (Erlang/OTP ... [erts-...] [source] [64-bit] [smp:..:..] [async-threads:..] [hipe] [kernel-poll:false] [dtrace]) on the first line andMix <version>on the 3rd line. Previously the parsing expectedMix <version>to be the first line.doblock or keyword. This allows Go To Symbol to no error in projects using Dogma asdefruleis now treated as Unknown instead of causing an error that the enclosing modular could not be found.BracketOperationsare neither parameters nor variables. - @KronicDethmixoutput, which allows file looks to work correctly.PsiScopeProcessor#executesince#executeis not expected to handle error elements. - @KronicDethA.{B, C}to grammar with quoting to check consistence with Elixir 1.2. Ports elixir-lang/elixir#3666.fullyQualifiedNameinstead ofgetNameforresolvableNamebecausefullyQualifiedNameis needed so that qualified aliases inside of the{ }of a multiple alias will not have a name asgetNameisnullfor those qualified aliases because the name fromgetNamehas to be a literal name that can be renamed and qualified names can’t be renamed.Moduleicon got the same icon asUnknownwhen creatingUnknownsomehow, I assume due to find-replace. - @KronicDethREADME Updates
Code Folding
You can collaspe (fold) pre-defined regions of your Elixir code to make it easier to quickly scroll through files or hide details you don’t care about right now.
Controls
Collapsing
Expanding
Regions
do enddo: ...->and right operand-> ...@doc VALUE@doc "..."@moduledoc VALUE@moduledoc "..."@typedoc VALUE@typedoc "..."alias ALIAS1
alias ...import ALIAS2
import ...require ALIAS2
require ...use ALIAS2
use ALIAS1@forFORindefimpl PROTOCOL, for: FOR@protocolPROTOCOLindefimpl PROTOCOL, for: FOR@MODULE_ATTRIBUTE VALUEInstallation
Inside IDE using JetBrains repository
Inside IDE using Github releases
In browser
In IDE
KronicDeth
v4.5.0 was a canary release, so it’s release notes are included in this general release in case you didn’t run the canary
Thanks
NullPointerExceptionfromorg.elixir_lang.psi.scope.call_definition_clause.Variants.getLookupElementCollection.StackOverflowErrors from certain forms ofwithand helping me narrow down specific minimal reproduction cases.dofordoblocks.ElixirNoParenthesesStricterror handling, which revealed thatisVariabledidn’t handle it correctly.Prefix.primaryArgumentswasn’t usingNormalizedand still was using basicasserts.doendmatching was too aggressive and incorrectly matched on one liners starting at thedo:.Changelog
v4.6.0
Enhancements
Qualified#qualifierby extracting it fromCallDefinitionClauseCompletionProvider.Modularclass with#forEachCallDefinitionClauseNameIdentifierto enumerate all the identifiers that could be linked to in a modular.ElixirPsiImplUtil#maybeQualifiedCallToModularby extractingresolveFullyfromCallDefinitionClauseCompletionProviderArrowinterface for*ArrowOperations.Bug Fixes
emptySetwhenlookupElementByPsiElementisnull. - @KronicDethDon’t do a naked
assertthat there are 2 children because this can fail during error recovery on the operand, instead use theprefix.Normalized.operand()throughprefix.operand().WARNING: This changes the
@NotNullarray so that its sole element changes from@NotNullto@Nullable. It may trigger new bugs.GeneratedParserUtilBase.DUMMY_BLOCKbecause theDUMMY_BLOCKMUST match theGeneratedParserUtilBaseto detect dummy blocks inserted for error handling. - @KronicDethElixirNoParenthesesStrictforisVariable- @KronicDethdoindoBlock- @KronicDethdoorfntoendwhen used as a keyword key. - @KronicDethiterator.atEnd()before callingiterator.getTokenType()to avoidIndexOutOfBoundsexception.When#leftOperandwill returnnull(because it’s normalized) if there are left-hand error elements, but when stripping guards we want best-effort to match human expectations, so don’t use normalizednull, but use left, non-error element if it is unique. - @KronicDethQualifiedNoParenthesesCall- @KronicDethnamefor aCallDefinitionClauselookup renderer can be longer thanpresentableText, so still log an error, but withLogger.error, so we getname,presentableText, and the originalelement. - @KronicDethArgumentselements inpreviousParentExpresionto eliminate an unnecessary level of processing declarations since calls will enter their arguments.ENTRANCEinResolveStateinvariable.MultiResolve.resolveResultList, so that caller can override the default value.ENTRANCEtomatchAncestorinstead of previous expression to eliminate the looping that occurred when a variable was unbound (or a function) because the check forwith(andfor) was expecting theENTRANCEto be the previous child expression instead of thewithclause as a whole (or theArgumentselement as had been the case before 6fcc19b).Call#resolvedFunctionNamebecauseimportcan’t rename functions.BracketOperations as they occur when putting maps or structs in front of lists. - @KronicDethEnum.eachthe same asEnum.maparounddef- @KronicDethresolvedFinalArityby1for piping. - @KronicDethimportimport MyModuleimportstatementimport MyModule, only: [name: arity]importstatementimport MyModule, except: [name: arity]if reference is notname/arity.importstatementv4.5.0
Enhancements
.beamfile, such as the standard library will not resolve.).beamfile, such as the standard library will not complete.)()after the name in preparation for Elixir 1.4 where it is an error to have bare function calls. It also makes it more obvious that you inserted a function and not a variable.README Changes
Completion
Function and Macro Calls
Completion uses the same presentation as Structure, so you can tell whether the name is function/macro (Time), whether it is public/private (Visibility) and the Module where it is defined. Between the icons and the Modules is the name itself, which is highlighted in bold, the parameters for the call definition follow, so that you can preview the patterns required for the different clauses.
Qualified
Qualified functions and macro calls will complete using those functions and macros defined in the qualifying Module (
defmodule), Implementation (defimpl) or Protocol (defprotocol). Completion starts as shown as.is typed after a qualifying Alias.Unqualified
Function and macro calls that are unqualified are completed from the index of all function and macro definitions, both public and private. (The index contains only those Elixir functions and macro defined in parsable source, such as those in the project or its dependencies. Erlang functions and Elixir functions only in compiled
.beamfiles, such as the standard library will not complete.) Private function and macros are shown, so you can choose them and then make the chosen function or macro public if it is a remote call.Go To Declaration
Function or Macro
You’ll know if function or macro usage is resolved and Go To Declaration will work if the call is annotated, which in the default themes will show up as italics.
Imported Functions or Macros
Cmd+BCmd+Clickimportthat imported the function or macro or jumping directly to the function or macro definition clause. Select which declaration you want.EnterClickLocal Functions or Macros
Cmd+BCmd+Clickimportthat imported the function or macro or jumping directly to the function or macro definition clause. Select which declaration you want.EnterClickRemote Functions or Macros
Cmd+BCmd+Clickimportthat imported the function or macro or jumping directly to the function or macro definition clause. Select which declaration you want.EnterClickInstallation
Inside IDE using JetBrains repository
Inside IDE using Github releases
In browser
In IDE
sztosz
@KronicDeth Hi i can’t seem to find how to autocomplete builtin modules and functions from them, like Enum, List etc. How can I turn it on?
KronicDeth
From the changelog:
only those defined in parseable-Elixir source. Erlang functions and Elixir function only in compiled .beam file, such as the standard library will not complete
So, you aren’t missing anything. The features don’t work on the standard modules because they leverage the .ex/.exs parser currently.
KallDrexx
Is there anyway to set a code style specific for Elixir code files?
When I installed this and went to Settings → Code style it does not show Elixir in the list of languages. Elixir is the only language that tries to force me in the 2 space indention that I dislike, but I really don’t feel like fighting things like doctests :-/.
OvermindDL1
That could be changed though, you can pull call information out of the module_info callback. The atom elixir plugins use that to provide autocomplete (so, consequently, autocomplete does not work until at least one compile is done). A mixing of the two styles would be great for both completeness and up-to-date’ness. ^.^
KronicDeth
I’m aware how Alchemist and atom-elixir does completion (with a fork of alchemist-server). It’s just a matter of time and I find using the OpenAPI tools better because the IDE knows how to cache the index and can jump to specific clauses and around errors while alchemist-server (correct me if I’m mistaken) needs at least the file to be error free because it’s using Elixir runtime to reflect on the
.beam.Now that the parseable-code Go To Declaration is complete I’m left with the
.beams, but I don’t necessarily have to solve that with alchemist-server. Other solutions:I like (2) because it means the IDE doesn’t have to run an external process, which requires getting its environment correct too, but it would require more tightly understanding the internal .beam format. (3) isn’t a complete solution because only reflection will get a complete listing when a lot of macro indirection is involved or in the bootstrapped parts of the standard-lib, but it would be cool to have the
.beamdissassembler built-in the way it in for Java in IntelliJ.KronicDeth
The Elixir plugin does not support Code Style or Formatting yet. There’s are open issue for Code Style (Code Style Settings · Issue #99 · KronicDeth/intellij-elixir · GitHub) and Formatter (Code Formatter · Issue #98 · KronicDeth/intellij-elixir · GitHub).
You really should try to get used to 2 space indent in Elixir. It’s the idiomatic indentation for Elixir and part of the community style guide (GitHub - christopheradams/elixir_style_guide: A community driven style guide for Elixir · GitHub).
OvermindDL1
Erlangs JInterface is pretty awesome, low level but awesome.
Each version of erlang can change that, so be careful.
Last Post!
KronicDeth
Version 17.0.0
Historical One-time/Monthly Donations:
Changelog
v17.0.0
Breaking changes
Enhancements
Bug Fixes
displayNameinplugin.xmlfor configurables for faster menu loading.org.elixir_lang.facet.configurable.Project- “Elixir”org.elixir_lang.facets.sdks.erlang.Configurable- “Internal Erlang SDKs”org.elixir_lang.facets.sdks.elixir.Configurable- “SDKs”Installation Instructions