debugadapter

package
v0.15.8 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Overview

Package debugadapter contains the language-specific edge of debugging: source target discovery, deterministic launch policy, and the descriptor for starting each language's standalone Debug Adapter Protocol process.

Protocol framing and session state remain in package dap.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiscoverJavaDebugBundles added in v0.15.0

func DiscoverJavaDebugBundles() []string

DiscoverJavaDebugBundles returns explicitly supplied JDT LS debug plug-ins.

func FindChromiumBrowser added in v0.15.0

func FindChromiumBrowser() string

FindChromiumBrowser returns an explicitly configured or standard system Chromium-family installation.

Types

type Breakpoint

type Breakpoint struct {
	FilePath string
	Line     int
	Column   int
}

type CommandExecutor added in v0.15.0

type CommandExecutor interface {
	ExecuteCommand(ctx context.Context, filePath string, content *string, command lsp.Command) (any, error)
}

CommandExecutor is the single language-service capability host connectors need: running a workspace-scoped LSP command against a source file. The composition layer injects the implementation so adapters never depend on service wiring.

type Connector

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

Connector bridges host-created adapters into the language-neutral DAP manager. At present only java-debug needs this path: its DAP socket is opened by JDT LS rather than a standalone executable.

func NewConnector

func NewConnector(commands CommandExecutor) *Connector

func (*Connector) ConnectAdapter

func (connector *Connector) ConnectAdapter(ctx context.Context, plan dap.Plan) (io.ReadWriteCloser, error)

func (*Connector) PrepareAdapter added in v0.15.3

func (connector *Connector) PrepareAdapter(ctx context.Context, plan dap.Plan) (dap.Plan, error)

PrepareAdapter resolves the Java launch details normally supplied by the VS Code Java extension. java-debug requires these values even though its DAP endpoint is already hosted inside JDT LS.

type LanguageAdapter

type LanguageAdapter interface {
	Language() string
	Descriptor() dap.AdapterDescriptor
	Matches(path string) bool
	Detect(path string, source []byte) ([]Target, error)
	Plan(Request) (Plan, error)
}

LanguageAdapter owns all stable language-specific behavior. Implementations must not execute user code while detecting targets or preparing a plan.

type Plan

type Plan struct {
	Title               string
	Summary             string
	ProjectDir          string
	Request             string
	IO                  dap.IOMode
	SupportsTerminal    bool
	Configuration       map[string]any
	Breakpoints         []Breakpoint
	FunctionBreakpoints []string
	PreLaunch           *dap.ProcessLaunch
}

type Registry

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

func NewRegistry

func NewRegistry(toolDirectories ...ToolDirectory) *Registry

NewRegistry accepts an optional managed-tool directory while keeping the no-argument form useful for source discovery and standalone callers.

func NewRegistryWith

func NewRegistryWith(adapters ...LanguageAdapter) *Registry

func (*Registry) Descriptors

func (registry *Registry) Descriptors() []dap.AdapterDescriptor

func (*Registry) DetectFile

func (registry *Registry) DetectFile(path string, source []byte) ([]Target, error)

func (*Registry) DetectWorkspace

func (registry *Registry) DetectWorkspace(ctx context.Context, root string) ([]Target, error)

func (*Registry) Plan

func (registry *Registry) Plan(language string, request Request) (Plan, error)

func (*Registry) ServerInitializations added in v0.15.0

func (registry *Registry) ServerInitializations() map[string]any

ServerInitializations returns the language-server initialization options required by hosted adapters, keyed by server name.

type Request

type Request struct {
	Action            string
	WorkspaceDir      string
	ProjectDir        string
	BrowserExecutable string
	Target            Target
}

type Target

type Target struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Detail    string `json:"detail,omitempty"`
	Kind      string `json:"kind"`
	Language  string `json:"language"`
	Path      string `json:"path"`
	Directory string `json:"directory"`
	Line      int    `json:"line"`
	Column    int    `json:"column"`
}

type ToolDirectory added in v0.15.0

type ToolDirectory interface {
	ToolDir(id string) string
}

ToolDirectory locates managed installations for adapters that load bundled files in addition to resolving an executable availability token.

Jump to

Keyboard shortcuts

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