markedsource

package
v0.0.67 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0, NCSA Imports: 13 Imported by: 0

Documentation

Overview

Package markedsource defines functions for rendering MarkedSource.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(ms *cpb.MarkedSource) string

Render flattens MarkedSource to a string using reasonable defaults.

func RenderCallSiteSignature added in v0.0.64

func RenderCallSiteSignature(node *cpb.MarkedSource) string

RenderCallSiteSignature returns the text snippet for a callsite as plaintext.

func RenderInitializer added in v0.0.64

func RenderInitializer(node *cpb.MarkedSource, format ContentType, linkify func(string) string) string

RenderInitializer extracts and renders a plaintext initializer from node. If not nil, linkify will be used to generate link URIs from semantic node tickets. It may return an empty string if there is no available URI.

func RenderQualifiedName

func RenderQualifiedName(ms *cpb.MarkedSource) *cpb.SymbolInfo

RenderQualifiedName renders a language-appropriate qualified name from a MarkedSource message.

func RenderSignature added in v0.0.64

func RenderSignature(node *cpb.MarkedSource, format ContentType, linkify func(string) string) string

RenderSignature renders the full signature from node. If not nil, linkify will be used to generate link URIs from semantic node tickets. It may return an empty string if there is no available URI.

func RenderSimpleIdentifier

func RenderSimpleIdentifier(node *cpb.MarkedSource, format ContentType, linkify func(string) string) string

RenderSimpleIdentifier extracts and renders a the simple identifier from node. If not nil, linkify will be used to generate link URIs from semantic node tickets. It may return an empty string if there is no available URI.

func RenderSimpleParams

func RenderSimpleParams(node *cpb.MarkedSource, format ContentType, linkify func(string) string) []string

RenderSimpleParams extracts and renders the simple identifiers for parameters in node. If not nil, linkify will be used to generate link URIs from semantic node tickets. It may return an empty string if there is no available URI.

func RenderSimpleQualifiedName added in v0.0.64

func RenderSimpleQualifiedName(node *cpb.MarkedSource, includeIdentifier bool, format ContentType, linkify func(string) string) string

RenderSimpleQualifiedName extracts and renders the simple qualified name from node. If includeIdentifier is true it includes the identifier on the qualified name. If not nil, linkify will be used to generate link URIs from semantic node tickets. It may return an empty string if there is no available URI.

Types

type ContentType added in v0.0.64

type ContentType string

ContentType is a type of rendering output.

var (
	PlaintextContent ContentType = "txt"
	MarkdownContent  ContentType = "md"
)

Supported list of ContentTypes

type Resolver added in v0.0.62

type Resolver struct {
	// contains filtered or unexported fields
}

Resolver produces fully resolved MarkedSources from a set of entries.

func NewResolver added in v0.0.62

func NewResolver(entries []*spb.Entry) (*Resolver, error)

NewResolver constructs a MarkedSource resolver from the given entries.

func (*Resolver) Resolve added in v0.0.62

func (r *Resolver) Resolve(src *spb.VName) *cpb.MarkedSource

Resolve returns the fully resolved MarkedSource for the given source VName. May return nil if no MarkedSource is found.

func (*Resolver) ResolveTicket added in v0.0.62

func (r *Resolver) ResolveTicket(ticket string) *cpb.MarkedSource

ResolveTicket returns the fully resolved MarkedSource for the given source ticket. May return nil if no MarkedSource is found.

Jump to

Keyboard shortcuts

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