mapper

package
v0.1.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendFileOperationRegistrationOptions

AppendFileOperationRegistrationOptions combines two FileOperationRegistrationOptions into a single new result.

func AppendServerCapabilitiesWorkspaceFileOperations

AppendServerCapabilitiesWorkspaceFileOperations combines two ServerCapabilitiesWorkspaceFileOperations into a single new result.

func ApplyContentChanges

func ApplyContentChanges(initialText string, changes []protocol.TextDocumentContentChangeEvent) (string, error)

ApplyContentChanges applies the given content change events to a given text string.

func ContextToSessionUUID

func ContextToSessionUUID(c context.Context) (uuid.UUID, error)

ContextToSessionUUID extracts the UUID from a context

func DiffsToTextEdits

func DiffsToTextEdits(diffs []diffmatchpatch.Diff) ([]protocol.TextEdit, error)

DiffsToTextEdits converts diffs into to a list of text edits that can be applied to a document.

func EditOffsetsToTextEdits

func EditOffsetsToTextEdits(initialText bytes.Buffer, edits []EditOffset) ([]protocol.TextEdit, error)

EditOffsetsToTextEdits converts a list of offset based edits to TextEdits formatted for LSP protocol.

func InitalizeResultAppendServerCapabilitiesWorkspaceFileOperations

func InitalizeResultAppendServerCapabilitiesWorkspaceFileOperations(initResult *protocol.InitializeResult, workspaceFileOperations *protocol.ServerCapabilitiesWorkspaceFileOperations) error

InitalizeResultAppendServerCapabilitiesWorkspaceFileOperations appends ServerCapabilitiesWorkspaceFileOperations into an existing InitializeResult, adding to existing values if present or initializing an entry if not yet present.

func InitializeResultAppendCodeActionProvider

func InitializeResultAppendCodeActionProvider(initResult *protocol.InitializeResult, newOptions *protocol.CodeActionOptions) error

InitializeResultAppendCodeActionProvider appends a CodeActionProvider into an existing InitializeResult, adding to existing values if present or initializing an entry if not yet present.

func InitializeResultAppendExecuteCommandProvider

func InitializeResultAppendExecuteCommandProvider(initResult *protocol.InitializeResult, newOptions *protocol.ExecuteCommandOptions) error

InitializeResultAppendExecuteCommandProvider appends ExecuteCommandOptions into an existing InitializeResult. Commands must be unique across all plugins, and this function will fail if a duplicate is found.

func InitializeResultEnsureCodeLensProvider

func InitializeResultEnsureCodeLensProvider(initResult *protocol.InitializeResult, enableResolveProvider bool) error

InitializeResultEnsureCodeLensProvider ensures that a CodeLensProvider is present in an existing InitializeResult, initializing an entry if not yet present. If enableResolveProvider is true in at least one call across all plugins, then the final result for ResolveProvider will be true.

func InitializeResultEnsureDeclarationProvider

func InitializeResultEnsureDeclarationProvider(initResult *protocol.InitializeResult, workDoneProgress bool)

InitializeResultEnsureDeclarationProvider ensures the declaration provider capability is set

func InitializeResultEnsureDefinitionProvider

func InitializeResultEnsureDefinitionProvider(initResult *protocol.InitializeResult, workDoneProgress bool)

InitializeResultEnsureDefinitionProvider ensures the definition provider capability is set

func InitializeResultEnsureDocumentSymbolProvider

func InitializeResultEnsureDocumentSymbolProvider(initResult *protocol.InitializeResult, workDoneProgress bool)

InitializeResultEnsureDocumentSymbolProvider ensures the document symbol provider capability is set

func InitializeResultEnsureHoverProvider

func InitializeResultEnsureHoverProvider(initResult *protocol.InitializeResult, workDoneProgress bool)

InitializeResultEnsureHoverProvider ensures the hover provider capability is set

func InitializeResultEnsureImplementationProvider

func InitializeResultEnsureImplementationProvider(initResult *protocol.InitializeResult, workDoneProgress bool)

InitializeResultEnsureImplementationProvider ensures the implementation provider capability is set

func InitializeResultEnsureReferencesProvider

func InitializeResultEnsureReferencesProvider(initResult *protocol.InitializeResult, workDoneProgress bool)

InitializeResultEnsureReferencesProvider ensures the references provider capability is set

func InitializeResultEnsureTypeDefinitionProvider

func InitializeResultEnsureTypeDefinitionProvider(initResult *protocol.InitializeResult, workDoneProgress bool)

InitializeResultEnsureTypeDefinitionProvider ensures the type definition provider capability is set

func ModelToSession

func ModelToSession(f *model.Session) (*entity.Session, error)

ModelToSession maps a model Session to its entity equivalent.

func ModelToUlspDaemon

func ModelToUlspDaemon(f *model.UlspDaemon) (*entity.UlspDaemon, error)

