Documentation
¶
Overview ¶
Package options is the configuration layer of thrift-ls. It loads and layers the thrift-ls.json document — formatting settings (owned by the formatter), include paths, and the log level — so configuration sources can override each other: defaults, a JSON config file, CLI flags, and LSP workspace settings.
The config file is discovered by walking up from the file being formatted, like Biome's config discovery. THRIFT_LS_CONFIG overrides the search with an explicit path.
Index ¶
Constants ¶
const ConfigFileName = "thrift-ls.json"
ConfigFileName is the JSON config file name.
Variables ¶
This section is empty.
Functions ¶
func FindConfig ¶
FindConfig returns the absolute path of the config file for dir: THRIFT_LS_CONFIG when set, otherwise the nearest thrift-ls.json walking up from dir. An empty path means no config exists. The path is absolute because relative include paths in the config anchor to it.
Types ¶
type LintConfig ¶ added in v0.1.8
type LintConfig struct {
// Disabled names analyzers (by Name) to skip.
Disabled *[]string `json:"disabled"`
// Severity overrides a diagnostic's severity by code.
Severity *map[string]string `json:"severity"`
}
LintConfig tunes the analysis pipeline: which analyzers run, and at what severity their diagnostics surface.
func (LintConfig) Validate ¶ added in v0.1.8
func (l LintConfig) Validate() error
Validate checks the lint settings for validity.
type Patch ¶
type Patch struct {
formatter.FormatPatch
IncludePaths *[]string `json:"includePaths"`
LogLevel *int `json:"logLevel"`
Lint *LintConfig `json:"lint"`
}
Patch is a partial set of options; nil fields are unset. The formatting fields are promoted from the embedded formatter patch and decode flat, so thrift-ls.json keeps its top-level keys ("printWidth", ...).
func Effective ¶
Effective returns the effective options for a file: defaults with the config patch applied. cfg may be nil.
func Load ¶
Load reads and parses a config file. Unknown keys are rejected so that typos and stale settings (e.g. the removed overrides feature) fail loudly.
func Parse ¶
Parse parses a config document. Unknown keys are rejected so that typos and stale settings (e.g. the removed overrides feature) fail loudly. Include paths in the document are left as written; Load resolves them against the config file's directory.