<commit_before>package scala.tools.eclipse.launching

import scala.collection.mutable
import org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate
import org.eclipse.jdt.launching.JavaRuntime
import org.eclipse.jdt.launching.IRuntimeClasspathEntry
import org.eclipse.jdt.launching.VMRunnerConfiguration
import org.eclipse.jdt.launching.ExecutionArguments
import scala.tools.eclipse.ScalaPlugin
import com.ibm.icu.text.MessageFormat
import org.eclipse.core.runtime.Path
import org.eclipse.core.runtime.CoreException
import org.eclipse.core.runtime.IProgressMonitor
import org.eclipse.core.runtime.NullProgressMonitor
import org.eclipse.debug.core.ILaunch
import org.eclipse.debug.core.ILaunchConfiguration
import scala.tools.eclipse.ui.DisplayThread
import org.eclipse.core.resources.IMarker
import org.eclipse.core.runtime.IProgressMonitor
import org.eclipse.core.runtime.IStatus
import org.eclipse.core.runtime.NullProgressMonitor
import org.eclipse.core.runtime.Path
import org.eclipse.debug.core.ILaunch
import org.eclipse.debug.core.ILaunchConfiguration
import org.eclipse.jdt.internal.launching.LaunchingMessages
import org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate
import org.eclipse.jdt.launching.ExecutionArguments
import org.eclipse.jdt.launching.IRuntimeClasspathEntry
import org.eclipse.jdt.launching.JavaRuntime
import org.eclipse.jdt.launching.VMRunnerConfiguration
import org.eclipse.jface.dialogs.MessageDialog
import scala.collection.JavaConverters

class ScalaLaunchDelegate extends AbstractJavaLaunchConfigurationDelegate {
  /** This code is very heavily inspired from `AbstractJavaLaunchConfigurationDelegate`. */
  def launch(configuration: ILaunchConfiguration, mode: String, launch: ILaunch, monitor0: IProgressMonitor) {

    val monitor = if (monitor0 == null) new NullProgressMonitor() else monitor0

    monitor.beginTask(configuration.getName() + "...", 3)

    if (monitor.isCanceled())
      return

    try {
      monitor.subTask(LaunchingMessages.JavaLocalApplicationLaunchConfigurationDelegate_Verifying_launch_attributes____1)

      val mainTypeName = verifyMainTypeName(configuration)
      val runner = getVMRunner(configuration, mode)

      val workingDir = verifyWorkingDirectory(configuration)
        val workingDirName = if (workingDir != null) workingDir.getAbsolutePath() else null

      // Environment variables
      val envp = getEnvironment(configuration)

      // Program & VM arguments
      val pgmArgs = getProgramArguments(configuration)
      val vmArgs = getVMArguments(configuration)
      val execArgs = new ExecutionArguments(vmArgs, pgmArgs)

      // VM-specific attributes
      val vmAttributesMap = getVMSpecificAttributesMap(configuration)

      import JavaConverters._

      // adding Scala libraries is the only difference compared to the Java Launcher
      // TODO: do we still need this?
      val modifiedAttrMap: mutable.Map[String, Array[String]] =
        if (vmAttributesMap == null) mutable.Map()
        else vmAttributesMap.asInstanceOf[java.util.Map[String,Array[String]]].asScala
      val classpath0 = getClasspath(configuration)
      val missingScalaLibraries = toInclude(modifiedAttrMap,
          classpath0.toList, configuration)
      // Classpath
      // Add scala libraries that were missed in VM attributes<commit_msg>Fixed one-line wrong indentation in `ScalaLaunchDelegate`<commit_after>package scala.tools.eclipse.launching

import scala.collection.mutable
import org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate
import org.eclipse.jdt.launching.JavaRuntime
import org.eclipse.jdt.launching.IRuntimeClasspathEntry
import org.eclipse.jdt.launching.VMRunnerConfiguration
import org.eclipse.jdt.launching.ExecutionArguments
import scala.tools.eclipse.ScalaPlugin
import com.ibm.icu.text.MessageFormat
import org.eclipse.core.runtime.Path
import org.eclipse.core.runtime.CoreException
import org.eclipse.core.runtime.IProgressMonitor
import org.eclipse.core.runtime.NullProgressMonitor
import org.eclipse.debug.core.ILaunch
import org.eclipse.debug.core.ILaunchConfiguration
import scala.tools.eclipse.ui.DisplayThread
import org.eclipse.core.resources.IMarker
import org.eclipse.core.runtime.IProgressMonitor
import org.eclipse.core.runtime.IStatus
import org.eclipse.core.runtime.NullProgressMonitor
import org.eclipse.core.runtime.Path
import org.eclipse.debug.core.ILaunch
import org.eclipse.debug.core.ILaunchConfiguration
import org.eclipse.jdt.internal.launching.LaunchingMessages
import org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate
import org.eclipse.jdt.launching.ExecutionArguments
import org.eclipse.jdt.launching.IRuntimeClasspathEntry
import org.eclipse.jdt.launching.JavaRuntime
import org.eclipse.jdt.launching.VMRunnerConfiguration
import org.eclipse.jface.dialogs.MessageDialog
import scala.collection.JavaConverters

class ScalaLaunchDelegate extends AbstractJavaLaunchConfigurationDelegate {
  /** This code is very heavily inspired from `AbstractJavaLaunchConfigurationDelegate`. */
  def launch(configuration: ILaunchConfiguration, mode: String, launch: ILaunch, monitor0: IProgressMonitor) {

    val monitor = if (monitor0 == null) new NullProgressMonitor() else monitor0

    monitor.beginTask(configuration.getName() + "...", 3)

    if (monitor.isCanceled())
      return

    try {
      monitor.subTask(LaunchingMessages.JavaLocalApplicationLaunchConfigurationDelegate_Verifying_launch_attributes____1)

      val mainTypeName = verifyMainTypeName(configuration)
      val runner = getVMRunner(configuration, mode)

      val workingDir = verifyWorkingDirectory(configuration)
      val workingDirName = if (workingDir != null) workingDir.getAbsolutePath() else null

      // Environment variables
      val envp = getEnvironment(configuration)

      // Program & VM arguments
      val pgmArgs = getProgramArguments(configuration)
      val vmArgs = getVMArguments(configuration)
      val execArgs = new ExecutionArguments(vmArgs, pgmArgs)

      // VM-specific attributes
      val vmAttributesMap = getVMSpecificAttributesMap(configuration)

      import JavaConverters._

      // adding Scala libraries is the only difference compared to the Java Launcher
      // TODO: do we still need this?
      val modifiedAttrMap: mutable.Map[String, Array[String]] =
        if (vmAttributesMap == null) mutable.Map()
        else vmAttributesMap.asInstanceOf[java.util.Map[String,Array[String]]].asScala
      val classpath0 = getClasspath(configuration)
      val missingScalaLibraries = toInclude(modifiedAttrMap,
          classpath0.toList, configuration)
      // Classpath
      // Add scala libraries that were missed in VM attributes
{'fraction_non_alphanumeric': 0.07736857736857737, 'fraction_numerical': 0.002079002079002079, 'mean_word_length': 4.923482849604222, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7491197', 'n_tokens_mistral': 1818, 'n_tokens_neox': 1779, 'n_words': 382}