fix: revert "core: move plugin initialisation to config layer override" (#22686)
This commit is contained in:
@@ -47,31 +47,13 @@ import { Pty } from "@/pty"
|
|||||||
import { Installation } from "@/installation"
|
import { Installation } from "@/installation"
|
||||||
import { ShareNext } from "@/share/share-next"
|
import { ShareNext } from "@/share/share-next"
|
||||||
import { SessionShare } from "@/share/session"
|
import { SessionShare } from "@/share/session"
|
||||||
import * as Effect from "effect/Effect"
|
|
||||||
|
|
||||||
// Adjusts the default Config layer to ensure that plugins are always initialised before
|
|
||||||
// any other layers read the current config
|
|
||||||
const ConfigWithPluginPriority = Layer.effect(
|
|
||||||
Config.Service,
|
|
||||||
Effect.gen(function* () {
|
|
||||||
const config = yield* Config.Service
|
|
||||||
const plugin = yield* Plugin.Service
|
|
||||||
|
|
||||||
return {
|
|
||||||
...config,
|
|
||||||
get: () => Effect.andThen(plugin.init(), config.get),
|
|
||||||
getGlobal: () => Effect.andThen(plugin.init(), config.getGlobal),
|
|
||||||
getConsoleState: () => Effect.andThen(plugin.init(), config.getConsoleState),
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
).pipe(Layer.provide(Layer.merge(Plugin.defaultLayer, Config.defaultLayer)))
|
|
||||||
|
|
||||||
export const AppLayer = Layer.mergeAll(
|
export const AppLayer = Layer.mergeAll(
|
||||||
AppFileSystem.defaultLayer,
|
AppFileSystem.defaultLayer,
|
||||||
Bus.defaultLayer,
|
Bus.defaultLayer,
|
||||||
Auth.defaultLayer,
|
Auth.defaultLayer,
|
||||||
Account.defaultLayer,
|
Account.defaultLayer,
|
||||||
ConfigWithPluginPriority,
|
Config.defaultLayer,
|
||||||
Git.defaultLayer,
|
Git.defaultLayer,
|
||||||
Ripgrep.defaultLayer,
|
Ripgrep.defaultLayer,
|
||||||
FileTime.defaultLayer,
|
FileTime.defaultLayer,
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import * as Effect from "effect/Effect"
|
|||||||
|
|
||||||
export const InstanceBootstrap = Effect.gen(function* () {
|
export const InstanceBootstrap = Effect.gen(function* () {
|
||||||
Log.Default.info("bootstrapping", { directory: Instance.directory })
|
Log.Default.info("bootstrapping", { directory: Instance.directory })
|
||||||
|
yield* Plugin.Service.use((svc) => svc.init())
|
||||||
yield* Effect.all(
|
yield* Effect.all(
|
||||||
[
|
[
|
||||||
LSP.Service,
|
LSP.Service,
|
||||||
|
|||||||
Reference in New Issue
Block a user