mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-25 14:55:28 +00:00
Some checks are pending
deploy / deploy (push) Waiting to run
generate / generate (push) Waiting to run
nix-eval / nix-eval (push) Waiting to run
publish / build-tauri (map[host:blacksmith-4vcpu-windows-2025 target:x86_64-pc-windows-msvc]) (push) Blocked by required conditions
publish / build-tauri (map[host:blacksmith-8vcpu-ubuntu-2404-arm target:aarch64-unknown-linux-gnu]) (push) Blocked by required conditions
publish / build-tauri (map[host:macos-latest target:aarch64-apple-darwin]) (push) Blocked by required conditions
publish / build-tauri (map[host:macos-latest target:x86_64-apple-darwin]) (push) Blocked by required conditions
publish / build-tauri (map[host:windows-2025 target:aarch64-pc-windows-msvc]) (push) Blocked by required conditions
publish / build-electron (map[host:blacksmith-4vcpu-ubuntu-2404 platform_flag:--linux target:aarch64-unknown-linux-gnu]) (push) Blocked by required conditions
publish / build-electron (map[host:blacksmith-4vcpu-ubuntu-2404 platform_flag:--linux target:x86_64-unknown-linux-gnu]) (push) Blocked by required conditions
publish / build-electron (map[host:blacksmith-4vcpu-windows-2025 platform_flag:--win target:x86_64-pc-windows-msvc]) (push) Blocked by required conditions
publish / build-electron (map[host:macos-latest platform_flag:--mac --arm64 target:aarch64-apple-darwin]) (push) Blocked by required conditions
publish / build-electron (map[host:macos-latest platform_flag:--mac --x64 target:x86_64-apple-darwin]) (push) Blocked by required conditions
publish / build-electron (map[host:windows-2025 platform_flag:--win --arm64 target:aarch64-pc-windows-msvc]) (push) Blocked by required conditions
publish / version (push) Waiting to run
publish / build-cli (push) Blocked by required conditions
publish / sign-cli-windows (push) Blocked by required conditions
publish / build-tauri (map[host:blacksmith-4vcpu-ubuntu-2404 target:x86_64-unknown-linux-gnu]) (push) Blocked by required conditions
publish / publish (push) Blocked by required conditions
test / unit (linux) (push) Waiting to run
test / unit (windows) (push) Waiting to run
test / e2e (linux) (push) Waiting to run
test / e2e (windows) (push) Waiting to run
typecheck / typecheck (push) Waiting to run
55 lines
1.5 KiB
TypeScript
55 lines
1.5 KiB
TypeScript
import { describe, expect, spyOn, test } from "bun:test"
|
|
import path from "path"
|
|
import * as Lsp from "../../src/lsp/index"
|
|
import { LSPServer } from "../../src/lsp/server"
|
|
import { Instance } from "../../src/project/instance"
|
|
import { tmpdir } from "../fixture/fixture"
|
|
|
|
describe("lsp.spawn", () => {
|
|
test("does not spawn builtin LSP for files outside instance", async () => {
|
|
await using tmp = await tmpdir()
|
|
const spy = spyOn(LSPServer.Typescript, "spawn").mockResolvedValue(undefined)
|
|
|
|
try {
|
|
await Instance.provide({
|
|
directory: tmp.path,
|
|
fn: async () => {
|
|
await Lsp.LSP.touchFile(path.join(tmp.path, "..", "outside.ts"))
|
|
await Lsp.LSP.hover({
|
|
file: path.join(tmp.path, "..", "hover.ts"),
|
|
line: 0,
|
|
character: 0,
|
|
})
|
|
},
|
|
})
|
|
|
|
expect(spy).toHaveBeenCalledTimes(0)
|
|
} finally {
|
|
spy.mockRestore()
|
|
await Instance.disposeAll()
|
|
}
|
|
})
|
|
|
|
test("would spawn builtin LSP for files inside instance", async () => {
|
|
await using tmp = await tmpdir()
|
|
const spy = spyOn(LSPServer.Typescript, "spawn").mockResolvedValue(undefined)
|
|
|
|
try {
|
|
await Instance.provide({
|
|
directory: tmp.path,
|
|
fn: async () => {
|
|
await Lsp.LSP.hover({
|
|
file: path.join(tmp.path, "src", "inside.ts"),
|
|
line: 0,
|
|
character: 0,
|
|
})
|
|
},
|
|
})
|
|
|
|
expect(spy).toHaveBeenCalledTimes(1)
|
|
} finally {
|
|
spy.mockRestore()
|
|
await Instance.disposeAll()
|
|
}
|
|
})
|
|
})
|