Fix auto-venv compatibility with nushell 0.108#1252
Open
hyiltiz wants to merge 1 commit intonushell:mainfrom
Open
Fix auto-venv compatibility with nushell 0.108#1252hyiltiz wants to merge 1 commit intonushell:mainfrom
hyiltiz wants to merge 1 commit intonushell:mainfrom
Conversation
- default-hooks: don't wrap existing hooks list in another list; this produced an invalid nested type that broke hook evaluation and downstream tab completion - on_enter: remove transient cd operations that triggered spurious hook evaluations; overlay use now resolves via NU_LIB_DIRS instead of runtime PWD (which nushell 0.108 no longer supports for dynamically evaluated code) - on_enter: guard against missing trigger file - on_exit: guard overlay hide against inactive overlay - venv_helpers: filter overlay list to active overlays only (overlay list now includes inactive entries in 0.108) - path_extensions: return null instead of [] on no match to prevent type errors in downstream path join calls; return deepest ancestor match rather than shallowest
Contributor
|
If we fix it for v0.108.0 it may not work with the latest version v0.112.2. So, I'd ask you to test your changes on the latest version to see if these changes work. I don't want to patch for a 7 month old version. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
auto-venv is broken on nushell 0.108 due to several API changes in the
engine. This PR fixes all the issues needed to make it functional again.
Fixes:
default-hookswrapped the existing PWD hooks list in another list,producing an invalid
list<list<closure>>type that corrupted hookevaluation (and broke tab completion as a side effect)
on_enterused transientcdto resolveoverlay userelative toPWD; nushell 0.108 resolves
overlay useat parse time only, sothis no longer works — removed in favor of NU_LIB_DIRS resolution
on_exitcrashed when the overlay was not active (e.g. activationfailed due to missing .venv)
venv-is-activechecked all overlays including inactive ones;overlay listin 0.108 includes inactive entriespath find-subreturned[]instead ofnullon no match, causingtype errors in downstream
path joincalls; also changed to returnthe deepest ancestor match rather than shallowest, which is the
expected behavior for nested project directories
Test plan
cdinto a directory with.__auto-venv.nutrigger +.venv/→ venv activatescdout → venv deactivates without errorcdinto a directory with trigger but no.venv/→ no crashcd <TAB>) works after the hooks are registered