Documentation ¶
Overview ¶
Package analysis provides the functionality for analyzing a document.
Index ¶
- func CancelResponse(request lsp.CancelRequest) (response *lsp.CancelResponse, err error)
- func CreateTextDocumentCompletion(ctx context.Context, request lsp.TextDocumentCompletionRequest, ...) (response *lsp.TextDocumentCompletionResponse, err error)
- func GetDiagnosticsForFile(ctx context.Context, db *data.Database[master.Queries], source *parsers.GoFile) ([]protocol.Diagnostic, error)
- func GetSelectorHover(ctx context.Context, position protocol.Position, text *string, ...) (res lsp.HoverResult, err error)
- func NewHoverResponse(ctx context.Context, req lsp.HoverRequest, db *data.Database[master.Queries], ...) (response *lsp.HoverResponse, err error)
- func OpenDocument(ctx context.Context, req *lsp.NotificationDidOpenTextDocument, ...) (*lsp.PublishDiagnosticsNotification, error)
- func TextDocumentCodeAction(ctx context.Context, req lsp.TextDocumentCodeActionRequest, ...) (response rpc.MethodActor, err error)
- func UpdateDocument(ctx context.Context, notification *lsp.TextDocumentDidChangeNotification, ...) (*lsp.PublishDiagnosticsNotification, error)
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 ¶
func OpenDocument( ctx context.Context, req *lsp.NotificationDidOpenTextDocument, db *data.Database[master.Queries], documents *safe.Map[uri.URI, *parsers.GoFile], ) (*lsp.PublishDiagnosticsNotification, error)
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.