lsp

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package lsp serves the seamark graph to editors over the Language Server Protocol. The JSON-RPC layer in this file is deliberately self-contained and minimal (Content-Length framing, request dispatch): LSP and MCP are both JSON-RPC 2.0 over stdio, and this transport is the piece both adapters share (RFC-001 §5, implementation note).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(opts Options, in io.Reader, out io.Writer) error

Serve runs the LSP server over in/out until the client disconnects or sends exit. The workspace index is built on startup when absent.

Types

type Options

type Options struct {
	// Root is the workspace directory as given by the client; it is
	// widened to the git toplevel exactly like `seamark index`, so an
	// editor that opens a repo SUBDIRECTORY still reads the repo's index
	// instead of creating a stray empty one.
	Root string
	// DBPath overrides the index location (default: <root>/.seamark/index.db).
	DBPath  string
	Version string
	// Logf receives progress and warnings; nil discards them. Must write
	// to stderr — stdout carries the protocol.
	Logf func(format string, args ...any)
}

Options configures Serve.

type Position

type Position struct {
	Line      uint32 `json:"line"`
	Character uint32 `json:"character"`
}

Position is zero-based; Line is all we use (seamark spans are line-grained, sidestepping LSP's UTF-16 column semantics).

type Range

type Range struct {
	Start Position `json:"start"`
	End   Position `json:"end"`
}

Range is a half-open [start, end) span.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server answers LSP requests from the seamark index. Requests are handled sequentially on one goroutine: didSave triggers a synchronous reindex (fast enough at repo scale; the daemon will make this incremental).

type TextDocumentIdentifier

type TextDocumentIdentifier struct {
	URI string `json:"uri"`
}

TextDocumentIdentifier names a document by URI.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL