Help us shape the future of Go! Take the 2026 Go Developer Survey

ulspplugin

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// MethodEndSession is an additional method outside of LSP protocol, which is called when the JSON-RPC connection has been closed.
	// This should be used to ensure cleanup of resources even if the client exits before calling 'shutdown' and 'exit'.
	MethodEndSession = "end_session"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MethodLists

type MethodLists struct {
	Sync  []*Methods
	Async []*Methods
}

MethodLists maintains ordered list of modules to run, segmented by sync and async.

type Methods

type Methods struct {
	// PluginNameKey identifies the name of the plugin that provides these method implementations.
	PluginNameKey string

	// Lifecycle related methods.
	Initialize  func(ctx context.Context, params *protocol.InitializeParams, result *protocol.InitializeResult) error
	Initialized func(ctx context.Context, params *protocol.InitializedParams) error
	Shutdown    func(ctx context.Context) error
	Exit        func(ctx context.Context) error

	// Document related methods.
	DidChange             func(ctx context.Context, params *protocol.DidChangeTextDocumentParams) error
	DidChangeWatchedFiles func(ctx context.Context, params *protocol.DidChangeWatchedFilesParams) error
	DidOpen               func(ctx context.Context, params *protocol.DidOpenTextDocumentParams) error
	DidClose              func(ctx context.Context, params *protocol.DidCloseTextDocumentParams) error
	WillSave              func(ctx context.Context, params *protocol.WillSaveTextDocumentParams) error
	WillSaveWaitUntil     func(ctx context.Context, params *protocol.WillSaveTextDocumentParams, result *[]protocol.TextEdit) error
	DidSave               func(ctx context.Context, params *protocol.DidSaveTextDocumentParams) error
	WillRenameFiles       func(ctx context.Context, params *protocol.RenameFilesParams, result *protocol.WorkspaceEdit) error
	DidRenameFiles        func(ctx context.Context, params *protocol.RenameFilesParams) error
	WillCreateFiles       func(ctx context.Context, params *protocol.CreateFilesParams, result *protocol.WorkspaceEdit) error
	DidCreateFiles        func(ctx context.Context, params *protocol.CreateFilesParams) error
	WillDeleteFiles       func(ctx context.Context, params *protocol.DeleteFilesParams, result *protocol.WorkspaceEdit) error
	DidDeleteFiles        func(ctx context.Context, params *protocol.DeleteFilesParams) error

	// Codeintel related methods.
	CodeAction      func(ctx context.Context, params *protocol.CodeActionParams, result *[]protocol.CodeAction) error
	CodeLens        func(ctx context.Context, params *protocol.CodeLensParams, result *[]protocol.CodeLens) error
	CodeLensRefresh func(ctx context.Context) error
	CodeLensResolve func(ctx context.Context, params *protocol.CodeLens, result *protocol.CodeLens) error

	GotoDeclaration    func(ctx context.Context, params *protocol.DeclarationParams, result *[]protocol.LocationLink) error
	GotoDefinition     func(ctx context.Context, params *protocol.DefinitionParams, result *[]protocol.LocationLink) error
	GotoTypeDefinition func(ctx context.Context, params *protocol.TypeDefinitionParams, result *[]protocol.LocationLink) error
	GotoImplementation func(ctx context.Context, params *protocol.ImplementationParams, result *[]protocol.LocationLink) error
	References         func(ctx context.Context, params *protocol.ReferenceParams, result *[]protocol.Location) error
	Hover              func(ctx context.Context, params *protocol.HoverParams, result *protocol.Hover) error
	DocumentSymbol     func(ctx context.Context, params *protocol.DocumentSymbolParams, result *[]protocol.DocumentSymbol) error

	// Workspace related methods.
	ExecuteCommand func(ctx context.Context, params *protocol.ExecuteCommandParams) error

	// Window related Features
	WorkDoneProgressCancel func(ctx context.Context, params *protocol.WorkDoneProgressCancelParams) error

	// Connection related methods outside of the LSP protocol.
	EndSession func(ctx context.Context, uuid uuid.UUID) error
}

Methods defines methods which can be optionally implemented by a module, based on the protocol.Server interface.

type Plugin

type Plugin interface {
	StartupInfo(ctx context.Context) (PluginInfo, error)
}

Plugin defines a plugin which contributes a portion of language server functionality.

type PluginInfo

type PluginInfo struct {
	Priorities map[string]Priority
	Methods    *Methods
	NameKey    string
	// Optional set of monorepos for which this plugin should be enabled.
	RelevantRepos map[entity.MonorepoName]struct{}
}

PluginInfo provides both prioritization for each method, as well as access to call each method implemented by this plugin.

func (*PluginInfo) Validate

func (m *PluginInfo) Validate() error

Validate provides runtime validation that the a Plugin implementation returns valid PluginInfo.

type Priority

type Priority int64

Priority represents the ranked priority in which a plugin method will be run for a given method.

const (
	// PriorityHigh for plugin methods that should be run in the highest priority group.
	PriorityHigh Priority = iota
	// PriorityRegular for plugins methods that should be run with regular priority.
	PriorityRegular
	// PriorityAsync for plugin methods should be run asynchronously and won't be included in the response.
	PriorityAsync
)

type RuntimePrioritizedMethods

type RuntimePrioritizedMethods map[string]MethodLists

RuntimePrioritizedMethods represents ordered list of modules to run for a given method.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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