Skip to content

Remove the old fuzzy suggestion and fix the local script file name suggestion #25177

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

Merged
merged 2 commits into from
Mar 17, 2025

Conversation

daxian-dbw
Copy link
Member

PR Summary

The fuzzy command name suggestion for CommandNotFound error was moved out from experimental feature, but it (the legacy suggestion) doesn't work properly without the FeedbackProvider feature enabled (see the screenshot below).

image

This PR makes the following changes:

  1. Remove the legacy suggestion for fuzzy command names.
  2. Fix the resource string for the legacy suggestion for local script file name.
  3. Rename the built-in feedback provider from general to General Feedback.

PR Context

PR Checklist

@daxian-dbw daxian-dbw added CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log BackPort-7.4.x-Consider BackPort-7.5.x-Consider and removed BackPort-7.4.x-Consider labels Mar 14, 2025
Copy link
Member

@SteveL-MSFT SteveL-MSFT left a comment

Choose a reason for hiding this comment

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

We should eventually move the other built-in suggestion regarding running exes from current directory to a FeedbackProvider and remove the legacy suggestion code completely

@daxian-dbw
Copy link
Member Author

@SteveL-MSFT the other built-in suggestion was already moved to the FeedbackProvider code path (GeneralCommandErrorFeedback)

// See if target is actually an executable file in current directory.
var localTarget = Path.Combine(".", target);
var command = invocation.GetCommand(
localTarget,
CommandTypes.Application | CommandTypes.ExternalScript);
if (command is not null)
{
return new FeedbackItem(
StringUtil.Format(SuggestionStrings.Suggestion_CommandExistsInCurrentDirectory, target),
new List<string> { localTarget });
}

Currently we still go through the old suggestion when the FeedbackProvider exp feature is disabled. Once FeedbackProvider exp feature is considered ready to move to stable, we will remove the old suggestion completely.

@daxian-dbw
Copy link
Member Author

/azp run PowerShell-CI-linux-packaging PowerShell-Windows-Packaging-CI

Copy link

No pipelines are associated with this pull request.

@daxian-dbw daxian-dbw merged commit 48b25da into PowerShell:master Mar 17, 2025
37 of 38 checks passed
@daxian-dbw daxian-dbw deleted the fuzzy branch March 17, 2025 17:19
Copy link
Contributor

microsoft-github-policy-service bot commented Mar 17, 2025

📣 Hey @daxian-dbw, how did we do? We would love to hear your feedback with the link below! 🗣️

🔗 https://aka.ms/PSRepoFeedback

@daxian-dbw
Copy link
Member Author

/backport to release/v7.5

Copy link
Contributor

github-actions bot commented Mar 17, 2025

Started backporting to release/v7.5: https://github.com/PowerShell/PowerShell/actions/runs/13905810343

GitHub
PowerShell for every system! Contribute to PowerShell/PowerShell development by creating an account on GitHub.

Copy link
Contributor

@daxian-dbw an error occurred while backporting to "release/v7.5", please check the run log for details!

GitHub Actions is not permitted to create or approve pull requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backport-7.5.x-Migrated CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants