Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
BFergerson committed Mar 1, 2023
1 parent f054de1 commit db901c0
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import com.intellij.openapi.diagnostic.logger
import spp.jetbrains.marker.service.define.AbstractSourceGuideProvider
import spp.jetbrains.marker.source.SourceFileMarker
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.CopyOnWriteArrayList

/**
* todo: description.
Expand All @@ -32,15 +33,14 @@ import java.util.concurrent.ConcurrentHashMap
object SourceGuideProvider : AbstractSourceGuideProvider {

private val log = logger<SourceGuideProvider>()
private val providers = ConcurrentHashMap<String, MutableList<AbstractSourceGuideProvider>>()
private val providers = ConcurrentHashMap<String, CopyOnWriteArrayList<AbstractSourceGuideProvider>>()

fun addProvider(guideProvider: AbstractSourceGuideProvider, language: String, vararg languages: String) {
providers.computeIfAbsent(language) { mutableListOf() }.add(guideProvider)
languages.forEach { providers.computeIfAbsent(it) { mutableListOf() }.add(guideProvider) }
addProvider(guideProvider, listOf(language, *languages))
}

fun addProvider(guideProvider: AbstractSourceGuideProvider, languages: List<String>) {
languages.forEach { providers.computeIfAbsent(it) { mutableListOf() }.add(guideProvider) }
languages.forEach { providers.computeIfAbsent(it) { CopyOnWriteArrayList() }.add(guideProvider) }
}

private fun getProvider(language: String): AbstractSourceGuideProvider? {
Expand Down

0 comments on commit db901c0

Please sign in to comment.