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

Commit 0d50c7b

Browse files
committed
Add deprecation notification
1 parent 7241c6c commit 0d50c7b

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

rls/src/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ pub struct Config {
175175
pub build_command: Option<String>,
176176
/// DEPRECATED: Use `crate_blacklist` instead.
177177
pub use_crate_blacklist: Option<bool>,
178+
pub ignore_deprecation_warning: bool,
178179
}
179180

180181
impl Default for Config {
@@ -205,6 +206,7 @@ impl Default for Config {
205206
rustfmt_path: None,
206207
build_command: None,
207208
use_crate_blacklist: None,
209+
ignore_deprecation_warning: false,
208210
};
209211
result.normalise();
210212
result

rls/src/server/mod.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,17 @@ pub(crate) fn maybe_notify_duplicated_configs<O: Output>(
136136
}));
137137
}
138138

139+
/// Notify client of the RLS deprecation
140+
pub(crate) fn maybe_notify_deprecation<O: Output>(out: &O, surpress: bool) {
141+
if surpress {
142+
return;
143+
}
144+
out.notify(Notification::<ShowMessage>::new(ShowMessageParams {
145+
typ: MessageType::Warning,
146+
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(),
147+
}));
148+
}
149+
139150
impl BlockingRequestAction for InitializeRequest {
140151
type Response = NoResponse;
141152

@@ -172,6 +183,10 @@ impl BlockingRequestAction for InitializeRequest {
172183
));
173184
}
174185

186+
maybe_notify_deprecation(
187+
&out,
188+
init_options.settings.as_ref().map_or(false, |it| it.rust.ignore_deprecation_warning),
189+
);
175190
maybe_notify_unknown_configs(&out, &unknowns);
176191
maybe_notify_deprecated_configs(&out, &deprecated);
177192
maybe_notify_duplicated_configs(&out, &dups);

0 commit comments

Comments
 (0)