Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidTheme is returned when the Query.Theme is not a valid theme. ErrInvalidTheme = errors.New("invalid theme") // ErrRequestTooLarge is returned when the request is too large for syntect_server to handle (e.g. file is too large to highlight). ErrRequestTooLarge = errors.New("request too large") // ErrPanic occurs when syntect_server panics while highlighting code. This // most often occurs when Syntect does not support e.g. an obscure or // relatively unused sublime-syntax feature and as a result panics. ErrPanic = errors.New("syntect panic while highlighting") // ErrHSSWorkerTimeout occurs when syntect_server's wrapper, // http-server-stabilizer notices syntect_server is taking too long to // serve a request, has most likely gotten stuck, and as such has been // restarted. This occurs rarely on certain files syntect_server cannot yet // handle for some reason. ErrHSSWorkerTimeout = errors.New("HSS worker timeout while serving request") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a client connection to a syntect_server.
type Query ¶
type Query struct { // Extension is deprecated: use Filepath instead. Extension string `json:"extension"` // Filepath is the file path of the code. It can be the full file path, or // just the name and extension. // // See: https://github.com/sourcegraph/syntect_server#supported-file-extensions Filepath string `json:"filepath"` // Theme is the color theme to use for highlighting. // If CSS is true, theme is ignored. // // See https://github.com/sourcegraph/syntect_server#embedded-themes Theme string `json:"theme"` // Code is the literal code to highlight. Code string `json:"code"` // CSS causes results to be returned in HTML table format with CSS class // names annotating the spans rather than inline styles. CSS bool `json:"css"` // LineLengthLimit is the maximum length of line that will be highlighted if set. // Defaults to no max if zero. // If CSS is false, LineLengthLimit is ignored. LineLengthLimit int `json:"line_length_limit,omitempty"` // StabilizeTimeout, if non-zero, overrides the default syntect_server // http-server-stabilizer timeout of 10s. This is most useful when a user // is requesting to highlight a very large file and is willing to wait // longer, but it is important this not _always_ be a long duration because // the worker's threads could get stuck at 100% CPU for this amount of // time if the user's request ends up being a problematic one. StabilizeTimeout time.Duration `json:"-"` // Tracer, if not nil, will be used to record opentracing spans associated with the query. Tracer opentracing.Tracer }
Query represents a code highlighting query to the syntect_server.
type Response ¶
type Response struct { // Data is the actual highlighted HTML version of Query.Code. Data string // Plaintext indicates whether or not a syntax could not be found for the // file and instead it was rendered as plain text. Plaintext bool }
Response represents a response to a code highlighting query.
Click to show internal directories.
Click to hide internal directories.