Comment out label_for_completion for now
This commit is contained in:
parent
f61ef446d3
commit
42fc278913
2 changed files with 40 additions and 24 deletions
|
@ -32,7 +32,7 @@ pub struct PluginLspAdapter {
|
||||||
fetch_latest_server_version: WasiFn<(), Option<String>>,
|
fetch_latest_server_version: WasiFn<(), Option<String>>,
|
||||||
fetch_server_binary: WasiFn<(PathBuf, String), Result<PathBuf, String>>,
|
fetch_server_binary: WasiFn<(PathBuf, String), Result<PathBuf, String>>,
|
||||||
cached_server_binary: WasiFn<PathBuf, Option<PathBuf>>,
|
cached_server_binary: WasiFn<PathBuf, Option<PathBuf>>,
|
||||||
label_for_completion: WasiFn<String, Option<String>>,
|
// label_for_completion: WasiFn<String, Option<String>>,
|
||||||
initialization_options: WasiFn<(), String>,
|
initialization_options: WasiFn<(), String>,
|
||||||
executor: Arc<Background>,
|
executor: Arc<Background>,
|
||||||
runtime: Arc<Mutex<Plugin>>,
|
runtime: Arc<Mutex<Plugin>>,
|
||||||
|
@ -46,7 +46,7 @@ impl PluginLspAdapter {
|
||||||
fetch_latest_server_version: plugin.function("fetch_latest_server_version")?,
|
fetch_latest_server_version: plugin.function("fetch_latest_server_version")?,
|
||||||
fetch_server_binary: plugin.function("fetch_server_binary")?,
|
fetch_server_binary: plugin.function("fetch_server_binary")?,
|
||||||
cached_server_binary: plugin.function("cached_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")?,
|
initialization_options: plugin.function("initialization_options")?,
|
||||||
executor,
|
executor,
|
||||||
runtime: Arc::new(Mutex::new(plugin)),
|
runtime: Arc::new(Mutex::new(plugin)),
|
||||||
|
@ -132,24 +132,24 @@ impl LspAdapter for PluginLspAdapter {
|
||||||
|
|
||||||
fn process_diagnostics(&self, _: &mut lsp::PublishDiagnosticsParams) {}
|
fn process_diagnostics(&self, _: &mut lsp::PublishDiagnosticsParams) {}
|
||||||
|
|
||||||
fn label_for_completion(
|
// fn label_for_completion(
|
||||||
&self,
|
// &self,
|
||||||
item: &lsp::CompletionItem,
|
// item: &lsp::CompletionItem,
|
||||||
language: &language::Language,
|
// language: &language::Language,
|
||||||
) -> Option<language::CodeLabel> {
|
// ) -> Option<language::CodeLabel> {
|
||||||
// TODO: Push more of this method down into the plugin.
|
// // TODO: Push more of this method down into the plugin.
|
||||||
use lsp::CompletionItemKind as Kind;
|
// use lsp::CompletionItemKind as Kind;
|
||||||
let len = item.label.len();
|
// let len = item.label.len();
|
||||||
let grammar = language.grammar()?;
|
// let grammar = language.grammar()?;
|
||||||
let kind = format!("{:?}", item.kind?);
|
// let kind = format!("{:?}", item.kind?);
|
||||||
let name: String = call_block!(self, &self.label_for_completion, kind).log_err()??;
|
// let name: String = call_block!(self, &self.label_for_completion, kind).log_err()??;
|
||||||
let highlight_id = grammar.highlight_id_for_name(&name)?;
|
// let highlight_id = grammar.highlight_id_for_name(&name)?;
|
||||||
Some(language::CodeLabel {
|
// Some(language::CodeLabel {
|
||||||
text: item.label.clone(),
|
// text: item.label.clone(),
|
||||||
runs: vec![(0..len, highlight_id)],
|
// runs: vec![(0..len, highlight_id)],
|
||||||
filter_range: 0..len,
|
// filter_range: 0..len,
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
|
|
||||||
fn initialization_options(&self) -> Option<serde_json::Value> {
|
fn initialization_options(&self) -> Option<serde_json::Value> {
|
||||||
let string: String = call_block!(self, &self.initialization_options, ()).log_err()?;
|
let string: String = call_block!(self, &self.initialization_options, ()).log_err()?;
|
||||||
|
|
|
@ -169,10 +169,26 @@ pub fn cached_server_binary(container_dir: PathBuf) -> Option<PathBuf> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[export]
|
// #[export]
|
||||||
pub fn label_for_completion(label: String) -> Option<String> {
|
// pub fn label_for_completion(
|
||||||
None
|
// item: &lsp::CompletionItem,
|
||||||
}
|
// // language: &language::Language,
|
||||||
|
// ) -> Option<language::CodeLabel> {
|
||||||
|
// // 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]
|
#[export]
|
||||||
pub fn initialization_options() -> Option<String> {
|
pub fn initialization_options() -> Option<String> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue