language

package
v1.90.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Detect

func Detect(fp string, guessLanguage bool) (heartbeat.Language, error)

Detect detects the language of a specific file. If guessLanguage is true, Chroma will be used to detect a language from the file contents.

func WithDetection

func WithDetection(config Config) heartbeat.HandleOption

WithDetection initializes and returns a heartbeat handle option, which can be used in a heartbeat processing pipeline to detect and add programming language info to heartbeats of entity type 'file'.

Types

type Config added in v1.86.2

type Config struct {
	// GuessLanguage enables detecting lexer language from file contents.
	GuessLanguage bool
}

Config defines language detection options.

Jump to

Keyboard shortcuts

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