lsp

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuiltinInfo added in v0.0.9

type BuiltinInfo struct {
	Name      string // e.g. "print"
	Signature string // e.g. "func print(args ...any)"
	Doc       string // e.g. "Prints values to stdout"
}

BuiltinInfo holds metadata for a builtin function or keyword-level construct.

type Document

type Document struct {
	URI     lsp.DocumentURI
	Content string
	Version int

	// Cached analysis results
	Program     *ast.Program
	SymbolTable *semantic.SymbolTable
	Errors      []error
	Lines       []string
}

Document represents an open document in the LSP

func (*Document) GetLineContent

func (doc *Document) GetLineContent(line int) string

GetLineContent returns the content of a specific line (0-indexed)

func (*Document) GetWordAtPosition

func (doc *Document) GetWordAtPosition(pos lsp.Position) string

GetWordAtPosition returns the word at the given position

func (*Document) OffsetToPosition

func (doc *Document) OffsetToPosition(offset int) lsp.Position

OffsetToPosition converts a byte offset to an LSP position

func (*Document) PositionToOffset

func (doc *Document) PositionToOffset(pos lsp.Position) int

PositionToOffset converts an LSP position to a byte offset

type DocumentStore

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

DocumentStore manages all open documents

func NewDocumentStore

func NewDocumentStore() *DocumentStore

NewDocumentStore creates a new document store

func (*DocumentStore) Close

func (ds *DocumentStore) Close(uri lsp.DocumentURI)

Close removes a document from the store

func (*DocumentStore) Get

func (ds *DocumentStore) Get(uri lsp.DocumentURI) *Document

Get retrieves a document by URI

func (*DocumentStore) Open

func (ds *DocumentStore) Open(uri lsp.DocumentURI, content string, version int) *Document

Open adds a new document to the store

func (*DocumentStore) Update

func (ds *DocumentStore) Update(uri lsp.DocumentURI, content string, version int) *Document

Update updates an existing document

type Server

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

Server implements the Kukicha Language Server Protocol

func NewServer

func NewServer(reader io.Reader, writer io.Writer) *Server

NewServer creates a new LSP server

func (*Server) Handle

func (s *Server) Handle(ctx context.Context, conn *jsonrpc2.Conn, req *jsonrpc2.Request)

Handle implements jsonrpc2.Handler

func (*Server) Run

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

Run starts the LSP server and processes requests

Jump to

Keyboard shortcuts

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