Remove extra stack arguments setting.

This commit is contained in:
Rik van der Kleij 2019-07-15 20:20:03 +02:00
parent 5f30e4ae36
commit 42238fefca
4 changed files with 4 additions and 29 deletions

View File

@ -29,7 +29,6 @@ import com.intellij.openapi.util.Key
import com.intellij.openapi.vfs.{CharsetToolkit, VfsUtil}
import intellij.haskell.HaskellNotificationGroup
import intellij.haskell.sdk.HaskellSdkType
import intellij.haskell.settings.HaskellSettingsState
import intellij.haskell.stackyaml.StackYamlComponent
import intellij.haskell.util.{HaskellFileUtil, HaskellProjectUtil}
@ -39,15 +38,6 @@ object StackCommandLine {
final val NoDiagnosticsShowCaretFlag = "-fno-diagnostics-show-caret"
private def extraStackArguments: Seq[String] = {
val extraStackArgumentsString = HaskellSettingsState.getExtraStackArguments
if (extraStackArgumentsString.nonEmpty) {
extraStackArgumentsString.split("""\s+""").toSeq
} else {
Seq()
}
}
def stackVersion(project: Project): Option[String] = {
StackCommandLine.run(project, Seq("--numeric-version"), enableExtraArguments = false).flatMap(_.getStdoutLines.asScala.headOption)
}
@ -59,7 +49,7 @@ object StackCommandLine {
project,
workDir.getOrElse(project.getBasePath),
stackPath,
arguments ++ (if (enableExtraArguments) extraStackArguments else Seq()),
arguments,
timeoutInMillis.toInt,
ignoreExitCode = ignoreExitCode,
logOutput = logOutput,
@ -113,7 +103,7 @@ object StackCommandLine {
}
def executeInMessageView(project: Project, commandPath: String, arguments: Seq[String]): Option[Boolean] = {
val cmd = CommandLine.createCommandLine(project.getBasePath, commandPath, arguments ++ extraStackArguments)
val cmd = CommandLine.createCommandLine(project.getBasePath, commandPath, arguments)
(try {
Option(cmd.createProcess())
} catch {

View File

@ -23,15 +23,11 @@ import com.intellij.ui.DocumentAdapter
import javax.swing._
import javax.swing.event.DocumentEvent
import scala.language.{existentials, reflectiveCalls}
class HaskellConfigurable extends Configurable {
private var isModifiedByUser = false
private val hlintOptionsField = new JTextField
private val replTimeoutField = new JTextField
private val replTimeoutLabel = new JLabel("Changed timeout will take effect after restarting project")
private val extraStackArgumentsField = new JTextField
private val extraStackArgumentsLabel = new JLabel("Space separated options")
override def getDisplayName: String = {
"Haskell"
@ -52,7 +48,6 @@ class HaskellConfigurable extends Configurable {
hlintOptionsField.getDocument.addDocumentListener(listener)
replTimeoutField.getDocument.addDocumentListener(listener)
extraStackArgumentsField.getDocument.addDocumentListener(listener)
class SettingsGridBagConstraints extends GridBagConstraints {
@ -92,10 +87,8 @@ class HaskellConfigurable extends Configurable {
}
addLabeledControl(1, HlintOptions, hlintOptionsField)
addLabeledControl(2, ReplTimout, replTimeoutField)
addLabeledControl(2, ReplTimeout, replTimeoutField)
addLabeledControl(3, "", replTimeoutLabel)
addLabeledControl(4, ExtraStackArguments, extraStackArgumentsField)
addLabeledControl(5, "", extraStackArgumentsLabel)
settingsPanel.add(new JPanel(), baseGridBagConstraints.setConstraints(
gridx = 0,
@ -111,7 +104,6 @@ class HaskellConfigurable extends Configurable {
val state = HaskellSettingsPersistentStateComponent.getInstance().getState
state.replTimeout = validREPLTimeout
state.hlintOptions = hlintOptionsField.getText
state.extraStackArguments = extraStackArgumentsField.getText
}
private def validateREPLTimeout(): Integer = {
@ -135,12 +127,10 @@ class HaskellConfigurable extends Configurable {
val state = HaskellSettingsPersistentStateComponent.getInstance().getState
hlintOptionsField.setText(state.hlintOptions)
replTimeoutField.setText(state.replTimeout.toString)
extraStackArgumentsField.setText(state.extraStackArguments)
}
}
object HaskellConfigurable {
final val ReplTimout = "Background REPL timeout in seconds"
final val ReplTimeout = "Background REPL timeout in seconds"
final val HlintOptions = "Hlint options"
final val ExtraStackArguments = "Extra stack arguments"
}

View File

@ -52,6 +52,5 @@ public class HaskellSettingsPersistentStateComponent implements PersistentStateC
public String hlintOptions = "";
public Boolean reformatCodeBeforeCommit = false;
public Boolean optimizeImportsBeforeCommit = false;
public String extraStackArguments = "";
}
}

View File

@ -42,8 +42,4 @@ object HaskellSettingsState {
def setOptimizeImportsBeforeCommit(optimize: Boolean): Unit = {
state.optimizeImportsBeforeCommit = optimize
}
def getExtraStackArguments: String = {
state.extraStackArguments.trim
}
}