-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
show declearingCLass for enumValues when showing inlay hints
- Loading branch information
Showing
9 changed files
with
42 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/main/java/com/intellij/plugins/haxe/ide/hint/types/HaxeSharedBypassCollector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.intellij.plugins.haxe.ide.hint.types; | ||
|
||
import com.intellij.codeInsight.hints.declarative.PresentationTreeBuilder; | ||
import com.intellij.codeInsight.hints.declarative.SharedBypassCollector; | ||
import com.intellij.plugins.haxe.model.type.ResultHolder; | ||
import com.intellij.plugins.haxe.model.type.SpecificEnumValueReference; | ||
import kotlin.Unit; | ||
import kotlin.jvm.functions.Function1; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public abstract class HaxeSharedBypassCollector implements SharedBypassCollector { | ||
|
||
@NotNull | ||
protected static Function1<PresentationTreeBuilder, Unit> appendTypeTextToBuilder(ResultHolder type) { | ||
return builder -> { | ||
builder.text(":" + getPresentationText(type), null); | ||
return null; | ||
}; | ||
} | ||
|
||
|
||
protected static String getPresentationText(ResultHolder returnType) { | ||
// we dont want to show enumValues as type info in inlays as its not an assignable type. | ||
if (returnType.getType() instanceof SpecificEnumValueReference enumValueReference) { | ||
return enumValueReference.getEnumClass().toPresentationString(); | ||
}else { | ||
return returnType.getType().toPresentationString(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters