lsp progress

This commit is contained in:
Dax Raad
2025-06-05 23:42:04 -04:00
parent 16520261f4
commit 265f427d2a
13 changed files with 169 additions and 105 deletions

View File

@@ -0,0 +1,5 @@
import type { CommandModule } from "yargs"
export function cmd<T, U>(input: CommandModule<T, U>) {
return input
}

View File

@@ -1,12 +1,12 @@
import type { Argv } from "yargs"
import { App } from "../../app/app"
import { version } from "bun"
import { Bus } from "../../bus"
import { Provider } from "../../provider/provider"
import { Session } from "../../session"
import { Share } from "../../share/share"
import { Message } from "../../session/message"
import { UI } from "../ui"
import { VERSION } from "../version"
export const RunCommand = {
command: "run [message..]",
@@ -26,15 +26,13 @@ export const RunCommand = {
},
handler: async (args: { message: string[]; session?: string }) => {
const message = args.message.join(" ")
await App.provide({ cwd: process.cwd(), version }, async () => {
await App.provide({ cwd: process.cwd(), version: "0.0.0" }, async () => {
await Share.init()
const session = args.session
? await Session.get(args.session)
: await Session.create()
UI.print(UI.Style.TEXT_HIGHLIGHT_BOLD + "◍ OpenCode", version)
UI.print(UI.Style.TEXT_HIGHLIGHT_BOLD + "◍ OpenCode", VERSION)
UI.empty()
UI.print(UI.Style.TEXT_NORMAL_BOLD + "> ", message)
UI.empty()

View File

@@ -0,0 +1,21 @@
import { App } from "../../app/app"
import { VERSION } from "../version"
import { LSP } from "../../lsp"
import { cmd } from "./cmd"
export const ScrapCommand = cmd({
command: "scrap <file>",
builder: (yargs) =>
yargs.positional("file", { type: "string", demandOption: true }),
describe: "test command",
async handler(args) {
await App.provide(
{ cwd: process.cwd(), version: VERSION, printLogs: true },
async () => {
await LSP.file(args.file)
const diagnostics = await LSP.diagnostics()
console.log(diagnostics)
},
)
},
})

View File

@@ -0,0 +1,6 @@
declare global {
const OPENCODE_VERSION: string
}
export const VERSION =
typeof OPENCODE_VERSION === "string" ? OPENCODE_VERSION : "dev"