Documentation ¶
Index ¶
- func EnsureURL(uri lsp.DocumentURI, pathType string) (url lsp.DocumentURI, err error)
- func GetLineContent(ctx context.Context, uri lsp.DocumentURI, position lsp.Position) ([]string, error)
- func GetPathFromURL(uri lsp.DocumentURI, pathType string) (documentPath string, err error)
- func IsURL(uri lsp.DocumentURI) bool
- func NewHandler() jsonrpc2.Handler
- func ReadFile(ctx context.Context, uri lsp.DocumentURI) ([]string, error)
- func TrimQuotes(str string) string
- type Analyzer
- func (a *Analyzer) BuildLabelFromString(ctx context.Context, rootPath string, uri lsp.DocumentURI, labelStr string) (*BuildLabel, error)
- func (a *Analyzer) IdentFromFile(uri lsp.DocumentURI) ([]*Identifier, error)
- func (a *Analyzer) IdentFromPos(uri lsp.DocumentURI, position lsp.Position) (*Identifier, error)
- type Argument
- type BuildLabel
- type Identifier
- type LsHandler
- type RuleDef
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureURL ¶
func EnsureURL(uri lsp.DocumentURI, pathType string) (url lsp.DocumentURI, err error)
EnsureURL ensures that the documentURI is a valid path in the filesystem and a valid 'file://' URI
func GetLineContent ¶
func GetLineContent(ctx context.Context, uri lsp.DocumentURI, position lsp.Position) ([]string, error)
GetLineContent returns a []string contraining a single string value respective to position.Line
func GetPathFromURL ¶
func GetPathFromURL(uri lsp.DocumentURI, pathType string) (documentPath string, err error)
GetPathFromURL returns the absolute path of the file which documenURI relates to it also checks if the file path is valid
func IsURL ¶
func IsURL(uri lsp.DocumentURI) bool
IsURL checks if the documentUri passed has 'file://' prefix
func NewHandler ¶
NewHandler creates a BUILD file language server handler
func TrimQuotes ¶
TrimQuotes is used to trim the qouted string This is usually used to trim the quoted string in BUILD files, such as a BuildLabel this will also work for string with any extra characters outside of qoutes like so: "//src/core",
Types ¶
type Analyzer ¶
Analyzer is a wrapper around asp.parser This is being loaded into a handler on initialization
func (*Analyzer) BuildLabelFromString ¶
func (a *Analyzer) BuildLabelFromString(ctx context.Context, rootPath string, uri lsp.DocumentURI, labelStr string) (*BuildLabel, error)
BuildLabelFromString returns a BuildLabel object,
func (*Analyzer) IdentFromFile ¶
func (a *Analyzer) IdentFromFile(uri lsp.DocumentURI) ([]*Identifier, error)
IdentFromFile gets all the Identifiers from a given BUILD file filecontent: string slice from a file, typically from ReadFile in utils.go *reads complete files only*
func (*Analyzer) IdentFromPos ¶
func (a *Analyzer) IdentFromPos(uri lsp.DocumentURI, position lsp.Position) (*Identifier, error)
IdentFromPos gets the Identifier given a lsp.Position
type Argument ¶
Argument is a wrapper around asp.Argument, this is used to store the argument information for specific rules, and it also tells you if the argument is required
type BuildLabel ¶
type BuildLabel struct { *core.BuildLabel // Path of the build file Path string // IdentStatement for the build definition, // usually the call to the specific buildrule, such as "go_library()" BuildDef *Identifier // The content of the build definition BuildDefContent string }
BuildLabel is a wrapper around core.BuildLabel Including the path of the buildFile
type Identifier ¶
type Identifier struct { *asp.IdentStatement Type string StartLine int EndLine int }
Identifier is a wrapper around asp.Identifier Including the starting line and the ending line number