Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1776 from Veykril/deprecation
Browse files Browse the repository at this point in the history
Add deprecation notification
  • Loading branch information
Xanewok authored Jun 20, 2022
2 parents b36840e + 0d50c7b commit df11a04
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rls/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ pub struct Config {
pub build_command: Option<String>,
/// DEPRECATED: Use `crate_blacklist` instead.
pub use_crate_blacklist: Option<bool>,
pub ignore_deprecation_warning: bool,
}

impl Default for Config {
Expand Down Expand Up @@ -205,6 +206,7 @@ impl Default for Config {
rustfmt_path: None,
build_command: None,
use_crate_blacklist: None,
ignore_deprecation_warning: false,
};
result.normalise();
result
Expand Down
15 changes: 15 additions & 0 deletions rls/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,17 @@ pub(crate) fn maybe_notify_duplicated_configs<O: Output>(
}));
}

/// Notify client of the RLS deprecation
pub(crate) fn maybe_notify_deprecation<O: Output>(out: &O, surpress: bool) {
if surpress {
return;
}
out.notify(Notification::<ShowMessage>::new(ShowMessageParams {
typ: MessageType::Warning,
message: "The RLS is being deprecated in favor of rust-analyzer. Current users of RLS should begin migrating to using rust-analyzer instead.".to_owned(),
}));
}

impl BlockingRequestAction for InitializeRequest {
type Response = NoResponse;

Expand Down Expand Up @@ -172,6 +183,10 @@ impl BlockingRequestAction for InitializeRequest {
));
}

maybe_notify_deprecation(
&out,
init_options.settings.as_ref().map_or(false, |it| it.rust.ignore_deprecation_warning),
);
maybe_notify_unknown_configs(&out, &unknowns);
maybe_notify_deprecated_configs(&out, &deprecated);
maybe_notify_duplicated_configs(&out, &dups);
Expand Down

0 comments on commit df11a04

Please sign in to comment.