ModelToUlspDaemon maps a model UlspDaemon to its entity equvialent.

func NewCodeAction

func NewCodeAction(title string, command string, kind protocol.CodeActionKind, arguments interface{}) protocol.CodeAction

NewCodeAction creates a new CodeAction with the given values.

func NewCodeLens

func NewCodeLens(placementRange protocol.Range, title string, command string, arguments interface{}) protocol.CodeLens

NewCodeLens creates a new CodeLens with the given values.

func PluginInfoToRuntimePrioritizedMethods

func PluginInfoToRuntimePrioritizedMethods(allPluginInfo []ulspplugin.PluginInfo) (ulspplugin.RuntimePrioritizedMethods, error)

PluginInfoToRuntimePrioritizedMethods maps all PluginInfo from running plugins, into a prioritized list of modules to run per method.

func PositionsToRange

func PositionsToRange(start, end protocol.Position) protocol.Range

PositionsToRange converts two positions into a range.

func RequestToCodeActionParams

func RequestToCodeActionParams(req jsonrpc2.Request) (*protocol.CodeActionParams, error)

RequestToCodeActionParams maps the parameters from a jsconrpc2.Request into protocol.CodeActionParams.

func RequestToCodeLens

func RequestToCodeLens(req jsonrpc2.Request) (*protocol.CodeLens, error)

RequestToCodeLens maps the parameters from a jsconrpc2.Request into protocol.CodeLens.

func RequestToCodeLensParams

func RequestToCodeLensParams(req jsonrpc2.Request) (*protocol.CodeLensParams, error)

RequestToCodeLensParams maps the parameters from a jsconrpc2.Request into protocol.CodeLensParams.

func RequestToCreateFilesParams

func RequestToCreateFilesParams(req jsonrpc2.Request) (*protocol.CreateFilesParams, error)

RequestToCreateFilesParams maps the parameters from a jsconrpc2.Request into protocol.CreateFilesParams.

func RequestToDeclarationParams

func RequestToDeclarationParams(req jsonrpc2.Request) (*protocol.DeclarationParams, error)

RequestToDeclarationParams maps the parameters from a jsonrpc2.Request into protocol.DeclarationParams

func RequestToDefinitionParams

func RequestToDefinitionParams(req jsonrpc2.Request) (*protocol.DefinitionParams, error)

RequestToDefinitionParams maps the parameters from a jsonrpc2.Request into protocol.DefinitionParams

func RequestToDeleteFilesParams

func RequestToDeleteFilesParams(req jsonrpc2.Request) (*protocol.DeleteFilesParams, error)

RequestToDeleteFilesParams maps the parameters from a jsconrpc2.Request into protocol.DeleteFilesParams.

func RequestToDidChangeTextDocumentParams

func RequestToDidChangeTextDocumentParams(req jsonrpc2.Request) (*protocol.DidChangeTextDocumentParams, error)

RequestToDidChangeTextDocumentParams maps the parameters from a jsconrpc2.Request into protocol.DidChangeTextDocumentParams.

func RequestToDidChangeWatchedFilesParams

func RequestToDidChangeWatchedFilesParams(req jsonrpc2.Request) (*protocol.DidChangeWatchedFilesParams, error)

RequestToDidChangeWatchedFilesParams maps the parameters from a jsconrpc2.Request into protocol.DidChangeWatchedFilesParams.

func RequestToDidCloseTextDocumentParams

func RequestToDidCloseTextDocumentParams(req jsonrpc2.Request) (*protocol.DidCloseTextDocumentParams, error)

RequestToDidCloseTextDocumentParams maps the parameters from a jsconrpc2.Request into protocol.DidCloseTextDocumentParams.

func RequestToDidOpenTextDocumentParams

func RequestToDidOpenTextDocumentParams(req jsonrpc2.Request) (*protocol.DidOpenTextDocumentParams, error)

RequestToDidOpenTextDocumentParams maps the parameters from a jsconrpc2.Request into protocol.DidOpenTextDocumentParams.

func RequestToDidSaveTextDocumentParams

func RequestToDidSaveTextDocumentParams(req jsonrpc2.Request) (*protocol.DidSaveTextDocumentParams, error)

RequestToDidSaveTextDocumentParams maps the parameters from a jsconrpc2.Request into protocol.DidSaveTextDocumentParams.

func RequestToDocumentSymbolParams

func RequestToDocumentSymbolParams(req jsonrpc2.Request) (*protocol.DocumentSymbolParams, error)

RequestToDocumentSymbolParams maps the parameters from a jsconrpc2.Request into protocol.DocumentSymbolParams

func RequestToExecuteCommandParams

func RequestToExecuteCommandParams(req jsonrpc2.Request) (*protocol.ExecuteCommandParams, error)

