Skip to content

Commit

Permalink
fix: do not use features that are internal in future versions (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
SirYwell authored Nov 14, 2024
1 parent e86af05 commit e3c391b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,12 @@ jobs:
path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides
key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}

# Run Verify Plugin task and IntelliJ Plugin Verifier tool
- name: Run Plugin Verification tasks
# Run Verify Plugin task
- name: Run Plugin Verification task
run: ./gradlew verifyPlugin -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
- name: Run IntelliJ Plugin Verifier task
run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
# and IntelliJ Plugin Verifier tool

# Collect Plugin Verifier Result
- name: Collect Plugin Verifier Result
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pluginGroup = de.sirywell.handlehints
pluginName = HandleHints
pluginRepositoryUrl = https://github.com/SirYwell/HandleHints
# SemVer format -> https://semver.org
pluginVersion = 0.3.0
pluginVersion = 0.3.1

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 233
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.intellij.platform.backend.documentation.DocumentationTarget
import com.intellij.platform.backend.presentation.TargetPresentation
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiIdentifier
import com.intellij.refactoring.suggested.createSmartPointer
import com.intellij.psi.SmartPointerManager
import de.sirywell.handlehints.TypeData

@Suppress("UnstableApiUsage")
Expand All @@ -18,8 +18,9 @@ class TypeDocumentationTarget(private val identifier: PsiIdentifier, private val
}

override fun createPointer(): Pointer<out DocumentationTarget> {
val idPointer = identifier.createSmartPointer()
val elPointer = element.createSmartPointer()
val pointerManager = SmartPointerManager.getInstance(identifier.project)
val idPointer = pointerManager.createSmartPsiElementPointer(identifier)
val elPointer = pointerManager.createSmartPsiElementPointer(element)
return Pointer {
val identifier = idPointer.element ?: return@Pointer null
val element = elPointer.element ?: return@Pointer null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ 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.TypeData
import de.sirywell.handlehints.getVariable
import de.sirywell.handlehints.type.*
Expand All @@ -16,20 +14,20 @@ class TypeInlayHintsCollector : SharedBypassCollector {

override fun collectFromElement(element: PsiElement, sink: InlayTreeSink) {
val (pos, belongsToBefore) = when (element) {
is PsiDeclarationStatement -> (element.getVariable()?.nameIdentifier?.endOffset
?: element.endOffset) to true
is PsiDeclarationStatement -> (element.getVariable()?.nameIdentifier?.textRange?.endOffset
?: element.textRange.endOffset) to true

is PsiAssignmentExpression -> (element.lExpression.endOffset) to true
is PsiAssignmentExpression -> (element.lExpression.textRange.endOffset) to true
is PsiReferenceExpression -> {
// TODO ????
if (element.parent is PsiParameterList) {
element.startOffset to false
element.textRange.startOffset to false
} else {
element.endOffset to true
element.textRange.endOffset to true
}
}

else -> element.endOffset to true
else -> element.textRange.endOffset to true
}
val typeData = TypeData.forFile(element.containingFile)
val type = typeData[element] ?: return
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package de.sirywell.handlehints.mhtype

import com.intellij.refactoring.suggested.startOffset
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import de.sirywell.handlehints.inspection.MethodHandleEditInspection

Expand All @@ -23,7 +22,7 @@ abstract class TypeAnalysisTestBase : LightJavaCodeInsightFixtureTestCase() {

protected fun doTypeCheckingTest(onlyAfterCaret: Boolean) {
val methodHandleTypeHelperInspection =
if (onlyAfterCaret) MethodHandleTypeHelperInspection { it.startOffset > myFixture.caretOffset }
if (onlyAfterCaret) MethodHandleTypeHelperInspection { it.textRange.startOffset > myFixture.caretOffset }
else MethodHandleTypeHelperInspection { true }
myFixture.enableInspections(methodHandleTypeHelperInspection)
myFixture.testHighlighting(false, true, false, getTestName(false) + ".java")
Expand Down

0 comments on commit e3c391b

Please sign in to comment.