Skip to content

Commit

Permalink
refactor: qodana cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
themartdev committed Oct 10, 2024
1 parent 7acd814 commit 0c54fa6
Show file tree
Hide file tree
Showing 17 changed files with 12 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ object FsUtils {
return path.exists() && path.isDirectory()
}

fun isValidExe(path: Path): Boolean {
return path.exists() && path.isExecutable()
}

fun detectAsdf(): Path? {
System.getenv("ASDF_DIR")?.let {
if (isValidDir(it)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ import com.intellij.psi.codeStyle.CodeStyleSettings
import com.intellij.psi.codeStyle.CustomCodeStyleSettings

class GleamCodeStyleSettings(container: CodeStyleSettings) :
CustomCodeStyleSettings(GleamCodeStyleSettings::class.java.simpleName, container) {
}
CustomCodeStyleSettings(GleamCodeStyleSettings::class.java.simpleName, container)
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.intellij.formatting.Spacing
import com.intellij.formatting.SpacingBuilder
import com.intellij.psi.formatter.common.AbstractBlock

@Suppress("unused")
class GleamSpacingProcessor(
private val block: AbstractBlock,
context: GleamFormatBlockContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,4 @@ object GleamColors {
val DOT = createTextAttributesKey("GLEAM_DOT", DefaultLanguageHighlighterColors.DOT)
val COMMA = createTextAttributesKey("GLEAM_COMMA", DefaultLanguageHighlighterColors.COMMA)
val OPERATOR = createTextAttributesKey("GLEAM_OPERATOR", DefaultLanguageHighlighterColors.OPERATION_SIGN)
val IMPORT = createTextAttributesKey("GLEAM_IMPORT", DefaultLanguageHighlighterColors.STATIC_FIELD)
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import com.intellij.openapi.startup.ProjectActivity

class GleamStartupActivity : ProjectActivity {
override suspend fun execute(project: Project) {
checkLSP4IJVersion();
checkLSP4IJVersion()
checkLSPEnabled(project)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class GleamLanguageServerFactory : LanguageServerFactory, LanguageServerEnableme

override fun isEnabled(project: Project): Boolean {
if (!validateLSP4IJCompatibility()) {
return false;
return false
}
val settings = GleamServiceSettings.getInstance(project)
if (settings.lspMode != GleamLspMode.ENABLED) {
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class GleamSettingsConfigurable(project: Project) : UiDslUnnamedConfigurable.Sim
val pathItems = detectedGleamPaths.map { PathItem.Value.fromExecutable(it) }
ApplicationManager.getApplication().invokeLater({
gleamPathComboBox.addItems(pathItems)
}, modalityState);
}, modalityState)
}
}

Expand All @@ -120,7 +120,7 @@ class GleamSettingsConfigurable(project: Project) : UiDslUnnamedConfigurable.Sim
val pathItems = detectedErlangPaths.map { PathItem.Value.fromErlangSdk(it) }
ApplicationManager.getApplication().invokeLater({
erlangPathComboBox.addItems(pathItems)
}, modalityState);
}, modalityState)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import com.intellij.util.ui.JBInsets
import javax.swing.JList

abstract class AbstractPathComboBox(
private val project: Project?
protected val project: Project?
) : ComboBox<PathItem>(MutableCollectionComboBoxModel()) {
protected val collectionModel: MutableCollectionComboBoxModel<PathItem>
get() = model as MutableCollectionComboBoxModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory
import com.intellij.openapi.project.Project
import kotlin.io.path.Path

class ErlangPathComboBox(val project: Project) : AbstractPathComboBox(project) {
class ErlangPathComboBox(project: Project) : AbstractPathComboBox(project) {
override fun computeVersionInline(item: PathItem.Value) {
val executable = captureErlang(Path(item.path))
item.version = executable?.version?.toString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory
import com.intellij.openapi.project.Project
import kotlin.io.path.Path

class GleamPathComboBox(val project: Project) : AbstractPathComboBox(project) {
class GleamPathComboBox(project: Project) : AbstractPathComboBox(project) {
override fun computeVersionInline(item: PathItem.Value) {
val executable = captureGleam(Path(item.path))
item.version = executable?.version?.toString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.github.themartdev.intellijgleam.lang

import com.intellij.lang.Language

@Suppress("JavaIoSerializableObjectMustHaveReadResolve")
object GleamLanguage : Language("Gleam") {
override fun getDisplayName(): String = "Gleam"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ private const val STUB_VERSION = 1
object GleamFileElementType : IStubFileElementType<GleamFileStub>("GLEAM_FILE", GleamLanguage) {
override fun getExternalId(): String = "${language.id}.file"

override fun getStubVersion(): Int = super.getStubVersion() + STUB_VERSION
override fun getStubVersion(): Int = super.stubVersion + STUB_VERSION
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,6 @@ val GLEAM_UNKNOWN_BASE = create(UNKNOWN_NUMBER_BASE)

val GLEAM_ANNOTATIONS = create(ANNOTATION_MARK, ANNOTATION_NAME)

val GLEAM_BLOCKS = create(
FUNCTION_BODY,
BLOCK_EXPR,
CASE_EXPR_BODY,
CUSTOM_TYPE_VALUE
)

val GLEAM_OPERATOR = create(
BANG, EQUAL, EQUAL_EQUAL, NOT_EQUAL, VBAR, VBAR_VBAR, AMPER_AMPER, LT_LT, GT_GT, PIPE,
R_ARROW, L_ARROW, DOT_DOT, PLUS, MINUS, STAR, SLASH, LESS, GREATER, LESS_EQUAL, GREATER_EQUAL,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class GleamPsiImplUtil {
companion object {
@JvmStatic
fun getModuleName(gleamModulePath: GleamModulePath): PsiElement {
return gleamModulePath.lastChild;
return gleamModulePath.lastChild
}

@JvmStatic
Expand Down

0 comments on commit 0c54fa6

Please sign in to comment.