From 42fc2789139824edc27cc8ecd1b9c7402d072eb6 Mon Sep 17 00:00:00 2001 From: Isaac Clayton Date: Mon, 13 Jun 2022 16:58:56 +0200 Subject: [PATCH] Comment out label_for_completion for now --- crates/zed/src/languages/language_plugin.rs | 40 ++++++++++----------- plugins/json_language/src/lib.rs | 24 ++++++++++--- 2 files changed, 40 insertions(+), 24 deletions(-) diff --git a/crates/zed/src/languages/language_plugin.rs b/crates/zed/src/languages/language_plugin.rs index f7f7720c3af3efda4bb209ff1e01a6519361e95e..74e29afdfbb31a06d6f63eb2e439f265f694db48 100644 --- a/crates/zed/src/languages/language_plugin.rs +++ b/crates/zed/src/languages/language_plugin.rs @@ -32,7 +32,7 @@ pub struct PluginLspAdapter { fetch_latest_server_version: WasiFn<(), Option>, fetch_server_binary: WasiFn<(PathBuf, String), Result>, cached_server_binary: WasiFn>, - label_for_completion: WasiFn>, + // label_for_completion: WasiFn>, initialization_options: WasiFn<(), String>, executor: Arc, runtime: Arc>, @@ -46,7 +46,7 @@ impl PluginLspAdapter { fetch_latest_server_version: plugin.function("fetch_latest_server_version")?, fetch_server_binary: plugin.function("fetch_server_binary")?, cached_server_binary: plugin.function("cached_server_binary")?, - label_for_completion: plugin.function("label_for_completion")?, + // label_for_completion: plugin.function("label_for_completion")?, initialization_options: plugin.function("initialization_options")?, executor, runtime: Arc::new(Mutex::new(plugin)), @@ -132,24 +132,24 @@ impl LspAdapter for PluginLspAdapter { fn process_diagnostics(&self, _: &mut lsp::PublishDiagnosticsParams) {} - fn label_for_completion( - &self, - item: &lsp::CompletionItem, - language: &language::Language, - ) -> Option { - // TODO: Push more of this method down into the plugin. - use lsp::CompletionItemKind as Kind; - let len = item.label.len(); - let grammar = language.grammar()?; - let kind = format!("{:?}", item.kind?); - let name: String = call_block!(self, &self.label_for_completion, kind).log_err()??; - let highlight_id = grammar.highlight_id_for_name(&name)?; - Some(language::CodeLabel { - text: item.label.clone(), - runs: vec![(0..len, highlight_id)], - filter_range: 0..len, - }) - } + // fn label_for_completion( + // &self, + // item: &lsp::CompletionItem, + // language: &language::Language, + // ) -> Option { + // // TODO: Push more of this method down into the plugin. + // use lsp::CompletionItemKind as Kind; + // let len = item.label.len(); + // let grammar = language.grammar()?; + // let kind = format!("{:?}", item.kind?); + // let name: String = call_block!(self, &self.label_for_completion, kind).log_err()??; + // let highlight_id = grammar.highlight_id_for_name(&name)?; + // Some(language::CodeLabel { + // text: item.label.clone(), + // runs: vec![(0..len, highlight_id)], + // filter_range: 0..len, + // }) + // } fn initialization_options(&self) -> Option { let string: String = call_block!(self, &self.initialization_options, ()).log_err()?; diff --git a/plugins/json_language/src/lib.rs b/plugins/json_language/src/lib.rs index 5d20bd369abea2ba8347aa3882ff130b395d9d3e..11be11712984f2558d3a8475c4f5504cc565a75c 100644 --- a/plugins/json_language/src/lib.rs +++ b/plugins/json_language/src/lib.rs @@ -169,10 +169,26 @@ pub fn cached_server_binary(container_dir: PathBuf) -> Option { } } -#[export] -pub fn label_for_completion(label: String) -> Option { - None -} +// #[export] +// pub fn label_for_completion( +// item: &lsp::CompletionItem, +// // language: &language::Language, +// ) -> Option { +// // TODO: Push more of this method down into the plugin. +// use lsp::CompletionItemKind as Kind; +// let len = item.label.len(); +// let grammar = language.grammar()?; +// let kind = format!("{:?}", item.kind?); + +// // TODO: implementation + +// let highlight_id = grammar.highlight_id_for_name(&name)?; +// Some(language::CodeLabel { +// text: item.label.clone(), +// runs: vec![(0..len, highlight_id)], +// filter_range: 0..len, +// }) +// } #[export] pub fn initialization_options() -> Option {