lspServerManager

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultServerConfigs

func DefaultServerConfigs() map[string]ServerConfig

DefaultServerConfigs returns default LSP server configurations

Types

type Manager

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

Manager manages multiple LSP server instances

func NewManager

func NewManager(workingDir string) *Manager

NewManager creates a new LSP server manager

func (*Manager) CloseFile

func (m *Manager) CloseFile(ctx context.Context, filePath string) error

CloseFile closes a file in the LSP server

func (*Manager) GetAllServers

func (m *Manager) GetAllServers() map[string]*ServerInstance

GetAllServers returns all running servers

func (*Manager) GetAvailableServers

func (m *Manager) GetAvailableServers() []string

GetAvailableServers returns a list of available server names

func (*Manager) GetServerForFile

func (m *Manager) GetServerForFile(filePath string) *ServerInstance

GetServerForFile returns the server for a given file

func (*Manager) GetStatus

func (m *Manager) GetStatus() map[string]ServerState

GetStatus returns the status of all servers

func (*Manager) Initialize

func (m *Manager) Initialize(ctx context.Context) error

Initialize initializes all configured LSP servers

func (*Manager) InitializeForFile

func (m *Manager) InitializeForFile(ctx context.Context, filePath string) (*ServerInstance, error)

InitializeForFile initializes the appropriate LSP server for a file

func (*Manager) InitializeServer

func (m *Manager) InitializeServer(ctx context.Context, serverName string) (*ServerInstance, error)

InitializeServer initializes a specific LSP server

func (*Manager) IsFileOpen

func (m *Manager) IsFileOpen(filePath string) bool

IsFileOpen checks if a file is open in any LSP server

func (*Manager) OpenFile

func (m *Manager) OpenFile(ctx context.Context, filePath string) error

OpenFile opens a file in the appropriate LSP server

func (*Manager) SendRequest

func (m *Manager) SendRequest(ctx context.Context, filePath string, method string, params interface{}) (interface{}, error)

SendRequest sends a request to the appropriate LSP server for a file

func (*Manager) SetConfigs

func (m *Manager) SetConfigs(configs map[string]ServerConfig)

SetConfigs sets custom server configurations

func (*Manager) Shutdown

func (m *Manager) Shutdown(ctx context.Context) error

Shutdown shuts down all LSP servers

type ServerConfig

type ServerConfig struct {
	// Command is the command to start the LSP server
	Command string

	// Args are the command-line arguments
	Args []string

	// Env is the environment variables
	Env []string

	// RootPatterns are the root marker patterns
	RootPatterns []string

	// ExtensionToLanguage maps file extensions to language IDs
	ExtensionToLanguage map[string]string

	// Languages is the list of languages this server supports
	Languages []string

	// Timeout is the initialization timeout
	Timeout time.Duration
}

ServerConfig represents LSP server configuration

type ServerInstance

type ServerInstance struct {
	Name   string
	Config ServerConfig
	Client *lspClient.Client
	State  ServerState
	// contains filtered or unexported fields
}

ServerInstance represents a running LSP server instance

type ServerState

type ServerState string

ServerState represents the state of a server

const (
	ServerStateStopped  ServerState = "stopped"
	ServerStateStarting ServerState = "starting"
	ServerStateRunning  ServerState = "running"
	ServerStateError    ServerState = "error"
	ServerStateStopping ServerState = "stopping"
)

Jump to

Keyboard shortcuts

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