analysis

package
v0.0.0-...-4fcc4bf Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package analysis provides the functionality for analyzing a document.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CancelResponse

func CancelResponse(
	request lsp.CancelRequest,
) (response *lsp.CancelResponse, err error)

CancelResponse cancels a request

func CreateTextDocumentCompletion

func CreateTextDocumentCompletion(
	ctx context.Context,
	request lsp.TextDocumentCompletionRequest,
	db *data.Database[master.Queries],
	documents *safe.Map[uri.URI, parsers.GoFile],
) (response *lsp.TextDocumentCompletionResponse, err error)

CreateTextDocumentCompletion returns the completions for a given text document. It checks if the position is within the struct tag and returns the selectors if the position is within the struct tag.

It also checks if the position is within the struct tag value and returns the selectors if the position is within the struct tag value.

func GetDiagnosticsForFile

func GetDiagnosticsForFile(
	ctx context.Context,
	db *data.Database[master.Queries],
	source *parsers.GoFile,
) ([]protocol.Diagnostic, error)

GetDiagnosticsForFile returns diagnostics for a given file text is all the characters in the file

func GetSelectorHover

func GetSelectorHover(
	ctx context.Context,
	position protocol.Position,
	text *string,
	doc *goquery.Document,
) (res lsp.HoverResult, err error)

GetSelectorHover checks if the position is within the struct tag.

func NewHoverResponse

func NewHoverResponse(
	ctx context.Context,
	req lsp.HoverRequest,
	db *data.Database[master.Queries],
	documents *safe.Map[uri.URI, string],
	urls *safe.Map[uri.URI, []string],
) (response *lsp.HoverResponse, err error)

NewHoverResponse returns a hover response for the given uri and position

func OpenDocument

OpenDocument opens a document in the state and returns any diagnostics for the document.

uri is the uri of the document.

content is the content of the document.

On the opening of any document, the state is updated with the content of the document and the diagnostics for the document are returned.

func TextDocumentCodeAction

func TextDocumentCodeAction(
	ctx context.Context,
	req lsp.TextDocumentCodeActionRequest,
	documents *safe.Map[uri.URI, string],
) (response rpc.MethodActor, err error)

TextDocumentCodeAction returns the code actions for a given text document.

func UpdateDocument

func UpdateDocument(
	ctx context.Context,
	notification *lsp.TextDocumentDidChangeNotification,
	db *data.Database[master.Queries],
	documents *safe.Map[uri.URI, string],
	urls *safe.Map[uri.URI, []string],
	selectors *safe.Map[uri.URI, []master.Selector],
) (*lsp.PublishDiagnosticsNotification, error)

UpdateDocument updates the state with the given document.

Upon updating the document, it returns new diagnostics for the document.

Types

This section is empty.

Jump to

Keyboard shortcuts

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