Skip to content

Commit

Permalink
Always have a FindUsagesProvider#getType
Browse files Browse the repository at this point in the history
All function name elements act as PsiNameIdentifiers now even if they
don't resolve, but that means they all need to support
FindUsagesProvider#getType, which they don't, so use a placeholder of
"unknown call type" for any Call that can't be matched and "unkown
element" for anything else.
  • Loading branch information
KronicDeth committed Mar 31, 2016
1 parent d48302b commit 7228a82
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/org/elixir_lang/FindUsagesProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ public String getHelpId(@NotNull PsiElement psiElement) {
@NotNull
@Override
public String getType(@NotNull final PsiElement element) {
// Intentionally use `null` to trigger `@NotNull` when a new element type is passed.
String type = null;
String type = "unknown element type";

if (element instanceof Call) {
Call call = (Call) element;
Expand Down Expand Up @@ -126,6 +125,8 @@ public String getType(@NotNull final PsiElement element) {
type = "use";
} else if (element instanceof AtUnqualifiedNoParenthesesCall) {
type = "module attribute";
} else {
type = "unknown call type";
}
} else if (element instanceof MaybeModuleName) {
MaybeModuleName maybeModuleName = (MaybeModuleName) element;
Expand All @@ -135,7 +136,6 @@ public String getType(@NotNull final PsiElement element) {
}
}

//noinspection ConstantConditions
return type;
}

Expand Down

0 comments on commit 7228a82

Please sign in to comment.