-
Notifications
You must be signed in to change notification settings - Fork 70
Closed
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed
Description
I always feel frustrated when I'd like to refactor Error enum, since I could not use "Rename Symbol" feature provided by vscode and rust-analyzer.
When I add PackageBConfigError, I'd like to rename ConfigError to PackageAConfigError, but it would cause compilation failing since vscode would not rename ConfigSnafu to PackageAConfigSnafu for me.
#[derive(Debug, snafu::Snafu)]
pub enum Error {
#[snafu(rename = "ConfigSnafu"] // <-- suggest adding optional rename field helps IDE to do refactor
ConfigError { .. },
PackageBConfigError { .. }
}Is there any workaround?
My sugguestion
Shall we allow an attr that be the span of generated Snafu struct? We could do refactor maybe in this way.
- add corresponding attr
#[snafu(rename = "ConfigSnafu"]toConfigError { .. }, - press F2 on
ConfigErrorto rename toPackageAConfigError, but it would still useConfigSnafufor context - press F2 on
ConfigSnafuto rename toPackageAConfigSnafu - delete temp attr
#[snafu(rename = "PackageAConfigSnafu"]
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed