Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
refactor(lsp/java): format OverrideSuperclassMethods action class
Browse files Browse the repository at this point in the history
  • Loading branch information
itsaky committed Jul 21, 2023
1 parent ee18012 commit 52d401d
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import com.itsaky.androidide.lsp.java.utils.FindHelper
import com.itsaky.androidide.lsp.java.utils.JavaParserUtils
import com.itsaky.androidide.lsp.java.utils.MethodPtr
import com.itsaky.androidide.lsp.java.visitors.FindTypeDeclarationAt
import com.itsaky.androidide.models.Position
import com.itsaky.androidide.preferences.internal.tabSize
import com.itsaky.androidide.preferences.utils.indentationString
import com.itsaky.androidide.projects.ProjectManager
Expand All @@ -61,6 +62,7 @@ import java.util.concurrent.CompletableFuture
* @author Akash Yadav
*/
class OverrideSuperclassMethodsAction : BaseJavaCodeAction() {

override val titleTextRes: Int = R.string.action_override_superclass_methods
override val id: String = "lsp_java_overrideSuperclassMethods"
override var label: String = ""
Expand All @@ -72,10 +74,10 @@ class OverrideSuperclassMethodsAction : BaseJavaCodeAction() {

if (
!visible ||
!data.hasRequiredData(
com.itsaky.androidide.models.Range::class.java,
CodeEditor::class.java
)
!data.hasRequiredData(
com.itsaky.androidide.models.Range::class.java,
CodeEditor::class.java
)
) {
markInvisible()
return
Expand Down Expand Up @@ -175,7 +177,8 @@ class OverrideSuperclassMethodsAction : BaseJavaCodeAction() {
}

CompletableFuture.runAsync { overrideMethods(data, checkedMethods) }
.whenComplete { _, error,
.whenComplete {
_, error,
->
if (error != null) {
log.error("An error occurred overriding methods")
Expand Down Expand Up @@ -257,7 +260,7 @@ class OverrideSuperclassMethodsAction : BaseJavaCodeAction() {
data: ActionData,
sb: StringBuilder,
imports: MutableSet<String>,
position: com.itsaky.androidide.models.Position,
position: Position,
) {
val compiler =
JavaCompilerProvider.get(ProjectManager.findModuleForFile(data.requireFile()) ?: return)
Expand Down

0 comments on commit 52d401d

Please sign in to comment.