Skip to content

Commit

Permalink
Little code fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
WarningImHack3r committed Aug 7, 2024
1 parent 540f0fc commit dc4acfb
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class FileManager(private val project: Project) {
fun deleteFile(file: VirtualFile): Boolean {
return try {
runWriteAction { file.delete(this) }.let { true }
} catch (e: IOException) {
} catch (_: IOException) {
false
}.also {
if (!it) log.warn("Unable to delete file at path ${file.path}")
Expand Down Expand Up @@ -113,7 +113,7 @@ class FileManager(private val project: Project) {
return try {
val deepest = getDeepestFileForPath(filePath)
if (deepest.name == filePath.substringAfterLast('/')) deepest else null
} catch (e: Exception) {
} catch (_: Exception) {
null
}.also {
if (it == null) log.warn("No file found at path $filePath")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.warningimhack3r.intellijshadcnplugin.backend.http
package com.github.warningimhack3r.intellijshadcnplugin.backend.helpers

import com.intellij.openapi.diagnostic.logger
import com.intellij.util.applyIf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.github.warningimhack3r.intellijshadcnplugin.backend.sources
import com.github.warningimhack3r.intellijshadcnplugin.backend.helpers.DependencyManager
import com.github.warningimhack3r.intellijshadcnplugin.backend.helpers.FileManager
import com.github.warningimhack3r.intellijshadcnplugin.backend.helpers.PsiHelper
import com.github.warningimhack3r.intellijshadcnplugin.backend.http.RequestSender
import com.github.warningimhack3r.intellijshadcnplugin.backend.helpers.RequestSender
import com.github.warningimhack3r.intellijshadcnplugin.backend.sources.config.Config
import com.github.warningimhack3r.intellijshadcnplugin.backend.sources.remote.Component
import com.github.warningimhack3r.intellijshadcnplugin.backend.sources.remote.ComponentWithContents
Expand All @@ -15,7 +15,6 @@ import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiFile
import kotlinx.serialization.KSerializer
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonElement
import org.jetbrains.concurrency.runAsync
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.warningimhack3r.intellijshadcnplugin.backend.sources.impl

import com.github.warningimhack3r.intellijshadcnplugin.backend.helpers.FileManager
import com.github.warningimhack3r.intellijshadcnplugin.backend.http.RequestSender
import com.github.warningimhack3r.intellijshadcnplugin.backend.helpers.RequestSender
import com.github.warningimhack3r.intellijshadcnplugin.backend.sources.Source
import com.github.warningimhack3r.intellijshadcnplugin.backend.sources.config.ReactConfig
import com.github.warningimhack3r.intellijshadcnplugin.backend.sources.replacement.ImportsPackagesReplacementVisitor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.warningimhack3r.intellijshadcnplugin.backend.sources.impl

import com.github.warningimhack3r.intellijshadcnplugin.backend.helpers.FileManager
import com.github.warningimhack3r.intellijshadcnplugin.backend.http.RequestSender
import com.github.warningimhack3r.intellijshadcnplugin.backend.helpers.RequestSender
import com.github.warningimhack3r.intellijshadcnplugin.backend.sources.Source
import com.github.warningimhack3r.intellijshadcnplugin.backend.sources.config.SolidConfig
import com.github.warningimhack3r.intellijshadcnplugin.backend.sources.replacement.ImportsPackagesReplacementVisitor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package com.github.warningimhack3r.intellijshadcnplugin.backend.sources.impl

import com.github.warningimhack3r.intellijshadcnplugin.backend.helpers.DependencyManager
import com.github.warningimhack3r.intellijshadcnplugin.backend.helpers.FileManager
import com.github.warningimhack3r.intellijshadcnplugin.backend.helpers.RequestSender
import com.github.warningimhack3r.intellijshadcnplugin.backend.helpers.ShellRunner
import com.github.warningimhack3r.intellijshadcnplugin.backend.http.RequestSender
import com.github.warningimhack3r.intellijshadcnplugin.backend.sources.Source
import com.github.warningimhack3r.intellijshadcnplugin.backend.sources.config.SvelteConfig
import com.github.warningimhack3r.intellijshadcnplugin.backend.sources.remote.ComponentWithContents
Expand All @@ -14,7 +14,6 @@ import com.intellij.openapi.application.runReadAction
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiFile
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.*
import java.nio.file.NoSuchFileException

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.warningimhack3r.intellijshadcnplugin.backend.sources.impl

import com.github.warningimhack3r.intellijshadcnplugin.backend.helpers.FileManager
import com.github.warningimhack3r.intellijshadcnplugin.backend.http.RequestSender
import com.github.warningimhack3r.intellijshadcnplugin.backend.helpers.RequestSender
import com.github.warningimhack3r.intellijshadcnplugin.backend.sources.Source
import com.github.warningimhack3r.intellijshadcnplugin.backend.sources.config.VueConfig
import com.github.warningimhack3r.intellijshadcnplugin.backend.sources.remote.ComponentWithContents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class GitHubErrorReportSubmitter : ErrorReportSubmitter() {
))
consumer.consume(SubmittedReportInfo(SubmittedReportInfo.SubmissionStatus.NEW_ISSUE))
true
} catch (e: Exception) {
} catch (_: Exception) {
consumer.consume(SubmittedReportInfo(SubmittedReportInfo.SubmissionStatus.FAILED))
false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ToolWindowListener(private val project: Project) : ToolWindowManagerListen

override fun stateChanged(toolWindowManager: ToolWindowManager) {
val previousState = isToolWindowOpen
isToolWindowOpen = toolWindowManager.getToolWindow(TOOL_WINDOW_ID)?.isVisible ?: false
isToolWindowOpen = toolWindowManager.getToolWindow(TOOL_WINDOW_ID)?.isVisible == true
if (previousState == false && isToolWindowOpen == true) {
log.info("Tool window was closed and is now open, updating contents")
toolWindowManager.getToolWindow(TOOL_WINDOW_ID)?.contentManager?.getContent(0)?.let {
Expand Down

0 comments on commit dc4acfb

Please sign in to comment.