From 360e5456660678a0babab602e0bc80304a55db3f Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 19 Jun 2026 08:23:44 +0300 Subject: ok0 document LSP and LLM exports --- internal/llm/anthropic.go | 1 + internal/llm/ollama.go | 1 + internal/llm/openai.go | 1 + internal/llm/openrouter.go | 1 + internal/llm/yousearch.go | 1 + internal/lsp/chat_handlers.go | 1 + internal/lsp/context.go | 1 + internal/lsp/document.go | 1 + internal/lsp/handlers.go | 1 + internal/lsp/handlers_codeaction.go | 3 +++ internal/lsp/handlers_completion.go | 1 + internal/lsp/handlers_document.go | 1 + internal/lsp/handlers_execute.go | 1 + internal/lsp/handlers_ignore.go | 1 + internal/lsp/handlers_init.go | 1 + internal/lsp/handlers_utils.go | 1 + internal/lsp/server.go | 2 ++ internal/lsp/transport.go | 1 + internal/lsp/types.go | 1 + 19 files changed, 22 insertions(+) (limited to 'internal') diff --git a/internal/llm/anthropic.go b/internal/llm/anthropic.go index 6ed808f..a1db97c 100644 --- a/internal/llm/anthropic.go +++ b/internal/llm/anthropic.go @@ -1,4 +1,5 @@ // Anthropic client implementation using Messages API with optional streaming support. + package llm import ( diff --git a/internal/llm/ollama.go b/internal/llm/ollama.go index 92fece8..b2764f2 100644 --- a/internal/llm/ollama.go +++ b/internal/llm/ollama.go @@ -1,6 +1,7 @@ // Ollama client supporting both a local server and Ollama Cloud (ollama.ai). // The optional API key is sent as a Bearer token; when empty, requests are // unauthenticated so a local Ollama server keeps working unchanged. + package llm import ( diff --git a/internal/llm/openai.go b/internal/llm/openai.go index 25696ce..0ec34ab 100644 --- a/internal/llm/openai.go +++ b/internal/llm/openai.go @@ -1,4 +1,5 @@ // OpenAI client implementation for chat completions with optional streaming and detailed logging. + package llm import ( diff --git a/internal/llm/openrouter.go b/internal/llm/openrouter.go index 567a2c0..080f539 100644 --- a/internal/llm/openrouter.go +++ b/internal/llm/openrouter.go @@ -1,4 +1,5 @@ // OpenRouter client implementation leveraging OpenAI-compatible helpers with provider-specific headers. + package llm import ( diff --git a/internal/llm/yousearch.go b/internal/llm/yousearch.go index 8990c26..ced18ba 100644 --- a/internal/llm/yousearch.go +++ b/internal/llm/yousearch.go @@ -1,6 +1,7 @@ // You.com Research API provider. Maps Chat() to a single research request using // the last user message as the query. System messages are ignored — the Research // API has its own reasoning pipeline. Sources are appended as a markdown section. + package llm import ( diff --git a/internal/lsp/chat_handlers.go b/internal/lsp/chat_handlers.go index 320be45..f0bfa78 100644 --- a/internal/lsp/chat_handlers.go +++ b/internal/lsp/chat_handlers.go @@ -4,6 +4,7 @@ // and applies the LLM reply back into the document. It reaches into Server (via // c.srv, aliased to s) for shared infrastructure such as LLM clients, document // access, config and edit dispatch. + package lsp import ( diff --git a/internal/lsp/context.go b/internal/lsp/context.go index 52ba3a5..62f0c7d 100644 --- a/internal/lsp/context.go +++ b/internal/lsp/context.go @@ -1,4 +1,5 @@ // Builds additional context snippets based on configured mode and truncates text by token heuristic. + package lsp import ( diff --git a/internal/lsp/document.go b/internal/lsp/document.go index 4938925..70a24d0 100644 --- a/internal/lsp/document.go +++ b/internal/lsp/document.go @@ -1,4 +1,5 @@ // In-memory document model for the LSP; tracks text, lines, and applies edits. + package lsp import ( diff --git a/internal/lsp/handlers.go b/internal/lsp/handlers.go index b06b5ea..d246d44 100644 --- a/internal/lsp/handlers.go +++ b/internal/lsp/handlers.go @@ -1,4 +1,5 @@ // LSP JSON-RPC handlers; implements core methods and integrates with the LLM client when enabled. + package lsp import ( diff --git a/internal/lsp/handlers_codeaction.go b/internal/lsp/handlers_codeaction.go index aba2113..d9f466c 100644 --- a/internal/lsp/handlers_codeaction.go +++ b/internal/lsp/handlers_codeaction.go @@ -1,4 +1,5 @@ // Code Action handlers and helpers split from handlers.go for clarity. + package lsp import ( @@ -36,7 +37,9 @@ type customActionPayload struct { // CodeActionHandler builds and resolves code actions for a specific action type. type CodeActionHandler interface { + // Build returns code actions for the requested document range. Build(s *Server, p CodeActionParams, selection string) []CodeAction + // Resolve completes a deferred code action before it is applied. Resolve(s *Server, action CodeAction, payload codeActionPayload) (CodeAction, bool) } diff --git a/internal/lsp/handlers_completion.go b/internal/lsp/handlers_completion.go index 5ae6cd4..700023b 100644 --- a/internal/lsp/handlers_completion.go +++ b/internal/lsp/handlers_completion.go @@ -2,6 +2,7 @@ // completionService (the extracted code-completion subsystem), which owns the // cache/throttle state and reaches back into Server (via cs.srv, aliased to s) // for shared infrastructure such as LLM clients, document access and stats. + package lsp import ( diff --git a/internal/lsp/handlers_document.go b/internal/lsp/handlers_document.go index 5b285ab..b8644f5 100644 --- a/internal/lsp/handlers_document.go +++ b/internal/lsp/handlers_document.go @@ -2,6 +2,7 @@ // helpers (workspace/applyEdit, window/showDocument). The in-editor chat logic // that used to live here was extracted into chatService (chat_handlers.go); // these handlers now delegate chat detection to s.chatSvc(). + package lsp import ( diff --git a/internal/lsp/handlers_execute.go b/internal/lsp/handlers_execute.go index f2f2fac..018df6e 100644 --- a/internal/lsp/handlers_execute.go +++ b/internal/lsp/handlers_execute.go @@ -1,4 +1,5 @@ // ExecuteCommand handler to support post-edit navigation (jump to generated test). + package lsp import ( diff --git a/internal/lsp/handlers_ignore.go b/internal/lsp/handlers_ignore.go index 716ea49..c66114d 100644 --- a/internal/lsp/handlers_ignore.go +++ b/internal/lsp/handlers_ignore.go @@ -1,4 +1,5 @@ // Helpers for gitignore-aware file filtering in LSP handlers. + package lsp import ( diff --git a/internal/lsp/handlers_init.go b/internal/lsp/handlers_init.go index d343338..faa7781 100644 --- a/internal/lsp/handlers_init.go +++ b/internal/lsp/handlers_init.go @@ -1,4 +1,5 @@ // Initialization and lifecycle handlers split from handlers.go. + package lsp import ( diff --git a/internal/lsp/handlers_utils.go b/internal/lsp/handlers_utils.go index 55affaf..b80f0fc 100644 --- a/internal/lsp/handlers_utils.go +++ b/internal/lsp/handlers_utils.go @@ -1,4 +1,5 @@ // Generic LSP helpers shared across handlers (LLM opts, prompts, text utils, counters). + package lsp import ( diff --git a/internal/lsp/server.go b/internal/lsp/server.go index 966ec90..fdf551c 100644 --- a/internal/lsp/server.go +++ b/internal/lsp/server.go @@ -91,7 +91,9 @@ type GlobalStatus struct { // StatusSink receives status updates from the LSP server. type StatusSink interface { + // SetLLMStart records the provider and model for an LLM request that is starting. SetLLMStart(provider, model string) error + // SetGlobal records aggregate LLM request and byte counters. SetGlobal(gs GlobalStatus) error } diff --git a/internal/lsp/transport.go b/internal/lsp/transport.go index 3547dfa..34d7484 100644 --- a/internal/lsp/transport.go +++ b/internal/lsp/transport.go @@ -1,4 +1,5 @@ // LSP transport utilities to read and write JSON-RPC messages with Content-Length framing. + package lsp import ( diff --git a/internal/lsp/types.go b/internal/lsp/types.go index ae1f644..84fb504 100644 --- a/internal/lsp/types.go +++ b/internal/lsp/types.go @@ -1,4 +1,5 @@ // LSP protocol types used by the server (requests, responses, params, capabilities). + package lsp import "encoding/json" -- cgit v1.2.3