The big configuration and discovery rework #9
Replies: 2 comments 14 replies
|
I like the auto-discovery unification 👍 That was always a bit of a bugbear of mine and I think your solution sounds good. One nitpick: My experience is that environment variables usually take precedence over, in this case, local workspace/project directory defaults. We also have |
|
i am also very happy about finally treating grammars and queries the same. but did you consider removing auto discovery for queries rather than adding it for grammars, that is, making configuration files the only way to include grammars and queries? then we would not need to auto discover 3 different types of inputs, but configuration files only. "explicit is better than implicit." |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Topiary Configuration & Discovery Refactor
Wishlist
I want to generally unify Topiary's configuration, queries, and grammars. These is my wishlist:
Grammars in the configuration must be expressable in four ways:
.sofileQueries in the configuration must be available in four ways:
.scmfiles (formatting and injections)Configuration File Resolution: The main configuration file (e.g.,
languages.ncl) must be discovered using an analogous order of precedence. However, because configurations are additive, Topiary should merge configurations from bottom to top (with higher precedence overriding lower precedence on a per-language basis):Walk up from the current directory, stopping at the first
.topiary/languages.nclfound (or at$HOME).XDG_CONFIG_HOME)Check
XDG_CONFIG_HOME/topiary/languages.ncl(defaulting to~/.config/topiary/languages.ncl). Note that this correctly targets.configunlike the data directories for queries/grammars.XDG_CONFIG_DIRS)Iterate through
XDG_CONFIG_DIRS(defaulting to/etc/xdg), looking fortopiary/languages.ncl.The built-in configuration file shipped with Topiary forms the base of the merge strategy.
Auto-Discovery Formats & Directory Structure:
While the
languages.nclconfiguration explicitly allows defining grammars/queries via Git repositories or source directories (which Topiary will fetch/compile), auto-discovery strictly looks for pre-compiled binaries and query text files.To ensure consistency, whenever Topiary checks a path during auto-discovery (whether
.topiary/locally, orXDG_DATA_HOME/topiary/globally), it expects the following exact directory structure:All reactions