<commit_before>package org.jetbrains.plugins.scala.lang.psi

import com.intellij.extapi.psi.PsiFileBase
import com.intellij.lang.Language
import com.intellij.psi._
import com.intellij.psi.scope.PsiScopeProcessor
import org.jetbrains.plugins.scala.ScalaFileType
import org.jetbrains.plugins.scala.lang.psi.impl.top._
import com.intellij.psi.tree.TokenSet
import org.jetbrains.plugins.scala.lang.psi.impl.top.defs._
import org.jetbrains.annotations.Nullable
import com.intellij.lang.ASTNode
import com.intellij.psi.tree.IElementType
import org.jetbrains.plugins.scala.lang.parser.ScalaElementTypes
import org.jetbrains.plugins.scala.lang.resolve.processors._


class ScalaFile(viewProvider: FileViewProvider)
extends PsiFileBase (viewProvider, ScalaFileType.SCALA_FILE_TYPE.getLanguage())
with ScalaPsiElement {

  override def getViewProvider = viewProvider
  override def getFileType = ScalaFileType.SCALA_FILE_TYPE
  override def toString = "Scala file"

  def getPackaging: Iterable[ScPackaging] = childrenOfType[ScPackaging](ScalaElementTypes.PACKAGING_BIT_SET)

  /**
  *  Receiving al template definitions (such as class, object, trait) in current file
  */
  def getTmplDefs: List[ScTmplDef] = {
    val children = childrenOfType[ScalaPsiElementImpl](ScalaElementTypes.TMPL_OR_PACKAGING_DEF_BIT_SET)
    (children :\ (Nil: List[ScTmplDef]))((y: ScalaPsiElementImpl, x: List[ScTmplDef]) =>
      y.getNode.getElementType match
      {
        case ScalaElementTypes.PACKAGING => y.asInstanceOf[ScPackaging].getTmplDefs.toList ::: x
        case _ => y.asInstanceOf[ScTmplDef] :: (y.asInstanceOf[ScTmplDef]).getTmplDefs.toList ::: x
      })
  }

  def getImports: Iterable[ScImportStmt] = childrenOfType[ScImportStmt](ScalaElementTypes.IMPORT_STATEMENT_BIT_SET)

  def getUpperDefs = childrenOfType[ScalaPsiElementImpl](ScalaElementTypes.TMPL_DEF_BIT_SET)

  override def processDeclarations(processor: PsiScopeProcessor,
          substitutor: PsiSubstitutor,
          lastParent: PsiElement,
          place: PsiElement) = {
    /*
        for (val importStatement <- getImports) {
          val expr = importStatement.getExpression
          expr.getImportReference
        }
    */
    import org.jetbrains.plugins.scala.lang.resolve.processors._
    if (processor.isInstanceOf[ScalaClassResolveProcessor]) {<commit_msg>Added classes resolve support in one file scope<commit_after>package org.jetbrains.plugins.scala.lang.psi

import com.intellij.extapi.psi.PsiFileBase
import com.intellij.lang.Language
import com.intellij.psi._
import com.intellij.psi.scope.PsiScopeProcessor
import org.jetbrains.plugins.scala.ScalaFileType
import org.jetbrains.plugins.scala.lang.psi.impl.top._
import com.intellij.psi.tree.TokenSet
import org.jetbrains.plugins.scala.lang.psi.impl.top.defs._
import org.jetbrains.annotations.Nullable
import com.intellij.lang.ASTNode
import com.intellij.psi.tree.IElementType
import org.jetbrains.plugins.scala.lang.parser.ScalaElementTypes
import org.jetbrains.plugins.scala.lang.resolve.processors._


class ScalaFile(viewProvider: FileViewProvider)
extends PsiFileBase (viewProvider, ScalaFileType.SCALA_FILE_TYPE.getLanguage())
with ScalaPsiElement {

  override def getViewProvider = viewProvider
  override def getFileType = ScalaFileType.SCALA_FILE_TYPE
  override def toString = "Scala file"

  def getPackaging: Iterable[ScPackaging] = childrenOfType[ScPackaging](ScalaElementTypes.PACKAGING_BIT_SET)

  /**
  *  Receiving al template definitions (such as class, object, trait) in current file
  */
  def getTmplDefs: List[ScTmplDef] = {
    val children = childrenOfType[ScalaPsiElementImpl](ScalaElementTypes.TMPL_OR_PACKAGING_DEF_BIT_SET)
    (children :\ (Nil: List[ScTmplDef]))((y: ScalaPsiElementImpl, x: List[ScTmplDef]) =>
      y.getNode.getElementType match
      {
        case ScalaElementTypes.PACKAGING => y.asInstanceOf[ScPackaging].getTmplDefs.toList ::: x
        case _ => y.asInstanceOf[ScTmplDef] :: (y.asInstanceOf[ScTmplDef]).getTmplDefs.toList ::: x
      })
  }

  def getImports: Iterable[ScImportStmt] = childrenOfType[ScImportStmt](ScalaElementTypes.IMPORT_STATEMENT_BIT_SET)

  def getUpperDefs = childrenOfType[ScalaPsiElementImpl](ScalaElementTypes.TMPL_DEF_BIT_SET)

  override def processDeclarations(processor: PsiScopeProcessor,
          substitutor: PsiSubstitutor,
          lastParent: PsiElement,
          place: PsiElement): Boolean = {
    /*
        for (val importStatement <- getImports) {
          val expr = importStatement.getExpression
          expr.getImportReference
        }
    */
    import org.jetbrains.plugins.scala.lang.resolve.processors._
    if (processor.isInstanceOf[ScalaClassResolveProcessor]) {
{'fraction_non_alphanumeric': 0.09462045502870509, 'fraction_numerical': 0.0, 'mean_word_length': 4.715674362089915, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '2649354', 'n_tokens_mistral': 1555, 'n_tokens_neox': 1492, 'n_words': 242}