feat(core): reload config on filesystem changes
This commit is contained in:
@@ -12,6 +12,7 @@ import { LSP } from "@/lsp/lsp"
|
||||
import { FSUtil } from "@opencode-ai/core/fs-util"
|
||||
import DESCRIPTION from "./apply_patch.txt"
|
||||
import { FileSystem } from "@opencode-ai/core/filesystem"
|
||||
import { FileSystemV1 } from "@opencode-ai/schema/filesystem-v1"
|
||||
import { Format } from "../format"
|
||||
import * as Bom from "@/util/bom"
|
||||
|
||||
@@ -253,7 +254,7 @@ export const ApplyPatchTool = Tool.define(
|
||||
if (yield* format.file(edited)) {
|
||||
yield* Bom.syncFile(afs, edited, change.bom)
|
||||
}
|
||||
yield* events.publish(FileSystem.Event.Edited, { file: edited })
|
||||
yield* events.publish(FileSystemV1.Event.Edited, { file: edited })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import { LSP } from "@/lsp/lsp"
|
||||
import { createTwoFilesPatch, diffLines } from "diff"
|
||||
import DESCRIPTION from "./edit.txt"
|
||||
import { FileSystem } from "@opencode-ai/core/filesystem"
|
||||
import { FileSystemV1 } from "@opencode-ai/schema/filesystem-v1"
|
||||
import { Watcher } from "@opencode-ai/core/filesystem/watcher"
|
||||
import { EventV2Bridge } from "@/event-v2-bridge"
|
||||
import { Format } from "../format"
|
||||
@@ -112,7 +113,7 @@ export const EditTool = Tool.define(
|
||||
if (yield* format.file(filePath)) {
|
||||
contentNew = yield* Bom.syncFile(afs, filePath, desiredBom)
|
||||
}
|
||||
yield* events.publish(FileSystem.Event.Edited, { file: filePath })
|
||||
yield* events.publish(FileSystemV1.Event.Edited, { file: filePath })
|
||||
yield* events.publish(Watcher.Event.Updated, {
|
||||
file: filePath,
|
||||
event: "add",
|
||||
@@ -156,7 +157,7 @@ export const EditTool = Tool.define(
|
||||
if (yield* format.file(filePath)) {
|
||||
contentNew = yield* Bom.syncFile(afs, filePath, desiredBom)
|
||||
}
|
||||
yield* events.publish(FileSystem.Event.Edited, { file: filePath })
|
||||
yield* events.publish(FileSystemV1.Event.Edited, { file: filePath })
|
||||
yield* events.publish(Watcher.Event.Updated, {
|
||||
file: filePath,
|
||||
event: "change",
|
||||
|
||||
@@ -7,6 +7,7 @@ import { createTwoFilesPatch } from "diff"
|
||||
import DESCRIPTION from "./write.txt"
|
||||
import { EventV2Bridge } from "@/event-v2-bridge"
|
||||
import { FileSystem } from "@opencode-ai/core/filesystem"
|
||||
import { FileSystemV1 } from "@opencode-ai/schema/filesystem-v1"
|
||||
import { Watcher } from "@opencode-ai/core/filesystem/watcher"
|
||||
import { Format } from "../format"
|
||||
import { FSUtil } from "@opencode-ai/core/fs-util"
|
||||
@@ -65,7 +66,7 @@ export const WriteTool = Tool.define(
|
||||
if (yield* format.file(filepath)) {
|
||||
yield* Bom.syncFile(fs, filepath, desiredBom)
|
||||
}
|
||||
yield* events.publish(FileSystem.Event.Edited, { file: filepath })
|
||||
yield* events.publish(FileSystemV1.Event.Edited, { file: filepath })
|
||||
yield* events.publish(Watcher.Event.Updated, {
|
||||
file: filepath,
|
||||
event: exists ? "change" : "add",
|
||||
|
||||
Reference in New Issue
Block a user