Thanks
- Thanks to @gremlinLee, Huy Hoang (@huyh) , Ratan Paul (@RatanPaul) and @anehing for reporting
NoSuchMethod
errors onGeneratedParserUtilBase
, which motivated me to actually ask JetBrains how to fix the problem, where Yann Cébron (@YannCebron) - Thanks to Alexander Merkulov (@merqlove) for opening an issue that Go To Definition didn’t work for aliases as before that the issue was just in my head. Go To Definition (and completion) for Aliased ended up being the primary feature of this release, so thanks Alexander.
- Thanks to Josué Henrique Ferreira da Silva (@josuehenrique) for reporting that Go To Symbol broke on schema metaprogramming in Ecto, which led to support for looking outside Enum.map functions for enclosing modulars.
- Thanks to Robin Hilliard (@robinhilliard) for reporting that unquoting of literal variables (
unquote({name, [], nil})
in type specs was broken - Thanks to Max Baumann (@dudeman) for reproduction case in
DBConnection.Connection.sync_stop/4
for variable resolution not working for pinned variable inreceive
clauses. - Thanks to Filip Haglund (@drathier), Gerard de Brieder (@smeevil), Markus Fischer (@mfn) and Alexander Tovstonozhenko (@alextov) for let me know that users wanted to be able to turn off Module directive (
alias
,import
,require
,user
) folding. - Thanks to Halil Özgür (@halilim) excellent reproduction case for revealing the reason for mystery
isParameter
errors.
Changelog
v4.3.0
Enhancements
-
#387 - Resolve aliased modules to their
alias
call, from the alias call, you can Go To Declaration for the module itself. - @KronicDeth- Code structure
- Module resolution uses the OpenAPI convention of
treeWalkUp
now instead of custom code. - Resolvable names has been extracted to its own class
- Module resolution uses the OpenAPI convention of
- Resolution use cases
-
Suffix
resolves toalias Prefix.Suffix
-
Suffix.Nested
resolves toalias Prefix.Suffix
-
As
resolvesto
alias Prefix.Suffix, as: As` -
NestedSuffix
resolves toalias __MODULE__.NestedSuffix
-
- Code structure
-
#389 - Completion for module aliases - @KronicDeth
- From in-file aliases
__MODULE__
- In project modules (using index already used for Go To Declaration)
-
#393 - In addition to
StubBased#canonicalName
, there now alsoStubBased#canonicalNames
, for when a call defines multiple canonical names, as is the case fordefimpl <PROTOCOL>, for: [<TYPE>, ...]
. - @KronicDeth -
#397 - When a aliased name is added to the module list for completion, it’s unaliased name is searched for in the
AllName
index, if any nested modules are found for the unaliased name, then those nested names are aliased and also shown for completion. - @KronicDeth -
#399 -
resolvableName
allows nested modules under multiple aliases to be completed. - @KronicDeth -
#403 - By user request, the folding will be off-by-default now, but can be re-enabled, like the old behavior by checking the checkbox in Preferences > Editor > General > Code Folding > Elixir Module directive (
alias
,import
,require
oruse
) groups. - @KronicDeth -
#405 - @KronicDeth
- Resolve
as:
aliased name to bothalias
anddefmodule
- Complete modules nested under
as:
aliased name.
- Resolve
-
#409 - @KronicDeth
- Completion and reference tests for aliases:
alias Prefix.Suffix
alias Prefix.Suffix, as: As
alias Prefix.{MultipleAliasA, MultipleAliasB}
- Completion and reference tests for aliases:
Bug Fixes
-
#393 - @KronicDeth
-
defimpl <PROTOCOL>, for: [<TYPE>, ...]
generates multiple canonical names, which are stored in the stub index.- When retrieved from the
AllName
index, thedefimpl
's Implementation will render as if only thedefimpl <PROTOCOL>, for: <TYPE>
was used for the<TYPE>
matching the lookup name in the Goto Symbol dialog. For example, if you search forTuple
,JSX.Encoder.Tuple
will match fordefimpl JSX.Encoder, for: for: [Tuple, PID, Port, Reference, Function, Any]
.
- When retrieved from the
-
-
#400 - @KronicDeth
- Look outside Enum.map for enclosing macro call because
Ecto
defines the clauses of__schema__(:type, ...)
usingEnum.map
, butenclosingMacroCall
only knews to jump over enclosing macros likefor
, so a special case was added for anonymous function given toEnum.map
. - Fix if-else-ordering bug where
Call
appeared before operations (which are usuallyCall
s) likeMatch
.
- Look outside Enum.map for enclosing macro call because
-
#401 - In
@type unquote({name, nil, []}) :: foo
,name
will be highlighted as a type parameter even though it is not strictly the name that will appear as a type parameter. - @KronicDeth -
#405 - @KronicDeth
- Resolve alias nested under aliased modules to both the
alias
anddefmodule
, as resolving to only thealias
loses the nested name, so it wasn’t possible to jump to the nested name’sdefmodule
. - Resolve aliased name to both the
alias
and thedefmodule
, so you can skip jumping to thealias
before jumping to thedefmodule
.
- Resolve alias nested under aliased modules to both the
-
#406 - @KronicDeth
- The generated
ElixirParser
uses theGeneratedParserUtilBase
fromcom.intellij.lang.parser
, but since that version is a synced copy, it is a snapshot ofGeneratedParserUtilBase
from the version of GrammarKit that was current when the IDE was released. To ensure the generated parser works on all the IDEs, I copyGeneratedParserUtilBase
fromorg.intellij.grammar.parser
intoorg.elixir_lang.grammar.parser
and then use that version inElixirParser
. This ensures neither the IDE’s version nor the version in any installed GrammarKit plugin is used.
- The generated
-
#409 - @KronicDeth
- Check that index name maps to an actual project element before returning it for completion as the names from
StubIndex.getInstance.getAllKeys(...)
is a superset of actual keys in the actual project according to Peter Gromov of JetBrains. - Don’t index
canonicalName
if it matches the literal name, as the duplicate name leads to duplicate entries in the completion lookup.-
canonicalNameCollection
was renamed tocanonicalNameSet
(with type changing fromCollection<String>
toSet<String>
to match) to emphasize that the canonical names should be unique, butcanonicalNameSet
itself should still include duplicates of name for those places where only canonical names are used.
-
- Use
resolvableName
for theunaliasedName
forMultipleAliases
Aliases, so that they complete correctly for nested modules. - Completion for nested modules will no longer complete with string suffixes (i.e.
SSHView
) and only complete nested Aliases (i.e.SSH.Key
).
- Check that index name maps to an actual project element before returning it for completion as the names from
README Changes
Completion
Aliases and Modules
When you start typing an Alias, completion will look in three locations:
-
alias
aliased names in the current file
a.Suffix
foralias Prefix.Suffix
b.MultipleAliasA
orMultipleAliasB
foralias Prefix.{MultipleAliasA, MultipleAliasB}
c.As
foralias Prefix.Suffix, as: As
- Indexed module names (as available from Go To Symbol)
a.Prefix.Suffix
fromdefmodule Prefix.Suffix
b.MyProtocol
fromdefprotocol MyProtocol
c.MyProtocol.MyStruct
i.defimpl MyProtocol, for: MyStruct
ii.defimpl MyProtocol
nested underdefmodule MyStruct
- Nested modules under aliased names
a.Suffix.Nested
foralias Prefix.Suffix
wherePrefix.Suffix.Nested
is an indexed module, implementation or protocol name.
b.MultipleAliasA.Nested
foralias Prefix.{MultipleAliasA, MultipleAliasB}
wherePrefix.MultipleAliasA.Nested
alias Prefix.{MultipleAliasA, MultipleAliasB}
is an indexed module, implementation or protocol name.
c.As.Nested
foralias Prefix.Suffix, as: As
wherePrefix.Suffix.Nested
is an indexed module, implementation, or protocol name.
Go To Declaration
Go To Declaration is a feature of JetBrains IDEs that allows you to jump from the usage of a symbol, such as a Module
Alias, to its declaration, such as the defmodule
call.
Alias
- Place the cursor over an Alias with an aliased name setup by
alias
a.Suffix
ifalias Prefix.Suffix
called
b.MultipleAliasA
ifalias Prefix.{MultipleAliasA, MultipleAliasB}
called
c.As
ifalias Prefix.Suffix, as: As
- Activate the Go To Declaration action with one of the following:
a.Cmd+B
b. Select Navigate > Declaration from the menu.
c.Cmd+Click
- A Go To Declaration lookup menu will appear, allowing you to jump either the
alias
that setup the aliased name or jumping directly todefmodule
of the unaliased name. Select which declaration you want
a. Use arrow keys to select and hitEnter
b.Click
Module
- Place the cursor over a fully-qualified Alias
a.A.B
inA.B.func()
b.A.B
inalias A.B
c.B
inalias A.{B, C}
- Activate the Go To Declaration action with one of the following:
a.Cmd+B
b. Select Navigate > Declaration from the menu.
c.Cmd+Click
If you hold Cmd
and hover over the Alias before clicking, the target declaration will be shown.
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.