-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged branch idea243.release into idea243.x
- Loading branch information
Showing
9 changed files
with
106 additions
and
56 deletions.
There are no files selected for viewing
3 changes: 2 additions & 1 deletion
3
.../jetbrains/plugins/scala/compiler/references/CompilerReferenceServiceStatusListener.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 18 additions & 6 deletions
24
...rains/plugins/scala/compiler/references/indices/ScalaCompilerReferenceReaderFactory.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,28 @@ | ||
package org.jetbrains.plugins.scala.compiler.references.indices | ||
|
||
import com.intellij.openapi.diagnostic.Logger | ||
import com.intellij.openapi.project.Project | ||
import org.jetbrains.jps.backwardRefs.index.CompilerReferenceIndex | ||
import org.jetbrains.plugins.scala.compiler.references.indexDir | ||
|
||
private[references] object ScalaCompilerReferenceReaderFactory { | ||
val expectedIndexVersion: Int = ScalaCompilerIndices.version | ||
|
||
def apply(project: Project): Option[ScalaCompilerReferenceReader] = | ||
for { | ||
dir <- indexDir(project) | ||
if CompilerReferenceIndex.exists(dir) && | ||
!CompilerReferenceIndex.versionDiffers(dir, expectedIndexVersion) | ||
} yield new ScalaCompilerReferenceReader(dir) | ||
val Log: Logger = Logger.getInstance(classOf[ScalaCompilerReferenceReaderFactory.type]) | ||
|
||
//noinspection UnstableApiUsage | ||
def apply(project: Project): Option[ScalaCompilerReferenceReader] = { | ||
try { | ||
for { | ||
dir <- indexDir(project) | ||
if CompilerReferenceIndex.exists(dir) && | ||
!CompilerReferenceIndex.versionDiffers(dir, expectedIndexVersion) | ||
} yield new ScalaCompilerReferenceReader(dir) | ||
} catch { | ||
case e: Exception => | ||
indexDir(project).foreach(CompilerReferenceIndex.removeIndexFiles) | ||
Log.error(e) | ||
None | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
scala/compiler-shared/src/org/jetbrains/plugins/scala/compiler/references/ModuleScope.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.jetbrains.plugins.scala.compiler.references | ||
|
||
sealed trait ModuleScope { | ||
val suffix: String | ||
|
||
def appendScopeSuffix(name: String): String = name + suffix | ||
} | ||
|
||
object ModuleScope { | ||
|
||
case object Production extends ModuleScope { | ||
override val suffix: String = "_$production$" | ||
} | ||
|
||
case object Test extends ModuleScope { | ||
override val suffix: String = "_$test$" | ||
} | ||
|
||
def parse(string: String): Option[(String, ModuleScope)] = string match { | ||
case s if s.endsWith(Production.suffix) => Some(s.stripSuffix(Production.suffix), Production) | ||
case s if s.endsWith(Test.suffix) => Some(s.stripSuffix(Test.suffix), Test) | ||
case _ => None | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters