nrepl

package
v0.6.5-rc32 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: EPL-1.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BencodeDecode

func BencodeDecode(r io.Reader) (interface{}, error)

BencodeDecode reads one bencoded value from the reader. Returns string, int64, []interface{}, or map[string]interface{}.

func BencodeEncode

func BencodeEncode(v interface{}) ([]byte, error)

BencodeEncode encodes a value to bencode format. Supported types: string, int/int64, []interface{}, map[string]interface{}.

Types

type Client

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

Client connects to a running nREPL server.

func Connect

func Connect(host string, port int) (*Client, error)

Connect dials an nREPL server and clones a session.

func (*Client) Close

func (c *Client) Close() error

Close closes the session and connection.

func (*Client) Completions

func (c *Client) Completions(prefix, ns string) ([]CompletionEntry, error)

Completions requests completions for prefix in the given namespace.

func (*Client) Eval

func (c *Client) Eval(code string) (value, ns, out string, err error)

Eval sends code to the server for evaluation. It returns the printed value, the current namespace, any stdout output, and any error. Stdout output is accumulated from "out" messages.

func (*Client) NS

func (c *Client) NS() string

NS returns the current namespace from the server.

type CompletionEntry

type CompletionEntry struct {
	Candidate string
	NS        string // namespace the symbol is defined in
	Type      string // "namespace", "function", etc.
}

CompletionEntry holds a completion candidate with optional metadata.

type Server

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

Server is a minimal nREPL server for editor integration.

func Start

func Start(host string, port int, portFile string) (*Server, error)

Start creates and starts an nREPL server on the given host and port. Port 0 means auto-assign a free port.

func (*Server) Host

func (s *Server) Host() string

Host returns the host the server is listening on.

func (*Server) Port

func (s *Server) Port() int

Port returns the port the server is listening on.

func (*Server) Serve

func (s *Server) Serve()

Serve accepts connections in a loop. Blocks until Stop is called.

func (*Server) Stop

func (s *Server) Stop()

Stop shuts down the server and cleans up the port file.

type Session

type Session struct {
	ID string
	NS string // current namespace name
}

Session tracks per-session state for an nREPL client.

Jump to

Keyboard shortcuts

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