ls

package
v0.0.0-...-937ad84 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Fqbn                            string
	CliPath                         *paths.Path
	CliConfigPath                   *paths.Path
	ClangdPath                      *paths.Path
	CliDaemonAddress                string
	CliInstanceNumber               int
	FormatterConf                   *paths.Path
	EnableLogging                   bool
	SkipLibrariesDiscoveryOnRebuild bool
	DisableRealTimeDiagnostics      bool
	Jobs                            int
}

Config describes the language server configuration.

type DidCompleteBuildParams

type DidCompleteBuildParams struct {
	BuildOutputURI *lsp.DocumentURI `json:"buildOutputUri"`
}

DidCompleteBuildParams is a custom notification from the Arduino IDE, sent

type FunctionLogger

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

FunctionLogger is a lsp function logger

func NewLSPFunctionLogger

func NewLSPFunctionLogger(colofFunction func(format string, a ...interface{}) string, prefix string) *FunctionLogger

NewLSPFunctionLogger creates a new function logger

func (*FunctionLogger) Logf

func (l *FunctionLogger) Logf(format string, a ...interface{})

Logf logs the given message

type IDELSPServer

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

IDELSPServer is an IDE lsp server

func NewIDELSPServer

func NewIDELSPServer(logger jsonrpc.FunctionLogger, in io.Reader, out io.Writer, ls *INOLanguageServer) *IDELSPServer

NewIDELSPServer creates and return a new server

func (*IDELSPServer) ArduinoBuildCompleted

func (server *IDELSPServer) ArduinoBuildCompleted(logger jsonrpc.FunctionLogger, raw json.RawMessage)

ArduinoBuildCompleted handles "buildComplete" messages from the IDE

func (*IDELSPServer) CallHierarchyIncomingCalls

CallHierarchyIncomingCalls is not implemented

func (*IDELSPServer) CallHierarchyOutgoingCalls

CallHierarchyOutgoingCalls is not implemented

func (*IDELSPServer) CodeActionResolve

func (server *IDELSPServer) CodeActionResolve(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.CodeAction) (*lsp.CodeAction, *jsonrpc.ResponseError)

CodeActionResolve is not implemented

func (*IDELSPServer) CodeLensResolve

func (server *IDELSPServer) CodeLensResolve(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.CodeLens) (*lsp.CodeLens, *jsonrpc.ResponseError)

CodeLensResolve is not implemented

func (*IDELSPServer) CompletionItemResolve

func (server *IDELSPServer) CompletionItemResolve(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.CompletionItem) (*lsp.CompletionItem, *jsonrpc.ResponseError)

CompletionItemResolve is not implemented

func (*IDELSPServer) DocumentLinkResolve

func (server *IDELSPServer) DocumentLinkResolve(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.DocumentLink) (*lsp.DocumentLink, *jsonrpc.ResponseError)

DocumentLinkResolve is not implemented

func (*IDELSPServer) Exit

func (server *IDELSPServer) Exit(logger jsonrpc.FunctionLogger)

Exit sends an exit notification

func (*IDELSPServer) Initialize

Initialize sends an initilize request

func (*IDELSPServer) Initialized

func (server *IDELSPServer) Initialized(logger jsonrpc.FunctionLogger, params *lsp.InitializedParams)

Initialized sends an initialized notification

func (*IDELSPServer) Progress

func (server *IDELSPServer) Progress(logger jsonrpc.FunctionLogger, params *lsp.ProgressParams)

Progress is not implemented

func (*IDELSPServer) Run

func (server *IDELSPServer) Run()

Run runs the server connection

func (*IDELSPServer) SetTrace

func (server *IDELSPServer) SetTrace(logger jsonrpc.FunctionLogger, params *lsp.SetTraceParams)

SetTrace sends a set trace notification

func (*IDELSPServer) Shutdown

func (server *IDELSPServer) Shutdown(ctx context.Context, logger jsonrpc.FunctionLogger) *jsonrpc.ResponseError

Shutdown sends a shutdown request

func (*IDELSPServer) TextDocumentCodeAction

func (server *IDELSPServer) TextDocumentCodeAction(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.CodeActionParams) ([]lsp.CommandOrCodeAction, *jsonrpc.ResponseError)

TextDocumentCodeAction sends a request for text document code action

func (*IDELSPServer) TextDocumentCodeLens

func (server *IDELSPServer) TextDocumentCodeLens(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.CodeLensParams) ([]lsp.CodeLens, *jsonrpc.ResponseError)

TextDocumentCodeLens is not implemented

func (*IDELSPServer) TextDocumentColorPresentation

func (server *IDELSPServer) TextDocumentColorPresentation(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.ColorPresentationParams) ([]lsp.ColorPresentation, *jsonrpc.ResponseError)

TextDocumentColorPresentation is not implemented

func (*IDELSPServer) TextDocumentCompletion

func (server *IDELSPServer) TextDocumentCompletion(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.CompletionParams) (*lsp.CompletionList, *jsonrpc.ResponseError)

TextDocumentCompletion is not implemented

func (*IDELSPServer) TextDocumentDeclaration

func (server *IDELSPServer) TextDocumentDeclaration(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.DeclarationParams) ([]lsp.Location, []lsp.LocationLink, *jsonrpc.ResponseError)

TextDocumentDeclaration is not implemented

func (*IDELSPServer) TextDocumentDefinition

func (server *IDELSPServer) TextDocumentDefinition(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.DefinitionParams) ([]lsp.Location, []lsp.LocationLink, *jsonrpc.ResponseError)

TextDocumentDefinition sends a request to define a text document

func (*IDELSPServer) TextDocumentDidChange

func (server *IDELSPServer) TextDocumentDidChange(logger jsonrpc.FunctionLogger, params *lsp.DidChangeTextDocumentParams)

TextDocumentDidChange sends a notification the a text document has changed

func (*IDELSPServer) TextDocumentDidClose

func (server *IDELSPServer) TextDocumentDidClose(logger jsonrpc.FunctionLogger, params *lsp.DidCloseTextDocumentParams)

TextDocumentDidClose sends a notification the a text document has been closed

func (*IDELSPServer) TextDocumentDidOpen

func (server *IDELSPServer) TextDocumentDidOpen(logger jsonrpc.FunctionLogger, params *lsp.DidOpenTextDocumentParams)

TextDocumentDidOpen sends a notification the a text document is open

func (*IDELSPServer) TextDocumentDidSave

func (server *IDELSPServer) TextDocumentDidSave(logger jsonrpc.FunctionLogger, params *lsp.DidSaveTextDocumentParams)

TextDocumentDidSave sends a notification the a text document has been saved

func (*IDELSPServer) TextDocumentDocumentColor

func (server *IDELSPServer) TextDocumentDocumentColor(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.DocumentColorParams) ([]lsp.ColorInformation, *jsonrpc.ResponseError)

TextDocumentDocumentColor is not implemented

func (*IDELSPServer) TextDocumentDocumentHighlight

func (server *IDELSPServer) TextDocumentDocumentHighlight(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.DocumentHighlightParams) ([]lsp.DocumentHighlight, *jsonrpc.ResponseError)

TextDocumentDocumentHighlight sends a request to highlight a text document

func (server *IDELSPServer) TextDocumentDocumentLink(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.DocumentLinkParams) ([]lsp.DocumentLink, *jsonrpc.ResponseError)

TextDocumentDocumentLink is not implemented

func (*IDELSPServer) TextDocumentDocumentSymbol

func (server *IDELSPServer) TextDocumentDocumentSymbol(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.DocumentSymbolParams) ([]lsp.DocumentSymbol, []lsp.SymbolInformation, *jsonrpc.ResponseError)

TextDocumentDocumentSymbol sends a request for text document symbol

func (*IDELSPServer) TextDocumentFoldingRange

func (server *IDELSPServer) TextDocumentFoldingRange(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.FoldingRangeParams) ([]lsp.FoldingRange, *jsonrpc.ResponseError)

TextDocumentFoldingRange is not implemented

func (*IDELSPServer) TextDocumentFormatting

func (server *IDELSPServer) TextDocumentFormatting(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.DocumentFormattingParams) ([]lsp.TextEdit, *jsonrpc.ResponseError)

TextDocumentFormatting sends a request to format a text document

func (*IDELSPServer) TextDocumentHover

func (server *IDELSPServer) TextDocumentHover(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.HoverParams) (*lsp.Hover, *jsonrpc.ResponseError)

TextDocumentHover sends a request to hover a text document

func (*IDELSPServer) TextDocumentImplementation

func (server *IDELSPServer) TextDocumentImplementation(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.ImplementationParams) ([]lsp.Location, []lsp.LocationLink, *jsonrpc.ResponseError)

TextDocumentImplementation sends a request to implement a text document

func (*IDELSPServer) TextDocumentLinkedEditingRange

func (server *IDELSPServer) TextDocumentLinkedEditingRange(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.LinkedEditingRangeParams) (*lsp.LinkedEditingRanges, *jsonrpc.ResponseError)

TextDocumentLinkedEditingRange is not implemented

func (*IDELSPServer) TextDocumentMoniker

func (server *IDELSPServer) TextDocumentMoniker(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.MonikerParams) ([]lsp.Moniker, *jsonrpc.ResponseError)

TextDocumentMoniker is not implemented

func (*IDELSPServer) TextDocumentOnTypeFormatting

func (server *IDELSPServer) TextDocumentOnTypeFormatting(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.DocumentOnTypeFormattingParams) ([]lsp.TextEdit, *jsonrpc.ResponseError)

TextDocumentOnTypeFormatting is not implemented

func (*IDELSPServer) TextDocumentPrepareCallHierarchy

func (server *IDELSPServer) TextDocumentPrepareCallHierarchy(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.CallHierarchyPrepareParams) ([]lsp.CallHierarchyItem, *jsonrpc.ResponseError)

TextDocumentPrepareCallHierarchy is not implemented

func (*IDELSPServer) TextDocumentRangeFormatting

func (server *IDELSPServer) TextDocumentRangeFormatting(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.DocumentRangeFormattingParams) ([]lsp.TextEdit, *jsonrpc.ResponseError)

TextDocumentRangeFormatting sends a request to format the range a text document

func (*IDELSPServer) TextDocumentReferences

func (server *IDELSPServer) TextDocumentReferences(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.ReferenceParams) ([]lsp.Location, *jsonrpc.ResponseError)

TextDocumentReferences is not implemented

func (*IDELSPServer) TextDocumentRename

func (server *IDELSPServer) TextDocumentRename(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.RenameParams) (*lsp.WorkspaceEdit, *jsonrpc.ResponseError)

TextDocumentRename sends a request to rename a text document

func (*IDELSPServer) TextDocumentSelectionRange

func (server *IDELSPServer) TextDocumentSelectionRange(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.SelectionRangeParams) ([]lsp.SelectionRange, *jsonrpc.ResponseError)

TextDocumentSelectionRange is not implemented

func (*IDELSPServer) TextDocumentSemanticTokensFull

func (server *IDELSPServer) TextDocumentSemanticTokensFull(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.SemanticTokensParams) (*lsp.SemanticTokens, *jsonrpc.ResponseError)

TextDocumentSemanticTokensFull is not implemented

func (*IDELSPServer) TextDocumentSemanticTokensFullDelta

func (server *IDELSPServer) TextDocumentSemanticTokensFullDelta(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.SemanticTokensDeltaParams) (*lsp.SemanticTokens, *lsp.SemanticTokensDelta, *jsonrpc.ResponseError)

TextDocumentSemanticTokensFullDelta is not implemented

func (*IDELSPServer) TextDocumentSemanticTokensRange

func (server *IDELSPServer) TextDocumentSemanticTokensRange(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.SemanticTokensRangeParams) (*lsp.SemanticTokens, *jsonrpc.ResponseError)

TextDocumentSemanticTokensRange is not implemented

func (*IDELSPServer) TextDocumentSignatureHelp

func (server *IDELSPServer) TextDocumentSignatureHelp(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.SignatureHelpParams) (*lsp.SignatureHelp, *jsonrpc.ResponseError)

