provider

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseContext

type BaseContext struct {
	Logger    *log.Entry
	File      *parser.File
	FileCache *cache.FileCache
	Project   *project.Project
}

type CodeActionContext

type CodeActionContext struct {
	BaseContext

	Range ts.Range

	Publish CodeActionPublish
}

type CodeActionProvider

type CodeActionProvider interface {
	ResolveCodeAction(CodeActionContext)
}

Interface that providers that supports code actions can implement.

type CodeActionPublish

type CodeActionPublish func(protocol.CodeAction)

type CompletionContext

type CompletionContext struct {
	BaseContext

	// File *parser.File
	Position ts.Point

	// Publish a completion item
	Publish CompletionPublish
}

type CompletionProvider

type CompletionProvider interface {
	// Resolve go to definition
	ResolveCompletion(CompletionContext)
}

Interface that providers that supports completion can implement

type CompletionPublish

type CompletionPublish func(protocol.CompletionItem)

type DefinitionContext

type DefinitionContext struct {
	BaseContext

	Position ts.Point

	// Publish a location
	Publish LocationPublisher
}

type DefinitionProvider

type DefinitionProvider interface {
	// Resolve go to definition
	ResolveDefinition(DefinitionContext)
}

Interface that providers that supports go to definition can implement

type Diagnostic

type Diagnostic struct {
	Range    ts.Range
	Severity protocol.DiagnosticSeverity
	Message  string
}

type DiagnosticContext

type DiagnosticContext struct {
	BaseContext
	Publish DiagnosticPublisher
}

type DiagnosticProvider

type DiagnosticProvider interface {
	Diagnostic(DiagnosticContext)
}

Interface that providers that supports diagnostics can implement

type DiagnosticPublisher

type DiagnosticPublisher func(Diagnostic)

type Hover

type Hover struct {
	Content string
	Range   *ts.Range
}

type HoverContext

type HoverContext struct {
	BaseContext
	Position ts.Point
	Publish  HoverPublisher
}

type HoverProvider

type HoverProvider interface {
	Hover(HoverContext)
}

Interface that providers that supports hover information can implement

type HoverPublisher

type HoverPublisher func(Hover)

type InitContext

type InitContext struct {
	Logger    *log.Entry
	RootPath  string
	FileCache *cache.FileCache
}

type Language

type Language struct {
	CompletionProviders  []CompletionProvider
	DiagnosticsProviders []DiagnosticProvider
	DefinitionProviders  []DefinitionProvider
	CodeActionProviders  []CodeActionProvider
	HoverProviders       []HoverProvider
}

type LocationPublisher

type LocationPublisher func(protocol.Location)

type Manager

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

func NewManager

func NewManager(providers ...Provider) *Manager

func (*Manager) Add

func (m *Manager) Add(providers ...Provider) *Manager

func (*Manager) CodeAction

func (m *Manager) CodeAction(ctx CodeActionContext)

func (*Manager) Completion

func (m *Manager) Completion(ctx CompletionContext)

func (*Manager) Diagnostics

func (m *Manager) Diagnostics(ctx DiagnosticContext)

func (*Manager) Hover

func (m *Manager) Hover(ctx HoverContext)

func (*Manager) Init

func (m *Manager) Init(ctx InitContext)

func (*Manager) Register

func (m *Manager) Register(typ file.Type, provider any)

func (*Manager) ResolveDefinition

func (m *Manager) ResolveDefinition(ctx DefinitionContext)

type Provider

type Provider interface {
	Register(manager *Manager)
	Init(ctx InitContext)
}

Jump to

Keyboard shortcuts

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