summaryrefslogtreecommitdiffhomepage
path: root/packages/lsp/src/types.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/lsp/src/types.ts')
-rw-r--r--packages/lsp/src/types.ts27
1 files changed, 27 insertions, 0 deletions
diff --git a/packages/lsp/src/types.ts b/packages/lsp/src/types.ts
index cc33e03..1f72bdf 100644
--- a/packages/lsp/src/types.ts
+++ b/packages/lsp/src/types.ts
@@ -20,6 +20,25 @@ export interface LspServerStatus {
readonly configSource?: string | undefined;
}
+export interface DiagnosticsResult {
+ /** Formatted diagnostic string (filtered by minSeverity). Empty if none. */
+ readonly formatted: string;
+ /** True if diagnostics took >10s. */
+ readonly slow: boolean;
+ /** True if the 60s timeout was hit before all servers responded. */
+ readonly timedOut: boolean;
+}
+
+export interface GetDiagnosticsOpts {
+ readonly filePath: string;
+ /** Post-edit buffer content. If omitted, the server reads from disk. */
+ readonly text?: string;
+ readonly cwd: string;
+ readonly timeoutMs?: number;
+ /** Only include diagnostics with severity ≤ this (1=Error, 2=Warning). Omit for all. */
+ readonly minSeverity?: number;
+}
+
export interface LspService {
/**
* Resolve the language servers configured for `cwd`, ensure each is spawned +
@@ -27,4 +46,12 @@ export interface LspService {
* server's failure — reflect it as state:"error" with a short `error`.
*/
status(cwd: string): Promise<readonly LspServerStatus[]>;
+
+ /**
+ * Query ALL connected language servers matching the file's extension for
+ * diagnostics. Merges results tagged by source server. Sends didOpen/didChange
+ * with the provided text (post-edit buffer) so the server checks the in-memory
+ * version, not stale disk content.
+ */
+ getDiagnostics(opts: GetDiagnosticsOpts): Promise<DiagnosticsResult>;
}