Documentation
¶
Index ¶
- type Comment
- type Language
- func C() *Language
- func CSS() *Language
- func Cpp() *Language
- func GetLanguageFromExt(ext string) (*Language, error)
- func Go() *Language
- func Java() *Language
- func JavaScript() *Language
- func Julia() *Language
- func Protobuf() *Language
- func Python() *Language
- func Ruby() *Language
- func Rust() *Language
- func Tsx() *Language
- func TypeScript() *Language
- func YAML() *Language
- type QueryEngine
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comment ¶
type Comment struct {
Text string
Source string
Line int
Offset int
Scope string
// Strip records, for each line of Text, how many bytes were taken off the
// front of the matching Source line. An alert's column is meaningful in
// Text; putting it back in Source means adding this.
//
// Empty for a comment that was never dedented, in which case the caller
// falls back to measuring the source line itself.
//
// Not serialised: this is bookkeeping for putting an alert back where it
// came from, not part of what a comment is.
Strip []int `json:"-"`
}
Comment represents an in-code comment (line or block).
func GetComments ¶
GetComments returns all comments in the given source code.
type Language ¶
type Language struct {
Delims *regexp.Regexp
Parser *sitter.Language
// Prefix matches a block comment's per-line decoration -- the ` *` that
// starts each line of a JSDoc or Javadoc block.
//
// This is not the same thing as Cutset. Decoration is noise of a known
// width that has to come off for the body to be valid markup; indentation
// is meaningful and only its common part comes off. Conflating them is why
// a cutset of " *" cannot work: `*` is both the decoration and Markdown's
// list and emphasis marker, so a cutset wide enough to remove the noise
// also eats a list.
//
// The match is blanked rather than deleted, which keeps every column where
// it was and leaves the dedent below to remove the whitespace it becomes.
Prefix *regexp.Regexp
Queries []core.Scope
Cutset string
Padding padding
}
Language represents a supported programming language.
NOTE: What about haskell, less, perl, php, powershell, r, sass, swift?
func GetLanguageFromExt ¶
GetLanguageFromExt returns a Language based on the given file extension.
func JavaScript ¶
func JavaScript() *Language
func TypeScript ¶
func TypeScript() *Language
type QueryEngine ¶
type QueryEngine struct {
// contains filtered or unexported fields
}
func NewQueryEngine ¶
func NewQueryEngine(tree *sitter.Tree, lang *Language) *QueryEngine
Click to show internal directories.
Click to hide internal directories.