generated from JetBrains/intellij-platform-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Suppress GoLand unused function warning on API
* Refactor annotator for code sharing with new component * Update Gradle and dependencies * Bump JDK to 17 to match official guidance * Minor cleanups (ignored files, unused imports and variables) * Bump version to 0.3.0
- Loading branch information
Showing
7 changed files
with
73 additions
and
46 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
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
30 changes: 30 additions & 0 deletions
30
src/main/kotlin/dev/encore/intellij/inspections/ApiUnusedSuppressor.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,30 @@ | ||
package dev.encore.intellij.inspections | ||
|
||
import com.goide.psi.GoFunctionDeclaration | ||
import com.intellij.codeInspection.InspectionSuppressor | ||
import com.intellij.codeInspection.SuppressQuickFix | ||
import com.intellij.psi.PsiComment | ||
import com.intellij.psi.PsiElement | ||
import com.intellij.psi.util.PsiTreeUtil | ||
import dev.encore.intellij.annotators.ApiDecls.Companion.isApiAnnotation | ||
|
||
class ApiUnusedSuppressor : InspectionSuppressor { | ||
companion object { | ||
private const val TOOL_ID = "GoUnusedExportedFunction" | ||
} | ||
|
||
override fun isSuppressedFor(element: PsiElement, toolId: String): Boolean { | ||
if (element !is GoFunctionDeclaration || toolId != TOOL_ID) { | ||
return false | ||
} | ||
val prevElement = PsiTreeUtil.skipWhitespacesBackward(element) | ||
if (prevElement !is PsiComment) { | ||
return false | ||
} | ||
val comment: PsiComment = prevElement | ||
return isApiAnnotation(comment) | ||
} | ||
|
||
override fun getSuppressActions(element: PsiElement?, toolId: String) = SuppressQuickFix.EMPTY_ARRAY!! | ||
|
||
} |
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