Documentation
¶
Overview ¶
Package features provides a searchable catalog of CalcMark features for help systems, autocompletion, and documentation generation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alias ¶
type Alias struct {
Name string // Alternative name (e.g., "average of", "round trip time")
Parseable bool // true if this alias works as input syntax, false if search-only
Example string // Concrete NL example for autosuggest (e.g., "average of 1, 2, 3")
}
Alias represents an alternative name for a feature, with a flag indicating whether it can be used as input syntax (Parseable) or is search-only.
type Category ¶
type Category string
Category represents a type of CalcMark feature.
const ( CategoryFunction Category = "function" CategoryUnit Category = "unit" CategoryKeyword Category = "keyword" CategoryOperator Category = "operator" CategoryDate Category = "date" CategoryNetwork Category = "network" CategoryStorage Category = "storage" CategoryCompression Category = "compression" CategoryGrowth Category = "growth" CategoryFrontmatter Category = "frontmatter" )
type Feature ¶
type Feature struct {
Name string // Primary name (e.g., "avg", "meter", "today")
Category Category // Type of feature (function, unit, keyword, etc.)
Subcategory string // Grouping within category for help display (e.g., "Math", "Network", "Storage")
Quantity string // Unit category for units (e.g., "Force", "Length"); empty for non-unit features
Syntax string // Usage syntax (e.g., "avg(a, b, c)")
Description string // Human-readable description
Aliases []Alias // Alternative names/spellings
Synonyms []string // Runtime-dispatchable alternative names (e.g., "average", "mean" for "avg")
Params []types.ParamSpec // Parameter specifications for functions (empty for non-functions)
Example string // Example usage (function-call form for help display)
NLExample string // Natural language example for autosuggest (e.g., "100 MB/s over 1 day")
}
Feature represents a single CalcMark feature that users can discover.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds all discoverable CalcMark features.
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry creates a registry with all CalcMark features.
func (*Registry) ByCategory ¶
ByCategory returns all features of a specific category.
func (*Registry) Categories ¶
Categories returns all available category names.
func (*Registry) GetByName ¶ added in v1.8.13
GetByName returns the first feature with the given name, or nil if not found.
func (*Registry) NLTriggerKeywords ¶ added in v1.8.16
NLTriggerKeywords returns the set of keywords that begin NL function syntax. These are extracted from parseable aliases: the first word of each alias name (before "...") is the trigger keyword. Both the document detector and the line classifier use this to identify NL function lines without hard-coding.
type Suggestion ¶ added in v1.8.12
type Suggestion struct {
Name string // Display name (may include synonyms for display)
Category string // Category (function, unit, variable, etc.)
Description string // Brief description
Syntax string // Syntax example
InsertText string // Actual text to insert (without synonyms/formatting)
SortCategory string // Override category for sorting (e.g., NL rows use parent fn category)
}
Suggestion represents an autocompletion suggestion. This type is shared between the TUI editor and the LSP server.
func FilterSuggestions ¶ added in v1.8.12
func FilterSuggestions(suggestions []Suggestion, prefix string) []Suggestion
FilterSuggestions returns suggestions that match the given prefix. This is a pure helper function for suggestion sources.
type SuggestionSource ¶ added in v1.8.12
type SuggestionSource interface {
// GetSuggestions returns suggestions matching the given prefix.
GetSuggestions(prefix string) []Suggestion
}
SuggestionSource provides suggestions for a given prefix.