Make direct direnv loading default (#18536)

I've been running with direct direnv loading for a while now and haven't
experienced any significant issues other than #18473. Making it default
would make direnv integration more reliable and consistent. I've also
updated the docs a bit to ensure that they represent current status of
direnv integration

Release Notes:

- Made direnv integration use direct (`direnv export json`) mode by
default instead of relying on a shell hook, improving consistency and
reliability of direnv detection
This commit is contained in:
Stanislav Alekseev 2024-09-30 16:35:36 +03:00 committed by GitHub
parent e64a86ce9f
commit 215bce1974
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 12 deletions

View file

@ -599,13 +599,11 @@
} }
}, },
// Configuration for how direnv configuration should be loaded. May take 2 values: // Configuration for how direnv configuration should be loaded. May take 2 values:
// 1. Load direnv configuration through the shell hook, works for POSIX shells and fish. // 1. Load direnv configuration using `direnv export json` directly.
// "load_direnv": "shell_hook"
// 2. Load direnv configuration using `direnv export json` directly.
// This can help with some shells that otherwise would not detect
// the direnv environment, such as nushell or elvish.
// "load_direnv": "direct" // "load_direnv": "direct"
"load_direnv": "shell_hook", // 2. Load direnv configuration through the shell hook, works for POSIX shells and fish.
// "load_direnv": "shell_hook"
"load_direnv": "direct",
"inline_completions": { "inline_completions": {
// A list of globs representing files that inline completions should be disabled for. // A list of globs representing files that inline completions should be disabled for.
"disabled_globs": [".env"] "disabled_globs": [".env"]

View file

@ -62,12 +62,9 @@ pub struct NodeBinarySettings {
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
pub enum DirenvSettings { pub enum DirenvSettings {
/// Load direnv configuration through a shell hook /// Load direnv configuration through a shell hook
#[default]
ShellHook, ShellHook,
/// Load direnv configuration directly using `direnv export json` /// Load direnv configuration directly using `direnv export json`
/// #[default]
/// Warning: This option is experimental and might cause some inconsistent behavior compared to using the shell hook.
/// If it does, please report it to GitHub
Direct, Direct,
} }

View file

@ -267,12 +267,14 @@ left and right padding of the central pane from the workspace when the centered
## Direnv Integration ## Direnv Integration
- Description: Settings for [direnv](https://direnv.net/) integration. Requires `direnv` to be installed. `direnv` integration currently only means that the environment variables set by a `direnv` configuration can be used to detect some language servers in `$PATH` instead of installing them. - Description: Settings for [direnv](https://direnv.net/) integration. Requires `direnv` to be installed.
`direnv` integration make it possible to use the environment variables set by a `direnv` configuration to detect some language servers in `$PATH` instead of installing them.
It also allows for those environment variables to be used in tasks.
- Setting: `load_direnv` - Setting: `load_direnv`
- Default: - Default:
```json ```json
"load_direnv": "shell_hook" "load_direnv": "direct"
``` ```
**Options** **Options**