Documentation
¶
Overview ¶
Package eventbus provides facilities for asynchronous processing of events mediated by a type-safe bus.
Index ¶
- type ChangeWatchEvent
- type DiagnosticsEvent
- type EditEvent
- type EventBus
- func (b *EventBus) PublishChangeWatchEvent(e ChangeWatchEvent)
- func (b *EventBus) PublishDiagnosticsEvent(e DiagnosticsEvent)
- func (b *EventBus) PublishEditEvent(e EditEvent)
- func (b *EventBus) PublishNoCRDSourcesEvent(e NoCRDSourcesEvent)
- func (b *EventBus) PublishOpenEvent(e OpenEvent)
- func (b *EventBus) SubscribeToChangeWatchEvents(identifier string) <-chan ChangeWatchEvent
- func (b *EventBus) SubscribeToDiagnosticsEvents(identifier string) <-chan DiagnosticsEvent
- func (b *EventBus) SubscribeToEditEvents(identifier string) <-chan EditEvent
- func (b *EventBus) SubscribeToNoCRDSourcesEvents(identifier string) <-chan NoCRDSourcesEvent
- func (b *EventBus) SubscribeToOpenEvents(identifier string) <-chan OpenEvent
- type NoCRDSourcesEvent
- type OpenEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChangeWatchEvent ¶
type ChangeWatchEvent struct {
// RawPath contains an OS specific path to the file or directory that was
// changed. Usually extracted from the URI.
RawPath string
// IsDir is true if we were able to determine that the path is a directory.
// This is not set for delete events.
IsDir bool
// ChangeType specifies if the file or directory was created, updated, or deleted.
ChangeType protocol.FileChangeType
}
ChangeWatchEvent is the event that is emitted when a client notifies the language server that a directory or file was changed outside the editor.
type DiagnosticsEvent ¶
type DiagnosticsEvent struct {
Doc document.Handle
Diags hcl.Diagnostics
}
DiagnosticsEvent is an event to signal that diagnostics are available for a file.
It is emitted after parsing a file to notify the language server to publish diagnostics to the client.
type EditEvent ¶
EditEvent is an event to signal that a file in a directory has changed.
It is usually emitted when a document is changed via a language server text edit event.
type EventBus ¶
type EventBus struct {
// contains filtered or unexported fields
}
EventBus is a simple event bus that allows for subscribing to and publishing events of a specific type.
It has a static list of topics. Each topic can have multiple subscribers. When an event is published to a topic, it is sent to all subscribers.
func (*EventBus) PublishChangeWatchEvent ¶
func (b *EventBus) PublishChangeWatchEvent(e ChangeWatchEvent)
PublishChangeWatchEvent publishes a change watch event.
func (*EventBus) PublishDiagnosticsEvent ¶
func (b *EventBus) PublishDiagnosticsEvent(e DiagnosticsEvent)
PublishDiagnosticsEvent publishes a diagnostics event.
func (*EventBus) PublishEditEvent ¶
PublishEditEvent publishes a document edit event.
func (*EventBus) PublishNoCRDSourcesEvent ¶
func (b *EventBus) PublishNoCRDSourcesEvent(e NoCRDSourcesEvent)
PublishNoCRDSourcesEvent publishes a no CRD sources event.
func (*EventBus) PublishOpenEvent ¶
PublishOpenEvent publishes a document open event.
func (*EventBus) SubscribeToChangeWatchEvents ¶
func (b *EventBus) SubscribeToChangeWatchEvents(identifier string) <-chan ChangeWatchEvent
SubscribeToChangeWatchEvents adds a subscriber to process change watch events.
func (*EventBus) SubscribeToDiagnosticsEvents ¶
func (b *EventBus) SubscribeToDiagnosticsEvents(identifier string) <-chan DiagnosticsEvent
SubscribeToDiagnosticsEvents adds a subscriber to process diagnostics events.
func (*EventBus) SubscribeToEditEvents ¶
SubscribeToEditEvents adds a subscriber to process document edit events.
func (*EventBus) SubscribeToNoCRDSourcesEvents ¶
func (b *EventBus) SubscribeToNoCRDSourcesEvents(identifier string) <-chan NoCRDSourcesEvent
SubscribeToNoCRDSourcesEvents adds a subscriber to process no CRD sources events.
func (*EventBus) SubscribeToOpenEvents ¶
SubscribeToOpenEvents adds a subscriber to process a document open event.
type NoCRDSourcesEvent ¶
type NoCRDSourcesEvent struct {
Dir string // workspace directory with no CRD config
}
NoCRDSourcesEvent is an event to signal that no CRD sources were found for a workspace directory. This is used to prompt the user to configure CRD sources.