Skip to content

Partial workaround and deprecation warning for breaking change usage of #15654#15806

Merged
sholderbach merged 3 commits intonushell:mainfrom
132ikl:default-closure-deprecation
Jun 4, 2025
Merged

Partial workaround and deprecation warning for breaking change usage of #15654#15806
sholderbach merged 3 commits intonushell:mainfrom
132ikl:default-closure-deprecation

Conversation

@132ikl
Copy link
Copy Markdown
Member

@132ikl 132ikl commented May 23, 2025

Description

Adds a temporary workaround to prevent #15654 from being a breaking change when using a closure stored in a variable, and issues a warning. Also has a special case related to carapace-sh/carapace-bin#2796 which suggests re-running carapace init

image

image

User-Facing Changes

Tests + Formatting

After Submitting

@132ikl 132ikl changed the title Default closure deprecation Add warning for breaking change usage of #15654 May 23, 2025
@132ikl 132ikl changed the title Add warning for breaking change usage of #15654 Partial workaround and deprecation warning for breaking change usage of #15654 May 23, 2025
@sholderbach
Copy link
Copy Markdown
Member

We still need this despite #15770, right? (or do you want to reimplement parts of this with the new logic?

@132ikl
Copy link
Copy Markdown
Member Author

132ikl commented Jun 1, 2025

We still need this despite #15770, right? (or do you want to reimplement parts of this with the new logic?

Yea we'll still need this, although it doesn't really integrate with #15770 since that only handles parse-time deprecation warnings (I would be interested in a follow-up that also had some mechanism for run-time deprecation warnings, but I'm not exactly sure what that would look like)

@132ikl 132ikl force-pushed the default-closure-deprecation branch from 45ed67c to 098e29f Compare June 1, 2025 18:57
@132ikl
Copy link
Copy Markdown
Member Author

132ikl commented Jun 1, 2025

I updated the wording of the error to try to be more clear (although it might be too wordy now..) and I also changed the ShellError deprecation variant to match the changes made to the ParseWarning deprecation variant in #15770. Here's what the warning looks like now:

image

@132ikl 132ikl marked this pull request as ready for review June 1, 2025 19:04
Copy link
Copy Markdown
Member

@sholderbach sholderbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, need to put a pin into that to properly remove your carapace hack :D

Comment on lines +325 to +327
let carapace_suggestion = "re-run carapace init with version v1.3.3 or later\nor, change this to `{ $carapace_completer }`";
let suggestion = match span_contents {
Cow::Borrowed("$carapace_completer") => carapace_suggestion.to_string(),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's dirty, but...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hehehe

@sholderbach sholderbach merged commit 42fc9f5 into nushell:main Jun 4, 2025
16 checks passed
@github-actions github-actions bot added this to the v0.105.0 milestone Jun 4, 2025
kumarUjjawal pushed a commit to kumarUjjawal/nushell that referenced this pull request Jun 5, 2025
nushell#15654 (nushell#15806)

# Description
Adds a temporary workaround to prevent nushell#15654 from being a breaking
change when using a closure stored in a variable, and issues a warning.
Also has a special case related to
carapace-sh/carapace-bin#2796 which suggests
re-running `carapace init`


![image](https://github.com/user-attachments/assets/783f3dbf-2a85-4aa5-ac66-efc584ac77fd)


![image](https://github.com/user-attachments/assets/c8fb5ae1-66a8-474c-8244-a22600f4da43)

# After Submitting
Remove variable name detection after grace period
@132ikl 132ikl mentioned this pull request Jul 10, 2025
Bahex pushed a commit that referenced this pull request Jul 15, 2025
# Description
Adds a proper `ShellWarning` enum which has the same functionality as
`ParseWarning`.

Also moves the deprecation from #15806 into `ShellWarning::Deprecated`
with `ReportMode::FirstUse`, so that warning will only pop up once now.

# User-Facing Changes
Technically the change to the deprecation warning from #15806 is user
facing but it's really not worth listing in the changelog
hardfau1t pushed a commit to hardfau1t/nushell that referenced this pull request Aug 25, 2025
# Description
Adds a proper `ShellWarning` enum which has the same functionality as
`ParseWarning`.

Also moves the deprecation from nushell#15806 into `ShellWarning::Deprecated`
with `ReportMode::FirstUse`, so that warning will only pop up once now.

# User-Facing Changes
Technically the change to the deprecation warning from nushell#15806 is user
facing but it's really not worth listing in the changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants