mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-20 01:04:22 +01:00
Add formatter status display to TUI status dialog (#3701)
This commit is contained in:
@@ -107,6 +107,8 @@ import type {
|
||||
McpStatusResponses,
|
||||
LspStatusData,
|
||||
LspStatusResponses,
|
||||
FormatterStatusData,
|
||||
FormatterStatusResponses,
|
||||
TuiAppendPromptData,
|
||||
TuiAppendPromptResponses,
|
||||
TuiAppendPromptErrors,
|
||||
@@ -773,6 +775,20 @@ class Lsp extends _HeyApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
class Formatter extends _HeyApiClient {
|
||||
/**
|
||||
* Get formatter status
|
||||
*/
|
||||
public status<ThrowOnError extends boolean = false>(
|
||||
options?: Options<FormatterStatusData, ThrowOnError>,
|
||||
) {
|
||||
return (options?.client ?? this._client).get<FormatterStatusResponses, unknown, ThrowOnError>({
|
||||
url: "/formatter",
|
||||
...options,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
class Control extends _HeyApiClient {
|
||||
/**
|
||||
* Get the next TUI request from the queue
|
||||
@@ -1023,6 +1039,7 @@ export class OpencodeClient extends _HeyApiClient {
|
||||
app = new App({ client: this._client })
|
||||
mcp = new Mcp({ client: this._client })
|
||||
lsp = new Lsp({ client: this._client })
|
||||
formatter = new Formatter({ client: this._client })
|
||||
tui = new Tui({ client: this._client })
|
||||
auth = new Auth({ client: this._client })
|
||||
event = new Event({ client: this._client })
|
||||
|
||||
@@ -1070,6 +1070,12 @@ export type LspStatus = {
|
||||
status: "connected" | "error"
|
||||
}
|
||||
|
||||
export type FormatterStatus = {
|
||||
name: string
|
||||
extensions: Array<string>
|
||||
enabled: boolean
|
||||
}
|
||||
|
||||
export type EventTuiPromptAppend = {
|
||||
type: "tui.prompt.append"
|
||||
properties: {
|
||||
@@ -1248,6 +1254,16 @@ export type EventTodoUpdated = {
|
||||
}
|
||||
}
|
||||
|
||||
export type EventCommandExecuted = {
|
||||
type: "command.executed"
|
||||
properties: {
|
||||
name: string
|
||||
sessionID: string
|
||||
arguments: string
|
||||
messageID: string
|
||||
}
|
||||
}
|
||||
|
||||
export type EventSessionIdle = {
|
||||
type: "session.idle"
|
||||
properties: {
|
||||
@@ -1310,6 +1326,7 @@ export type Event =
|
||||
| EventFileEdited
|
||||
| EventFileWatcherUpdated
|
||||
| EventTodoUpdated
|
||||
| EventCommandExecuted
|
||||
| EventSessionIdle
|
||||
| EventSessionCreated
|
||||
| EventSessionUpdated
|
||||
@@ -2511,6 +2528,24 @@ export type LspStatusResponses = {
|
||||
|
||||
export type LspStatusResponse = LspStatusResponses[keyof LspStatusResponses]
|
||||
|
||||
export type FormatterStatusData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query?: {
|
||||
directory?: string
|
||||
}
|
||||
url: "/formatter"
|
||||
}
|
||||
|
||||
export type FormatterStatusResponses = {
|
||||
/**
|
||||
* Formatter status
|
||||
*/
|
||||
200: Array<FormatterStatus>
|
||||
}
|
||||
|
||||
export type FormatterStatusResponse = FormatterStatusResponses[keyof FormatterStatusResponses]
|
||||
|
||||
export type TuiAppendPromptData = {
|
||||
body?: {
|
||||
text: string
|
||||
|
||||
Reference in New Issue
Block a user