New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--search-parent-directories
doesn't appear to respect $XDG_CONFIG_HOME
#260
Comments
Looks like this and #259 are due to the Is there a better lib option for this purpose that we could use? That one doesn't appear to cut the mustard. We'll also want to update the verbose logging to say where it's actually looking. |
Thanks for the report and digging into it further. It is a shame that the A quick google leads to alternatively the xdg crate, which handles looking at both I wonder if it's worthwhile to just handle it ourselves rather than sending it off to another crate. It seems to just be looking at |
I'm not much of a rustacean, but I can't imagine it would be particularly difficult to handle it ourselves. I'm not sure what folks typically do for Windows, but for *nix the logic would be (in Lua): -- default to "~/.config" if unset
local config_dir = os.getenv("XDG_CONFIG_HOME") or os.getenv("HOME") .. "/.config"
local xdg_root_file = config_dir .. "/stylua.toml"
local xdg_subdir_file = config_dir .. "/stylua/stylua.toml"
if io.open(xdg_root_file) then
config_file = xdg_root_file
elseif io.open(xdg_subdir_file) then
config_file = xdg_subdir_file
end |
Seems to be working great. Thanks! |
--search-parent-directories
doesn't appear to respect the$XDG_CONFIG_HOME
environment variable. This is based on the output when using-v
, as I can't actually test due to #259.$XDG_CONFIG_HOME
:/Users/tim/.dotfiles/config
Config at
/Users/tim/.dotfiles/config/stylua.toml
:Command and output:
Note that the searched locations in the output have not changed even though
$XDG_CONFIG_HOME
is set to/Users/tim/.dotfiles/config
The text was updated successfully, but these errors were encountered: