chore: include pre-built dist for github install
This commit is contained in:
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
export { validateCwd } from "./lsp-process";
|
||||
export { lspManager } from "./lsp-server";
|
||||
export { LSPClient } from "./lsp-client";
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
export { findServerForExtension, getAllServers, getConfigPaths_ } from "./server-resolution";
|
||||
export { getLanguageId } from "./language-config";
|
||||
export { isServerInstalled } from "./server-installation";
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
export declare const DEFAULT_MAX_REFERENCES = 200;
|
||||
export declare const DEFAULT_MAX_SYMBOLS = 200;
|
||||
export declare const DEFAULT_MAX_DIAGNOSTICS = 200;
|
||||
export declare const DEFAULT_MAX_DIRECTORY_FILES = 50;
|
||||
export { SYMBOL_KIND_MAP, SEVERITY_MAP, EXT_TO_LANG } from "./language-mappings";
|
||||
export { BUILTIN_SERVERS, LSP_INSTALL_HINTS } from "./server-definitions";
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
import { type ToolDefinition } from "@opencode-ai/plugin/tool";
|
||||
export declare const lsp_diagnostics: ToolDefinition;
|
||||
+1
@@ -0,0 +1 @@
|
||||
export declare function aggregateDiagnosticsForDirectory(directory: string, extension: string, severity?: "error" | "warning" | "information" | "hint" | "all", maxFiles?: number): Promise<string>;
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
import { type ToolDefinition } from "@opencode-ai/plugin/tool";
|
||||
export declare const lsp_find_references: ToolDefinition;
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
import { type ToolDefinition } from "@opencode-ai/plugin/tool";
|
||||
export declare const lsp_goto_definition: ToolDefinition;
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
export * from "./types";
|
||||
export * from "./constants";
|
||||
export * from "./config";
|
||||
export * from "./client";
|
||||
export * from "./lsp-client-wrapper";
|
||||
export * from "./lsp-formatters";
|
||||
export * from "./workspace-edit";
|
||||
export { lsp_goto_definition, lsp_find_references, lsp_symbols, lsp_diagnostics, lsp_prepare_rename, lsp_rename } from "./tools";
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export declare function getLanguageId(ext: string): string;
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
export declare const SYMBOL_KIND_MAP: Record<number, string>;
|
||||
export declare const SEVERITY_MAP: Record<number, string>;
|
||||
export declare const EXT_TO_LANG: Record<string, string>;
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
import { LSPClientTransport } from "./lsp-client-transport";
|
||||
export declare class LSPClientConnection extends LSPClientTransport {
|
||||
initialize(): Promise<void>;
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
import { type MessageConnection } from "vscode-jsonrpc/node";
|
||||
import type { Diagnostic, ResolvedServer } from "./types";
|
||||
import { type UnifiedProcess } from "./lsp-process";
|
||||
export declare class LSPClientTransport {
|
||||
protected root: string;
|
||||
protected server: ResolvedServer;
|
||||
protected proc: UnifiedProcess | null;
|
||||
protected connection: MessageConnection | null;
|
||||
protected readonly stderrBuffer: string[];
|
||||
protected processExited: boolean;
|
||||
protected readonly diagnosticsStore: Map<string, Diagnostic[]>;
|
||||
protected readonly REQUEST_TIMEOUT = 15000;
|
||||
constructor(root: string, server: ResolvedServer);
|
||||
start(): Promise<void>;
|
||||
protected startStderrReading(): void;
|
||||
protected sendRequest<T>(method: string): Promise<T>;
|
||||
protected sendRequest<T>(method: string, params: unknown): Promise<T>;
|
||||
protected sendNotification(method: string): void;
|
||||
protected sendNotification(method: string, params: unknown): void;
|
||||
isAlive(): boolean;
|
||||
stop(): Promise<void>;
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import { LSPClient } from "./client";
|
||||
import type { ServerLookupResult } from "./types";
|
||||
export declare function isDirectoryPath(filePath: string): boolean;
|
||||
export declare function uriToPath(uri: string): string;
|
||||
export declare function findWorkspaceRoot(filePath: string): string;
|
||||
export declare function formatServerLookupError(result: Exclude<ServerLookupResult, {
|
||||
status: "found";
|
||||
}>): string;
|
||||
export declare function withLspClient<T>(filePath: string, fn: (client: LSPClient) => Promise<T>): Promise<T>;
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
import { LSPClientConnection } from "./lsp-client-connection";
|
||||
import type { Diagnostic } from "./types";
|
||||
export declare class LSPClient extends LSPClientConnection {
|
||||
private openedFiles;
|
||||
private documentVersions;
|
||||
private lastSyncedText;
|
||||
openFile(filePath: string): Promise<void>;
|
||||
definition(filePath: string, line: number, character: number): Promise<unknown>;
|
||||
references(filePath: string, line: number, character: number, includeDeclaration?: boolean): Promise<unknown>;
|
||||
documentSymbols(filePath: string): Promise<unknown>;
|
||||
workspaceSymbols(query: string): Promise<unknown>;
|
||||
diagnostics(filePath: string): Promise<{
|
||||
items: Diagnostic[];
|
||||
}>;
|
||||
prepareRename(filePath: string, line: number, character: number): Promise<unknown>;
|
||||
rename(filePath: string, line: number, character: number, newName: string): Promise<unknown>;
|
||||
}
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
import type { Diagnostic, DocumentSymbol, Location, LocationLink, PrepareRenameDefaultBehavior, PrepareRenameResult, Range, SymbolInfo, TextEdit, WorkspaceEdit } from "./types";
|
||||
import type { ApplyResult } from "./workspace-edit";
|
||||
export declare function formatLocation(loc: Location | LocationLink): string;
|
||||
export declare function formatSymbolKind(kind: number): string;
|
||||
export declare function formatSeverity(severity: number | undefined): string;
|
||||
export declare function formatDocumentSymbol(symbol: DocumentSymbol, indent?: number): string;
|
||||
export declare function formatSymbolInfo(symbol: SymbolInfo): string;
|
||||
export declare function formatDiagnostic(diag: Diagnostic): string;
|
||||
export declare function filterDiagnosticsBySeverity(diagnostics: Diagnostic[], severityFilter?: "error" | "warning" | "information" | "hint" | "all"): Diagnostic[];
|
||||
export declare function formatPrepareRenameResult(result: PrepareRenameResult | PrepareRenameDefaultBehavior | Range | null): string;
|
||||
export declare function formatTextEdit(edit: TextEdit): string;
|
||||
export declare function formatWorkspaceEdit(edit: WorkspaceEdit | null): string;
|
||||
export declare function formatApplyResult(result: ApplyResult): string;
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
type ManagedClientForCleanup = {
|
||||
client: {
|
||||
stop: () => Promise<void>;
|
||||
};
|
||||
};
|
||||
type ProcessCleanupOptions = {
|
||||
getClients: () => IterableIterator<[string, ManagedClientForCleanup]>;
|
||||
clearClients: () => void;
|
||||
clearCleanupInterval: () => void;
|
||||
};
|
||||
export type LspProcessCleanupHandle = {
|
||||
unregister: () => void;
|
||||
};
|
||||
export declare function registerLspManagerProcessCleanup(options: ProcessCleanupOptions): LspProcessCleanupHandle;
|
||||
export {};
|
||||
@@ -0,0 +1,8 @@
|
||||
type ManagedClientForTempDirectoryCleanup = {
|
||||
refCount: number;
|
||||
client: {
|
||||
stop: () => Promise<void>;
|
||||
};
|
||||
};
|
||||
export declare function cleanupTempDirectoryLspClients(clients: Map<string, ManagedClientForTempDirectoryCleanup>): Promise<void>;
|
||||
export {};
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
export declare function validateCwd(cwd: string): {
|
||||
valid: boolean;
|
||||
error?: string;
|
||||
};
|
||||
interface StreamReader {
|
||||
read(): Promise<{
|
||||
done: boolean;
|
||||
value: Uint8Array | undefined;
|
||||
}>;
|
||||
}
|
||||
export interface UnifiedProcess {
|
||||
stdin: {
|
||||
write(chunk: Uint8Array | string): void;
|
||||
};
|
||||
stdout: {
|
||||
getReader(): StreamReader;
|
||||
};
|
||||
stderr: {
|
||||
getReader(): StreamReader;
|
||||
};
|
||||
exitCode: number | null;
|
||||
exited: Promise<number>;
|
||||
kill(signal?: string): void;
|
||||
}
|
||||
export declare function spawnProcess(command: string[], options: {
|
||||
cwd: string;
|
||||
env: Record<string, string | undefined>;
|
||||
}): UnifiedProcess;
|
||||
export {};
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
import { LSPClient } from "./lsp-client";
|
||||
import type { ResolvedServer } from "./types";
|
||||
declare class LSPServerManager {
|
||||
private static instance;
|
||||
private clients;
|
||||
private cleanupInterval;
|
||||
private readonly IDLE_TIMEOUT;
|
||||
private readonly INIT_TIMEOUT;
|
||||
private cleanupHandle;
|
||||
private constructor();
|
||||
private registerProcessCleanup;
|
||||
static getInstance(): LSPServerManager;
|
||||
private getKey;
|
||||
private startCleanupTimer;
|
||||
private cleanupIdleClients;
|
||||
getClient(root: string, server: ResolvedServer): Promise<LSPClient>;
|
||||
warmupClient(root: string, server: ResolvedServer): void;
|
||||
releaseClient(root: string, serverId: string): void;
|
||||
isServerInitializing(root: string, serverId: string): boolean;
|
||||
stopAll(): Promise<void>;
|
||||
cleanupTempDirectoryClients(): Promise<void>;
|
||||
}
|
||||
export declare const lspManager: LSPServerManager;
|
||||
export {};
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { type ToolDefinition } from "@opencode-ai/plugin/tool";
|
||||
export declare const lsp_prepare_rename: ToolDefinition;
|
||||
export declare const lsp_rename: ToolDefinition;
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import type { ResolvedServer } from "./types";
|
||||
interface LspEntry {
|
||||
disabled?: boolean;
|
||||
command?: string[];
|
||||
extensions?: string[];
|
||||
priority?: number;
|
||||
env?: Record<string, string>;
|
||||
initialization?: Record<string, unknown>;
|
||||
}
|
||||
interface ConfigJson {
|
||||
lsp?: Record<string, LspEntry>;
|
||||
}
|
||||
type ConfigSource = "project" | "user" | "opencode";
|
||||
interface ServerWithSource extends ResolvedServer {
|
||||
source: ConfigSource;
|
||||
}
|
||||
export declare function loadJsonFile<T>(path: string): T | null;
|
||||
export declare function getConfigPaths(): {
|
||||
project: string;
|
||||
user: string;
|
||||
opencode: string;
|
||||
};
|
||||
export declare function loadAllConfigs(): Map<ConfigSource, ConfigJson>;
|
||||
export declare function getMergedServers(): ServerWithSource[];
|
||||
export {};
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
import type { LSPServerConfig } from "./types";
|
||||
export declare const LSP_INSTALL_HINTS: Record<string, string>;
|
||||
export declare const BUILTIN_SERVERS: Record<string, Omit<LSPServerConfig, "id">>;
|
||||
+1
@@ -0,0 +1 @@
|
||||
export declare function isServerInstalled(command: string[]): boolean;
|
||||
+1
@@ -0,0 +1 @@
|
||||
export declare function getLspServerAdditionalPathBases(workingDirectory: string): string[];
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
import type { ServerLookupResult } from "./types";
|
||||
export declare function findServerForExtension(ext: string): ServerLookupResult;
|
||||
export declare function getAllServers(): Array<{
|
||||
id: string;
|
||||
installed: boolean;
|
||||
extensions: string[];
|
||||
disabled: boolean;
|
||||
source: string;
|
||||
priority: number;
|
||||
}>;
|
||||
export declare function getConfigPaths_(): {
|
||||
project: string;
|
||||
user: string;
|
||||
opencode: string;
|
||||
};
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
import { type ToolDefinition } from "@opencode-ai/plugin/tool";
|
||||
export declare const lsp_symbols: ToolDefinition;
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
export { lsp_goto_definition } from "./goto-definition-tool";
|
||||
export { lsp_find_references } from "./find-references-tool";
|
||||
export { lsp_symbols } from "./symbols-tool";
|
||||
export { lsp_diagnostics } from "./diagnostics-tool";
|
||||
export { lsp_prepare_rename, lsp_rename } from "./rename-tools";
|
||||
Vendored
+123
@@ -0,0 +1,123 @@
|
||||
export interface LSPServerConfig {
|
||||
id: string;
|
||||
command: string[];
|
||||
extensions: string[];
|
||||
disabled?: boolean;
|
||||
env?: Record<string, string>;
|
||||
initialization?: Record<string, unknown>;
|
||||
}
|
||||
export interface Position {
|
||||
line: number;
|
||||
character: number;
|
||||
}
|
||||
export interface Range {
|
||||
start: Position;
|
||||
end: Position;
|
||||
}
|
||||
export interface Location {
|
||||
uri: string;
|
||||
range: Range;
|
||||
}
|
||||
export interface LocationLink {
|
||||
targetUri: string;
|
||||
targetRange: Range;
|
||||
targetSelectionRange: Range;
|
||||
originSelectionRange?: Range;
|
||||
}
|
||||
export interface SymbolInfo {
|
||||
name: string;
|
||||
kind: number;
|
||||
location: Location;
|
||||
containerName?: string;
|
||||
}
|
||||
export interface DocumentSymbol {
|
||||
name: string;
|
||||
kind: number;
|
||||
range: Range;
|
||||
selectionRange: Range;
|
||||
children?: DocumentSymbol[];
|
||||
}
|
||||
export interface Diagnostic {
|
||||
range: Range;
|
||||
severity?: number;
|
||||
code?: string | number;
|
||||
source?: string;
|
||||
message: string;
|
||||
}
|
||||
export interface TextDocumentIdentifier {
|
||||
uri: string;
|
||||
}
|
||||
export interface VersionedTextDocumentIdentifier extends TextDocumentIdentifier {
|
||||
version: number | null;
|
||||
}
|
||||
export interface TextEdit {
|
||||
range: Range;
|
||||
newText: string;
|
||||
}
|
||||
export interface TextDocumentEdit {
|
||||
textDocument: VersionedTextDocumentIdentifier;
|
||||
edits: TextEdit[];
|
||||
}
|
||||
export interface CreateFile {
|
||||
kind: "create";
|
||||
uri: string;
|
||||
options?: {
|
||||
overwrite?: boolean;
|
||||
ignoreIfExists?: boolean;
|
||||
};
|
||||
}
|
||||
export interface RenameFile {
|
||||
kind: "rename";
|
||||
oldUri: string;
|
||||
newUri: string;
|
||||
options?: {
|
||||
overwrite?: boolean;
|
||||
ignoreIfExists?: boolean;
|
||||
};
|
||||
}
|
||||
export interface DeleteFile {
|
||||
kind: "delete";
|
||||
uri: string;
|
||||
options?: {
|
||||
recursive?: boolean;
|
||||
ignoreIfNotExists?: boolean;
|
||||
};
|
||||
}
|
||||
export interface WorkspaceEdit {
|
||||
changes?: {
|
||||
[uri: string]: TextEdit[];
|
||||
};
|
||||
documentChanges?: (TextDocumentEdit | CreateFile | RenameFile | DeleteFile)[];
|
||||
}
|
||||
export interface PrepareRenameResult {
|
||||
range: Range;
|
||||
placeholder?: string;
|
||||
}
|
||||
export interface PrepareRenameDefaultBehavior {
|
||||
defaultBehavior: boolean;
|
||||
}
|
||||
export interface ServerLookupInfo {
|
||||
id: string;
|
||||
command: string[];
|
||||
extensions: string[];
|
||||
}
|
||||
export type ServerLookupResult = {
|
||||
status: "found";
|
||||
server: ResolvedServer;
|
||||
} | {
|
||||
status: "not_configured";
|
||||
extension: string;
|
||||
availableServers: string[];
|
||||
} | {
|
||||
status: "not_installed";
|
||||
server: ServerLookupInfo;
|
||||
installHint: string;
|
||||
};
|
||||
export interface ResolvedServer {
|
||||
id: string;
|
||||
command: string[];
|
||||
extensions: string[];
|
||||
priority: number;
|
||||
env?: Record<string, string>;
|
||||
initialization?: Record<string, unknown>;
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
import type { WorkspaceEdit } from "./types";
|
||||
export interface ApplyResult {
|
||||
success: boolean;
|
||||
filesModified: string[];
|
||||
totalEdits: number;
|
||||
errors: string[];
|
||||
}
|
||||
export declare function applyWorkspaceEdit(edit: WorkspaceEdit | null): ApplyResult;
|
||||
Reference in New Issue
Block a user