|
|
@@ -610,6 +610,46 @@ export namespace LSPServer {
|
|
|
},
|
|
|
}
|
|
|
|
|
|
+ export const FSharp: Info = {
|
|
|
+ id: "fsharp",
|
|
|
+ root: NearestRoot([".sln", ".fsproj", "global.json"]),
|
|
|
+ extensions: [".fs", ".fsi", ".fsx", ".fsscript"],
|
|
|
+ async spawn(root) {
|
|
|
+ let bin = Bun.which("fsautocomplete", {
|
|
|
+ PATH: process.env["PATH"] + ":" + Global.Path.bin,
|
|
|
+ })
|
|
|
+ if (!bin) {
|
|
|
+ if (!Bun.which("dotnet")) {
|
|
|
+ log.error(".NET SDK is required to install fsautocomplete")
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Flag.OPENCODE_DISABLE_LSP_DOWNLOAD) return
|
|
|
+ log.info("installing fsautocomplete via dotnet tool")
|
|
|
+ const proc = Bun.spawn({
|
|
|
+ cmd: ["dotnet", "tool", "install", "fsautocomplete", "--tool-path", Global.Path.bin],
|
|
|
+ stdout: "pipe",
|
|
|
+ stderr: "pipe",
|
|
|
+ stdin: "pipe",
|
|
|
+ })
|
|
|
+ const exit = await proc.exited
|
|
|
+ if (exit !== 0) {
|
|
|
+ log.error("Failed to install fsautocomplete")
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ bin = path.join(Global.Path.bin, "fsautocomplete" + (process.platform === "win32" ? ".exe" : ""))
|
|
|
+ log.info(`installed fsautocomplete`, { bin })
|
|
|
+ }
|
|
|
+
|
|
|
+ return {
|
|
|
+ process: spawn(bin, {
|
|
|
+ cwd: root,
|
|
|
+ }),
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }
|
|
|
+
|
|
|
export const SourceKit: Info = {
|
|
|
id: "sourcekit-lsp",
|
|
|
extensions: [".swift", ".objc", "objcpp"],
|