mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
Undo the previous mistaken change and make publish_decorations optional
See https://github.com/Microsoft/language-server-protocol/issues/567 for motivations to not require `InitializationOptions` TODO: Check if there are any other protocol extensions which should be disabled if not implemented on the client
This commit is contained in:
parent
70e5fb98a0
commit
380733d6d0
2 changed files with 11 additions and 8 deletions
|
@ -27,7 +27,10 @@ fn main() -> Result<()> {
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
struct InitializationOptions {
|
struct InitializationOptions {
|
||||||
highlighting_on: bool,
|
// Whether the client supports our custom highlighting publishing decorations.
|
||||||
|
// This is different to the highlightingOn setting, which is whether the client
|
||||||
|
// wants highlighting to be used or sent.
|
||||||
|
publish_decorations: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main_inner() -> Result<()> {
|
fn main_inner() -> Result<()> {
|
||||||
|
@ -42,12 +45,12 @@ fn main_inner() -> Result<()> {
|
||||||
.root_uri
|
.root_uri
|
||||||
.and_then(|it| it.to_file_path().ok())
|
.and_then(|it| it.to_file_path().ok())
|
||||||
.unwrap_or(cwd);
|
.unwrap_or(cwd);
|
||||||
let publish_decorations = params
|
let supports_decorations = params
|
||||||
.initialization_options
|
.initialization_options
|
||||||
.and_then(|v| InitializationOptions::deserialize(v).ok())
|
.and_then(|v| InitializationOptions::deserialize(v).ok())
|
||||||
.map(|it| it.highlighting_on)
|
.and_then(|it| it.publish_decorations)
|
||||||
== Some(true);
|
== Some(true);
|
||||||
ra_lsp_server::main_loop(false, root, publish_decorations, r, s)
|
ra_lsp_server::main_loop(false, root, supports_decorations, r, s)
|
||||||
},
|
},
|
||||||
)?;
|
)?;
|
||||||
log::info!("shutting down IO...");
|
log::info!("shutting down IO...");
|
||||||
|
|
|
@ -53,7 +53,7 @@ enum Task {
|
||||||
pub fn main_loop(
|
pub fn main_loop(
|
||||||
internal_mode: bool,
|
internal_mode: bool,
|
||||||
ws_root: PathBuf,
|
ws_root: PathBuf,
|
||||||
publish_decorations: bool,
|
supports_decorations: bool,
|
||||||
msg_receiver: &Receiver<RawMessage>,
|
msg_receiver: &Receiver<RawMessage>,
|
||||||
msg_sender: &Sender<RawMessage>,
|
msg_sender: &Sender<RawMessage>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
|
@ -82,7 +82,7 @@ pub fn main_loop(
|
||||||
let mut subs = Subscriptions::new();
|
let mut subs = Subscriptions::new();
|
||||||
let main_res = main_loop_inner(
|
let main_res = main_loop_inner(
|
||||||
internal_mode,
|
internal_mode,
|
||||||
publish_decorations,
|
supports_decorations,
|
||||||
&pool,
|
&pool,
|
||||||
msg_sender,
|
msg_sender,
|
||||||
msg_receiver,
|
msg_receiver,
|
||||||
|
@ -111,7 +111,7 @@ pub fn main_loop(
|
||||||
|
|
||||||
fn main_loop_inner(
|
fn main_loop_inner(
|
||||||
internal_mode: bool,
|
internal_mode: bool,
|
||||||
publish_decorations: bool,
|
supports_decorations: bool,
|
||||||
pool: &ThreadPool,
|
pool: &ThreadPool,
|
||||||
msg_sender: &Sender<RawMessage>,
|
msg_sender: &Sender<RawMessage>,
|
||||||
msg_receiver: &Receiver<RawMessage>,
|
msg_receiver: &Receiver<RawMessage>,
|
||||||
|
@ -201,7 +201,7 @@ fn main_loop_inner(
|
||||||
update_file_notifications_on_threadpool(
|
update_file_notifications_on_threadpool(
|
||||||
pool,
|
pool,
|
||||||
state.snapshot(),
|
state.snapshot(),
|
||||||
publish_decorations,
|
supports_decorations,
|
||||||
task_sender.clone(),
|
task_sender.clone(),
|
||||||
subs.subscriptions(),
|
subs.subscriptions(),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue