bootstrap.ts 788 B

123456789101112131415161718192021222324252627
  1. import { Plugin } from "../plugin"
  2. import { Share } from "../share/share"
  3. import { Format } from "../format"
  4. import { LSP } from "../lsp"
  5. import { FileWatcher } from "../file/watcher"
  6. import { File } from "../file"
  7. import { Flag } from "../flag/flag"
  8. import { Project } from "./project"
  9. import { Bus } from "../bus"
  10. import { Command } from "../command"
  11. import { Instance } from "./instance"
  12. export async function InstanceBootstrap() {
  13. if (Flag.OPENCODE_EXPERIMENTAL_NO_BOOTSTRAP) return
  14. await Plugin.init()
  15. Share.init()
  16. Format.init()
  17. await LSP.init()
  18. FileWatcher.init()
  19. File.init()
  20. Bus.subscribe(Command.Event.Executed, async (payload) => {
  21. if (payload.properties.name === Command.Default.INIT) {
  22. await Project.setInitialized(Instance.project.id)
  23. }
  24. })
  25. }