generated from JetBrains/intellij-platform-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: prepare initial release (#93)
- Loading branch information
Showing
37 changed files
with
170 additions
and
195 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
2 changes: 1 addition & 1 deletion
2
.../methodhandleplugin/MethodHandleBundle.kt → ...irywell/handlehints/MethodHandleBundle.kt
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
43 changes: 43 additions & 0 deletions
43
src/main/kotlin/de/sirywell/handlehints/MethodTypeInlayHintsCollector.kt
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,43 @@ | ||
package de.sirywell.handlehints | ||
|
||
import com.intellij.codeInsight.hints.declarative.InlayTreeSink | ||
import com.intellij.codeInsight.hints.declarative.InlineInlayPosition | ||
import com.intellij.codeInsight.hints.declarative.SharedBypassCollector | ||
import com.intellij.psi.PsiDeclarationStatement | ||
import com.intellij.psi.PsiElement | ||
import com.intellij.psi.PsiParameterList | ||
import com.intellij.psi.PsiReferenceExpression | ||
import com.intellij.refactoring.suggested.endOffset | ||
import com.intellij.refactoring.suggested.startOffset | ||
import de.sirywell.handlehints.type.BotSignature | ||
import de.sirywell.handlehints.type.TopSignature | ||
|
||
class MethodTypeInlayHintsCollector : SharedBypassCollector { | ||
|
||
override fun collectFromElement(element: PsiElement, sink: InlayTreeSink) { | ||
val (pos, belongsToBefore) = when (element) { | ||
is PsiDeclarationStatement -> (element.getVariable()?.nameIdentifier?.endOffset | ||
?: element.endOffset) to true | ||
|
||
is PsiReferenceExpression -> { | ||
// TODO ???? | ||
if (element.parent is PsiParameterList) { | ||
element.startOffset to false | ||
} else { | ||
element.endOffset to true | ||
} | ||
} | ||
|
||
else -> element.endOffset to true | ||
} | ||
val typeData = TypeData.forFile(element.containingFile) | ||
val type = typeData[element] ?: return | ||
// don't print | ||
if (type.signature is TopSignature || type.signature is BotSignature) { | ||
return | ||
} | ||
sink.addPresentation(InlineInlayPosition(pos, belongsToBefore), hasBackground = true) { | ||
text(type.toString()) | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/kotlin/de/sirywell/handlehints/MethodTypeInlayProvider.kt
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,18 @@ | ||
package de.sirywell.handlehints | ||
|
||
import com.intellij.codeInsight.hints.declarative.InlayHintsProvider | ||
import com.intellij.openapi.components.service | ||
import com.intellij.openapi.editor.Editor | ||
import com.intellij.openapi.project.DumbService | ||
import com.intellij.psi.PsiFile | ||
|
||
class MethodTypeInlayProvider : InlayHintsProvider { | ||
|
||
override fun createCollector( | ||
file: PsiFile, | ||
editor: Editor | ||
): com.intellij.codeInsight.hints.declarative.InlayHintsCollector? { | ||
if (file.project.service<DumbService>().isDumb) return null | ||
return MethodTypeInlayHintsCollector() | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...e/sirywell/methodhandleplugin/TriState.kt → ...otlin/de/sirywell/handlehints/TriState.kt
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package de.sirywell.methodhandleplugin | ||
package de.sirywell.handlehints | ||
|
||
enum class TriState { | ||
YES, | ||
|
6 changes: 3 additions & 3 deletions
6
...e/sirywell/methodhandleplugin/TypeData.kt → ...otlin/de/sirywell/handlehints/TypeData.kt
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
2 changes: 1 addition & 1 deletion
2
...l/methodhandleplugin/collectionSupport.kt → ...sirywell/handlehints/collectionSupport.kt
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
4 changes: 2 additions & 2 deletions
4
...eplugin/dfa/MethodHandleElementVisitor.kt → ...lehints/dfa/MethodHandleElementVisitor.kt
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
6 changes: 3 additions & 3 deletions
6
...dleplugin/dfa/MethodHandleTypeResolver.kt → ...ndlehints/dfa/MethodHandleTypeResolver.kt
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
4 changes: 2 additions & 2 deletions
4
.../methodhandleplugin/dfa/MhTypeProvider.kt → ...irywell/handlehints/dfa/MhTypeProvider.kt
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
12 changes: 6 additions & 6 deletions
12
...ell/methodhandleplugin/dfa/SsaAnalyzer.kt → ...e/sirywell/handlehints/dfa/SsaAnalyzer.kt
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
2 changes: 1 addition & 1 deletion
2
...methodhandleplugin/dfa/SsaConstruction.kt → ...rywell/handlehints/dfa/SsaConstruction.kt
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
6 changes: 3 additions & 3 deletions
6
...inspection/MethodHandleMergeInspection.kt → .../inspection/MethodHandleEditInspection.kt
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
2 changes: 1 addition & 1 deletion
2
...sirywell/methodhandleplugin/logSupport.kt → ...lin/de/sirywell/handlehints/logSupport.kt
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
12 changes: 6 additions & 6 deletions
12
...methodhandleplugin/mhtype/LookupHelper.kt → ...rywell/handlehints/mhtype/LookupHelper.kt
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
12 changes: 6 additions & 6 deletions
12
...eplugin/mhtype/MethodHandleTransformer.kt → ...lehints/mhtype/MethodHandleTransformer.kt
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
14 changes: 7 additions & 7 deletions
14
...plugin/mhtype/MethodHandlesInitializer.kt → ...ehints/mhtype/MethodHandlesInitializer.kt
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
14 changes: 7 additions & 7 deletions
14
...andleplugin/mhtype/MethodHandlesMerger.kt → ...handlehints/mhtype/MethodHandlesMerger.kt
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
12 changes: 6 additions & 6 deletions
12
...odhandleplugin/mhtype/MethodTypeHelper.kt → ...ll/handlehints/mhtype/MethodTypeHelper.kt
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
4 changes: 2 additions & 2 deletions
4
...sirywell/methodhandleplugin/psiSupport.kt → ...lin/de/sirywell/handlehints/psiSupport.kt
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
2 changes: 1 addition & 1 deletion
2
...thodhandleplugin/type/MethodHandleType.kt → ...well/handlehints/type/MethodHandleType.kt
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
6 changes: 3 additions & 3 deletions
6
.../methodhandleplugin/type/ParameterList.kt → ...irywell/handlehints/type/ParameterList.kt
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
2 changes: 1 addition & 1 deletion
2
...l/methodhandleplugin/type/PartialOrder.kt → ...sirywell/handlehints/type/PartialOrder.kt
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package de.sirywell.methodhandleplugin.type | ||
package de.sirywell.handlehints.type | ||
|
||
enum class PartialOrder { | ||
LT, | ||
|
Oops, something went wrong.