TextDocumentSignatureHelp requests help for text document signature

func (*IDELSPServer) TextDocumentTypeDefinition

func (server *IDELSPServer) TextDocumentTypeDefinition(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.TypeDefinitionParams) ([]lsp.Location, []lsp.LocationLink, *jsonrpc.ResponseError)

TextDocumentTypeDefinition sends a request to define a type for the text document

func (*IDELSPServer) TextDocumentWillSave

func (server *IDELSPServer) TextDocumentWillSave(logger jsonrpc.FunctionLogger, params *lsp.WillSaveTextDocumentParams)

TextDocumentWillSave is not implemented

func (*IDELSPServer) TextDocumentWillSaveWaitUntil

func (server *IDELSPServer) TextDocumentWillSaveWaitUntil(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.WillSaveTextDocumentParams) ([]lsp.TextEdit, *jsonrpc.ResponseError)

TextDocumentWillSaveWaitUntil is not implemented

func (*IDELSPServer) WindowWorkDoneProgressCancel

func (server *IDELSPServer) WindowWorkDoneProgressCancel(logger jsonrpc.FunctionLogger, params *lsp.WorkDoneProgressCancelParams)

WindowWorkDoneProgressCancel is not implemented

func (*IDELSPServer) WorkspaceDidChangeConfiguration

func (server *IDELSPServer) WorkspaceDidChangeConfiguration(logger jsonrpc.FunctionLogger, params *lsp.DidChangeConfigurationParams)

WorkspaceDidChangeConfiguration purpose is explained below

func (*IDELSPServer) WorkspaceDidChangeWatchedFiles

func (server *IDELSPServer) WorkspaceDidChangeWatchedFiles(logger jsonrpc.FunctionLogger, params *lsp.DidChangeWatchedFilesParams)

WorkspaceDidChangeWatchedFiles is not implemented

func (*IDELSPServer) WorkspaceDidChangeWorkspaceFolders

func (server *IDELSPServer) WorkspaceDidChangeWorkspaceFolders(logger jsonrpc.FunctionLogger, params *lsp.DidChangeWorkspaceFoldersParams)

WorkspaceDidChangeWorkspaceFolders is not implemented

func (*IDELSPServer) WorkspaceDidCreateFiles

func (server *IDELSPServer) WorkspaceDidCreateFiles(logger jsonrpc.FunctionLogger, params *lsp.CreateFilesParams)

WorkspaceDidCreateFiles is not implemented

func (*IDELSPServer) WorkspaceDidDeleteFiles

func (server *IDELSPServer) WorkspaceDidDeleteFiles(logger jsonrpc.FunctionLogger, params *lsp.DeleteFilesParams)

WorkspaceDidDeleteFiles is not implemented

func (*IDELSPServer) WorkspaceDidRenameFiles

func (server *IDELSPServer) WorkspaceDidRenameFiles(logger jsonrpc.FunctionLogger, params *lsp.RenameFilesParams)

WorkspaceDidRenameFiles is not implemented

func (*IDELSPServer) WorkspaceExecuteCommand

func (server *IDELSPServer) WorkspaceExecuteCommand(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.ExecuteCommandParams) (json.RawMessage, *jsonrpc.ResponseError)

WorkspaceExecuteCommand is not implemented

func (*IDELSPServer) WorkspaceSemanticTokensRefresh

func (server *IDELSPServer) WorkspaceSemanticTokensRefresh(ctx context.Context, logger jsonrpc.FunctionLogger) *jsonrpc.ResponseError

WorkspaceSemanticTokensRefresh is not implemented

func (*IDELSPServer) WorkspaceSymbol

WorkspaceSymbol is not implemented

func (*IDELSPServer) WorkspaceWillCreateFiles

func (server *IDELSPServer) WorkspaceWillCreateFiles(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.CreateFilesParams) (*lsp.WorkspaceEdit, *jsonrpc.ResponseError)

WorkspaceWillCreateFiles is not implemented

func (*IDELSPServer) WorkspaceWillDeleteFiles

