Documentation
¶
Index ¶
- Constants
- Variables
- type Capabilities
- type File
- type Install
- type Location
- type Manager
- func (m *Manager) Available(root, family string) bool
- func (m *Manager) Close()
- func (m *Manager) Definition(ctx context.Context, request Request) ([]Location, error)
- func (m *Manager) Idle() time.Duration
- func (m *Manager) References(ctx context.Context, request Request) ([]Location, error)
- func (m *Manager) Refresh()
- func (m *Manager) ServerFor(family string) (Server, bool)
- func (m *Manager) Servers() []Server
- func (m *Manager) Start(ctx context.Context, root, family string) error
- func (m *Manager) Status(root, family string) (Status, bool)
- type Options
- type Position
- type Request
- type ResolvedServer
- type Server
- type State
- type Status
Constants ¶
const ( // DefaultIdle is how long a server may sit unused before it is stopped. DefaultIdle = 10 * time.Minute )
Variables ¶
var ErrMissing = errors.New("language server is not installed")
ErrMissing reports a server that is not installed.
var ErrNotReady = errors.New("language server is starting")
ErrNotReady reports a server still starting when a request gave up.
var ErrUnsupported = errors.New("language server does not support this request")
ErrUnsupported reports a request the server does not answer.
Functions ¶
This section is empty.
Types ¶
type Capabilities ¶
type Capabilities struct {
Definition bool `json:"definition"`
References bool `json:"references"`
}
Capabilities are the navigation methods negotiated with a running server.
type Install ¶
type Install struct {
Label string `json:"label"`
Command string `json:"command"`
Prerequisites []string `json:"prerequisites,omitempty"`
Docs string `json:"docs,omitempty"`
}
Install is host-specific guidance, never an automatically executed command. Command is empty for downloads that require following the linked documentation.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager runs language servers on demand: one per server and project root, started by the first request and stopped after Idle.
func NewManager ¶
NewManager creates a Manager for servers.
func (*Manager) Available ¶
Available reports whether a family's server is installed and not in its failure backoff, so requests may wait for it.
func (*Manager) Definition ¶
Definition asks the family's server where the symbol at a position is defined. It waits for a starting server until ctx ends, then returns ErrNotReady.
func (*Manager) References ¶
References asks the family's server for every use of the symbol at a position, including its declaration.
func (*Manager) Refresh ¶
func (m *Manager) Refresh()
Refresh forgets discovered binaries and failures, so newly installed servers are found and failed ones retried.
type Options ¶
type Options struct {
// Idle stops servers unused this long; zero means DefaultIdle.
Idle time.Duration
// LookPath finds a server binary; nil searches PATH and install dirs.
LookPath func(name string) (string, bool)
}
Options configure a Manager.
type Request ¶
type Request struct {
// Root is the project root; one server runs per root.
Root string
Family string
// Document is the queried file and Text its contents.
Document File
Text []byte
At Position
// Files are the project's files of the server's families, so the server
// learns about changes on disk.
Files []File
}
Request is one navigation query against a language server.
type ResolvedServer ¶
ResolvedServer identifies the selected executable without starting it.
type Server ¶
type Server struct {
// WorkspaceFiles are base-name globs for configuration change notifications.
WorkspaceFiles []string
Aliases []string
Name string
Args []string
Language string
Families map[string]string
Install []Install
Docs string
// NativeTypeScript selects TypeScript 7's native LSP before the classic adapter.
NativeTypeScript bool
// NodePackage identifies npm launchers on hosts that cannot execute shebangs.
NodePackage string
}
Server describes a deliberately supported language-server process.
type State ¶
type State string
State is a server's lifecycle state for a project.
const ( // StateMissing means the server binary was not found. StateMissing State = "missing" // StateStopped means the server is installed but not running. StateStopped State = "stopped" StateStarting State = "starting" StateReady State = "ready" // StateFailed means the last start failed or the server exited. StateFailed State = "failed" )