RequestToExecuteCommandParams maps the parameters from a jsconrpc2.Request into protocol.ExecuteCommandParams.

func RequestToHoverParams

func RequestToHoverParams(req jsonrpc2.Request) (*protocol.HoverParams, error)

RequestToHoverParams maps the parameters from a jsconrpc2.Request into protocol.HoverParams.

func RequestToImplementationParams

func RequestToImplementationParams(req jsonrpc2.Request) (*protocol.ImplementationParams, error)

RequestToImplementationParams maps the parameters from a jsonrpc2.Request into protocol.ImplementationParams

func RequestToInitializeParams

func RequestToInitializeParams(req jsonrpc2.Request) (*protocol.InitializeParams, error)

RequestToInitializeParams maps the parameters from a jsconrpc2.Request into protocol.InitializeParams.

func RequestToInitializedParams

func RequestToInitializedParams(req jsonrpc2.Request) (*protocol.InitializedParams, error)

RequestToInitializedParams maps the parameters from a jsconrpc2.Request into protocol.InitializedParams.

func RequestToReferencesParams

func RequestToReferencesParams(req jsonrpc2.Request) (*protocol.ReferenceParams, error)

RequestToReferencesParams maps the parameters from a jsonrpc2.Request into protocol.ReferencesParams

func RequestToRenameFilesParams

func RequestToRenameFilesParams(req jsonrpc2.Request) (*protocol.RenameFilesParams, error)

RequestToRenameFilesParams maps the parameters from a jsconrpc2.Request into protocol.RenameFilesParams.

func RequestToTypeDefinitionParams

func RequestToTypeDefinitionParams(req jsonrpc2.Request) (*protocol.TypeDefinitionParams, error)

RequestToTypeDefinitionParams maps the parameters from a jsonrpc2.Request into protocol.TypeDefinitionParams

func RequestToWillSaveTextDocumentParams

func RequestToWillSaveTextDocumentParams(req jsonrpc2.Request) (*protocol.WillSaveTextDocumentParams, error)

RequestToWillSaveTextDocumentParams maps the parameters from a jsconrpc2.Request into protocol.WillSaveTextDocumentParams.

func RequestToWorkDoneProgressCancelParams

func RequestToWorkDoneProgressCancelParams(req jsonrpc2.Request) (*protocol.WorkDoneProgressCancelParams, error)

RequestToWorkDoneProgressCancelParams maps the parameters from a jsconrpc2.Request into protocol.WorkDoneProgressCancelParams.

func SessionToModel

func SessionToModel(f *entity.Session) *model.Session

SessionToModel maps a Session entity to its model equivalent.

func SingleEditToApplyWorkspaceEditParams

func SingleEditToApplyWorkspaceEditParams(label string, doc protocol.TextDocumentIdentifier, editRange protocol.Range, newText string) *protocol.ApplyWorkspaceEditParams

SingleEditToApplyWorkspaceEditParams creates a ApplyWorkspaceEditParams with a single edit to be applied based on the specified parameters.

func UUIDToModel

func UUIDToModel(u uuid.UUID) *model.UlspDaemon

UUIDToModel maps a UUID to a UlspDaemon model. This is used to populate a UlspDaemon entity.

func UUIDToSession

func UUIDToSession(u uuid.UUID, c *jsonrpc2.Conn) *entity.Session

UUIDToSession initializes a new Session entity with the assigned uuid and connection.

func UlspDaemonToModel

func UlspDaemonToModel(f *entity.UlspDaemon) *model.UlspDaemon

UlspDaemonToModel maps an UlspDaemon entity to its model equvialent.

Types

type CodeActionWithRange

type CodeActionWithRange struct {
	CodeAction protocol.CodeAction
	Range      protocol.Range
}

CodeActionWithRange is a CodeAction that includes the range for which it is applicable.

func NewCodeActionWithRange

func NewCodeActionWithRange(placementRange protocol.Range, title string, command string, kind protocol.CodeActionKind, arguments interface{}) CodeActionWithRange

NewCodeActionWithRange creates a new CodeActionWithRange with the given values.

type EditOffset

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

EditOffset stores a string modification based on character offset in the string.

func DiffsToEditOffsets

func DiffsToEditOffsets(diffs []diffmatchpatch.Diff) (initialText bytes.Buffer, offsets []EditOffset)

DiffsToEditOffsets converts diffs into a list of text edits based on offsets within the initial text.

type RegexMatchResult

type RegexMatchResult struct {
	// Full range of the text match
	Range protocol.Range
	// Full text match
	TextMatch string
	// Ordered contents of capturing groups
	CapturingGroups []string
}

RegexMatchResult contains the result of a regular expression match.

func FindAllStringMatches

func FindAllStringMatches(regExp *regexp.Regexp, text string) []RegexMatchResult

FindAllStringMatches determines the protocol.Range and matching text value for all matches of a regular expression in a string.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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