func (server *IDELSPServer) WorkspaceWillDeleteFiles(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.DeleteFilesParams) (*lsp.WorkspaceEdit, *jsonrpc.ResponseError)

WorkspaceWillDeleteFiles is not implemented

func (*IDELSPServer) WorkspaceWillRenameFiles

func (server *IDELSPServer) WorkspaceWillRenameFiles(ctx context.Context, logger jsonrpc.FunctionLogger, params *lsp.RenameFilesParams) (*lsp.WorkspaceEdit, *jsonrpc.ResponseError)

WorkspaceWillRenameFiles is not implemented

type INOLanguageServer

type INOLanguageServer struct {
	IDE    *IDELSPServer
	Clangd *clangdLSPClient
	// contains filtered or unexported fields
}

INOLanguageServer is a JSON-RPC handler that delegates messages to clangd.

func NewINOLanguageServer

func NewINOLanguageServer(stdin io.Reader, stdout io.Writer, config *Config) *INOLanguageServer

NewINOLanguageServer creates and configures an Arduino Language Server.

func (*INOLanguageServer) Close

func (ls *INOLanguageServer) Close()

Close closes all the json-rpc connections and clean-up temp folders.

func (*INOLanguageServer) CloseNotify

func (ls *INOLanguageServer) CloseNotify() <-chan bool

CloseNotify returns a channel that is closed when the InoHandler is closed

func (*INOLanguageServer) CopyFullBuildResults

func (ls *INOLanguageServer) CopyFullBuildResults(logger jsonrpc.FunctionLogger, buildPath *paths.Path)

CopyFullBuildResults copies the results of a full build in the LS workspace

type Logger

type Logger struct {
	IncomingPrefix, OutgoingPrefix string
	HiColor, LoColor               func(format string, a ...interface{}) string
	ErrorColor                     func(format string, a ...interface{}) string
}

Logger is a lsp logger

func (*Logger) LogIncomingCancelRequest

func (l *Logger) LogIncomingCancelRequest(id string)

LogIncomingCancelRequest prints an incoming cancel request into the log

func (*Logger) LogIncomingDataDelay

func (l *Logger) LogIncomingDataDelay(delay time.Duration)

LogIncomingDataDelay prints the delay of incoming data into the log

func (*Logger) LogIncomingNotification

func (l *Logger) LogIncomingNotification(method string, params json.RawMessage) jsonrpc.FunctionLogger

LogIncomingNotification prints an incoming notification into the log

func (*Logger) LogIncomingRequest

func (l *Logger) LogIncomingRequest(id string, method string, params json.RawMessage) jsonrpc.FunctionLogger

LogIncomingRequest prints an incoming request into the log

func (*Logger) LogIncomingResponse

func (l *Logger) LogIncomingResponse(id string, method string, resp json.RawMessage, respErr *jsonrpc.ResponseError)

LogIncomingResponse prints an incoming response into the log if there is no error

func (*Logger) LogOutgoingCancelRequest

func (l *Logger) LogOutgoingCancelRequest(id string)

LogOutgoingCancelRequest prints an outgoing cancel request into the log

func (*Logger) LogOutgoingDataDelay

func (l *Logger) LogOutgoingDataDelay(delay time.Duration)

LogOutgoingDataDelay prints the delay of outgoing data into the log

func (*Logger) LogOutgoingNotification

func (l *Logger) LogOutgoingNotification(method string, params json.RawMessage)

LogOutgoingNotification prints an outgoing notification into the log

func (*Logger) LogOutgoingRequest

func (l *Logger) LogOutgoingRequest(id string, method string, params json.RawMessage)

LogOutgoingRequest prints an outgoing request into the log

func (*Logger) LogOutgoingResponse

func (l *Logger) LogOutgoingResponse(id string, method string, resp json.RawMessage, respErr *jsonrpc.ResponseError)

LogOutgoingResponse prints an outgoing response into the log if there is no error

type UnknownURIError

type UnknownURIError struct {
	URI lsp.DocumentURI
}

UnknownURIError is an error when an URI is not recognized

func (*UnknownURIError) Error

func (e *UnknownURIError) Error() string

Jump to

Keyboard shortcuts

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