lspserver

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package lspserver implements a Language Server Protocol server for tally.

The server provides Dockerfile linting diagnostics, quick-fix code actions, and document formatting through the LSP protocol. It reuses the same lint pipeline as the CLI (dockerfile.Parse, semantic model, rules, processors).

Transport: stdio only (--stdio). Protocol: LSP 3.17 types via internal/lsp/protocol, JSON-RPC via golang.org/x/exp/jsonrpc2.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Document

type Document struct {
	// URI is the document URI (e.g., "file:///path/to/Dockerfile").
	URI string

	// LanguageID is the language identifier (e.g., "dockerfile").
	LanguageID string

	// Version is the document version as reported by the client.
	Version int32

	// Content is the current full text of the document.
	Content string
}

Document represents an open text document tracked by the LSP server.

type DocumentStore

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

DocumentStore manages open documents in the LSP server. It is safe for concurrent access.

func NewDocumentStore

func NewDocumentStore() *DocumentStore

NewDocumentStore creates a new empty document store.

func (*DocumentStore) All

func (s *DocumentStore) All() []*Document

All returns a snapshot slice of all currently open documents.

func (*DocumentStore) Close

func (s *DocumentStore) Close(uri string)

Close removes a document from the store.

func (*DocumentStore) Get

func (s *DocumentStore) Get(uri string) *Document

Get retrieves a document by URI. Returns nil if not found.

func (*DocumentStore) Open

func (s *DocumentStore) Open(uri, languageID string, version int32, content string)

Open adds or replaces a document in the store.

func (*DocumentStore) Update

func (s *DocumentStore) Update(uri string, version int32, content string) bool

Update replaces the content and version of an existing document. Returns false if the document is not open.

type Server

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

Server is the tally LSP server.

func New

func New() *Server

New creates a new LSP server.

func (*Server) RunStdio

func (s *Server) RunStdio(ctx context.Context) error

RunStdio starts the LSP server on stdin/stdout. It blocks until the connection is closed or the context is cancelled.

Jump to

Keyboard shortcuts

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