Documentation ¶
Overview ¶
Package analysis provides the functionality for analyzing a document.
Index ¶
- type State
- func (s *State) CancelRequest(id string) (response *lsp.CancelResponse, err error)
- func (s *State) CheckPosition(position lsp.Position, text string) (res parsers.State, err error)
- func (s *State) CreateTextDocumentCompletion(id int, document lsp.TextDocumentIdentifier, pos lsp.Position) (response lsp.CompletionResponse, err error)
- func (s *State) GetDiagnosticsForFile(text *string, data parsers.StructCommentData) (diagnostics []lsp.Diagnostic, err error)
- func (s *State) Hover(id int, uri string, position lsp.Position) (*lsp.HoverResponse, error)
- func (s *State) OpenDocument(uri string, content *string) (diags []lsp.Diagnostic, err error)
- func (s *State) TextDocumentCodeAction(id int, uri string) lsp.TextDocumentCodeActionResponse
- func (s *State) UpdateDocument(uri, content string) (diags []lsp.Diagnostic, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type State ¶
type State struct { // Map of file names to contents Documents map[string]string // Selectors is the map of file names to selectors Selectors map[string][]master.Selector // Database is the database for the state Database data.Database[master.Queries] // Logger is the logger for the state Logger *log.Logger }
State is the state of the document analysis
func (*State) CancelRequest ¶
func (s *State) CancelRequest( id string, ) (response *lsp.CancelResponse, err error)
CancelRequest cancels a request
func (*State) CheckPosition ¶
CheckPosition checks if the position is within the struct tag
func (*State) CreateTextDocumentCompletion ¶
func (s *State) CreateTextDocumentCompletion( id int, document lsp.TextDocumentIdentifier, pos lsp.Position, ) (response lsp.CompletionResponse, 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 (*State) GetDiagnosticsForFile ¶
func (s *State) GetDiagnosticsForFile( text *string, data parsers.StructCommentData, ) (diagnostics []lsp.Diagnostic, err error)
GetDiagnosticsForFile returns diagnostics for a given file text is all the characters in the file
func (*State) 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
func (*State) TextDocumentCodeAction ¶
func (s *State) TextDocumentCodeAction( id int, uri string, ) lsp.TextDocumentCodeActionResponse
TextDocumentCodeAction returns the code actions for a given text document.
func (*State) UpdateDocument ¶
func (s *State) UpdateDocument( uri, content string, ) (diags []lsp.Diagnostic, err error)
UpdateDocument updates the state with the given document