Skip to content

Commit

Permalink
Don't use UpdatingEditionManager in regular execution
Browse files Browse the repository at this point in the history
  • Loading branch information
JaroslavTulach committed Jun 28, 2024
1 parent ec51515 commit f1ad21b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,11 @@ class MainModule(serverConfig: LanguageServerConfig, logLevel: Level) {
val distributionManager = new DistributionManager(environment)

val editionProvider =
EditionManager.makeEditionProvider(distributionManager, Some(languageHome))
EditionManager.makeEditionProvider(
distributionManager,
Some(languageHome),
false
)
val editionResolver = EditionResolver(editionProvider)
val editionReferenceResolver = new EditionReferenceResolver(
contentRoot.file,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ object DependencyPreinstaller {

val editionProvider = EditionManager.makeEditionProvider(
distributionManager,
Some(languageHome)
Some(languageHome),
true
)
val editionResolver = EditionResolver(editionProvider)
val edition = editionResolver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,26 @@ class EditionManager private (
object EditionManager {

/** Create an [[EditionProvider]] that can locate editions from the
* distribution and the language home.
* distribution (if updating) and the language home.
*/
def makeEditionProvider(
final def makeEditionProvider(
distributionManager: DistributionManager,
languageHome: Option[LanguageHome]
): UpdatingEditionProvider = {
val config = new GlobalConfigurationManager(distributionManager).getConfig
new UpdatingEditionProvider(
getSearchPaths(distributionManager, languageHome),
distributionManager.paths.cachedEditions,
config.editionProviders
)
languageHome: Option[LanguageHome],
updating: Boolean
): editions.provider.EditionProvider = {
val config = new GlobalConfigurationManager(distributionManager).getConfig
val searchPaths = getSearchPaths(distributionManager, languageHome)
val cachePath = distributionManager.paths.cachedEditions
if (updating) {
new UpdatingEditionProvider(
searchPaths,
cachePath,
config.editionProviders
)
} else {
val actualSearchPaths = (searchPaths ++ List(cachePath)).distinct
new editions.provider.FileSystemEditionProvider(actualSearchPaths)
}
}

/** Get search paths associated with the distribution and language home. */
Expand All @@ -79,6 +87,6 @@ object EditionManager {
distributionManager: DistributionManager,
languageHome: Option[LanguageHome] = None
): EditionManager = new EditionManager(
makeEditionProvider(distributionManager, languageHome)
makeEditionProvider(distributionManager, languageHome, false)
)
}

0 comments on commit f1ad21b

Please sign in to comment.