Skip to content

[FEAT] S6: lsp_hover tool — type info + docs at position via LSP #30

Description

@four-bytes-robby

Purpose

Build the lsp_hover tool for Wave S6 (IDE Integration). Gets type information and documentation for a symbol at a given file position using LSP.

Implementation Plan

  1. Create src/tools/lsp-hover.ts — tool implementation
  2. Register in src/four-opencode-supertools.ts
  3. Write tests covering: mock LSP server, no-server fallback, file-not-found, no-hover-info, doc truncation

Tool Definition

  • Name: lsp_hover
  • Permission: read
  • Args: file_path (string, required), line (number, required), character (number, optional, default 1)

Output Schema

```ts
interface LspHoverOutput {
available: boolean
file: string
position: { line: number; character: number }
type?: string
documentation?: string
fullContents?: string
hint?: string
}
```

Edge Cases

  • No LSP server for language → { available: false, hint, suggestion }
  • Server timeout → graceful degradation
  • File not found → clear error
  • No hover info at position → { available: true, type: \"no information at this position\" }
  • Long documentation → truncate at 2000 chars with "…truncated" note

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions