-
Only favor same file Module resolutions if they are valid
Invalid same file results can occur for prefix matches, but if only prefix matches are available, then a whole project search should occur instead of only when there are no same file ResolveResult of either validity.
-
Include library sources in Module#multiResolveProject GlobalSearchScope
Ensures that library sources can be returned, which are favored over decompiled libraries, so that __using__ macros can be followed.
-
Protect from Module reference element not having a VirtualFile when checking if a test file.
-
Fix QualifiableAliasImpl#fullyQualifiedName
- Include qualifier of
MultipleAliases
In an alias line like alias Myapp.MyContext.{Schema1, Schema2}, Schema1 would think its fullyQualifiedName was only Schema1, when it should included the fullyQualifiedName of the qualifier, MyApp.MyContext too. This leads to the correct Schema1 fully-qualified name of MyApp.MyContext.Schema1. This fix makes references to Schema1 resolve to both the alias and the defmodule.
- Include qualifier of
MultipleAliases for deep aliases
In an alias line like alias Myapp.MyContext.{NestedContext1.Schema1, NestedContext2.Schema2}, Schema1 would think its fullyQualifiedName was only NestedContext1.Schema1, when it should included the fullyQualifiedName of the qualifier, MyApp.MyContext too. This leads to the correct Schema1 fully-qualified name of MyApp.MyContext.NestedContext.Schema1. This fix makes references to Schema1 resolve to both the alias and the defmodule.
-
In LEEx Templates
- Don’t check for implicit imports at top of template file if there is a view file
The implicit imports should come last, after the view file has been processed.
- Ignore call definition clauses expressions that can’t contain an assign
- Atom keywords (
false, true, nil)
- Maps
- Structs
- Keyword lists
- Strings and charlists
- Don’t follow variables for assigns
For now, don’t follow variables to look for assigns.
- Fix finding assigns in
|> case do ... end
None calls were ignored, but when case is used in a pipeline it is a None since it has no literal arguments and only resolved arguments, so it was being ignored.
- Ignore Lists and Aliases when resolving assigns
- Fix resolve assigns in
ifs
Only looked in stab of the doBlock, but the else is in the blockList.
-
Don’t use the same path for actual aliases and defmodules when resolving aliases
Prevents a case of an exact match and its namespace both being marked as valid (exact matches).
-
Types
- Don’t generate references for map key optionality (
required/1 and optional/1)
- Don’t create a reference to
... in lists in type specs.
- Look above
ElixirStabBody for ancestorTypeSpec.
- Generate
Callable reference for unquote in typespec instead of Type reference.
-
Allow modular names to resolve to multiple modulars
Fix :systemd.ready() not resolving because :systemd only exists as a decompiled file from source because it is Erlang and there is no preference given to different MIX_ENVs. All MIX_ENV defmodule :systemd are returned for the :systemd and all of them are checked for ready/0.
-
Fix resolving qualified calls that are defined through use
Resolving qualified calls only used Modular.callDefinitionClauseCallFoldWhile, which ignores all non call definition, which means it ignored the use, but switching to use org.elixir_lang.psi.scope.call_definition_clause.MultiResolve PsiScopeProcessor used for unqualified calls, but starting on the modular call of the qualifier, all the use handling that works for unqualified calls also works for qualified calls now.
This fixes resolving MyAppWeb.Endpoint.config_change(changed, removed) in MyApp.Application.config_change/3 because use Phoenix.Endpoint, otp_app: :my_app in MyAppWeb.Endpoint is now walked for qualified calls.
-
Fix resolving variables to parameters that are both pattern matched and defaulted
In functions like
def f(%Struct{} = s \\ %Struct{}) do
s
end
s in the body would not resolve to the s parameter because the default parameter had to be PsiNamedElement, that is a variable directly. Instead, recurse on any operand before the \\ to support pattern matching too.
-
Use keepProcessing() in MultiResolve.addToResolveResults instead of specific return values
Fixes def in def default_host_flag, do: "--host resolving as an invalid match to default_host_flag instead of search the implicit imports for defmacro def.
-
The nameIdentifier for a defdelegate is the first argument, not the as:
The as: is the name in the to: module only.
-
Fix defdelegate MultiResolve
- I had flipped the head name and
as name for checking for a name match
- I only counted the
defdelegate as matching if the as name as found in to module, but if the head alone is prefixed by the name then the head should be a ResolveResult element even if the to or as can’t be found
- Inside the
to, I only checked if the children were call definition clauses, but this meant that all the for handling was ignored, so start a new resolveResults() for each modular.
-
Fix toModulars not returning all modulars
fullyResolve only touched the first modular.
-
Favor complete valid results over incomplete invalid earlier bindings for variables.
-
Ecto
- Don’t generate reference for
assoc/2 pseudo-function in join(..., _ in assoc(_, _))
-
Fix unaliasing multiple aliases
UnaliasName still assumed that fullyQualifiedName included the qualifier, but it is just the lexical qualifier now.
-
Check for MULTIPLE_ALIASES_QUALIFIER in ResolveState for prefix matches.
Fixes resolving SSH.Key to Foo.SSH.Key when the alias is alias Foo.{SSH, ...}.
-
Ignore type variables in type restrictions when resolving normal variables.
-
Fix withSelf for childExpressions siblingExpressions call
While refactoring the walk, I copied the call for siblings, which shouldn’t included self. Children should include self, or the first expression is missed which showed up as Repo.transaction not being found because transaction is the first def inside an if in Ecto.Repo.__using__'s quote block.
-
Don’t try to resolve keys/fields of a capture.
-
Don’t generate reference for assoc in *join*: .. in assoc(..., ...).
Already worked for join/3 calls, extend to keyword syntax too.
-
Fix resolving references to Modulars when resolved is in BEAM file
The check to see if the resolved was a modular only worked for source elements because it checked if it was a Call, but decompiled modules in BEAM files are ModuleImpls.
-
Fix logic error when ignored pinned variables as declaration sites
The logic was supposed to be that
- If it is pinned, keep searching
- If it is not pinned, check the operation as a Call
… but, the code was operatorText != "^" && execute(match as Call, state) which meant that if the operatorText was "^", then the whole expression was false, which meant keepProcessing was false, so any pin stopped the processing for other unpinned parameters after the pin in addition to processing in the outer scope of the pin.
-
Prefer source only for target candidates for Go To Declaration and not all ResolveResults.
Ensures that functions only defined in decompiled Modules can be found because the Module’s ResolveResults include the decompiled Module in addition to the source ones.
-
Don’t prefer source over decompiled in ResolveResultOrderedSet
Preference is now handled in Resolver, so that source preference only happens on Go To Declaration and not for multiResolve because that needs decompiled Modulars for compile-time for loops that are too complex to infer.
-
Use primary arity instead of final for resolving Callables
Fixes unquote in def unquote(...)() do not resolving.