mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 09:26:19 +04:00
log errors produced when trying to initialize the LSP (#746)
This commit is contained in:
parent
51b7f40da1
commit
ef532e0c0d
@ -318,7 +318,15 @@ pub fn get(&mut self, language_config: &LanguageConfiguration) -> Result<Arc<Cli
|
||||
let (client, incoming, initialize_notify) = Client::start(
|
||||
&config.command,
|
||||
&config.args,
|
||||
serde_json::from_str(language_config.config.as_deref().unwrap_or("")).ok(),
|
||||
serde_json::from_str(language_config.config.as_deref().unwrap_or(""))
|
||||
.map_err(|e| {
|
||||
log::error!(
|
||||
"LSP Config, {}, in `languages.toml` for `{}`",
|
||||
e,
|
||||
language_config.scope()
|
||||
)
|
||||
})
|
||||
.ok(),
|
||||
id,
|
||||
)?;
|
||||
self.incoming.push(UnboundedReceiverStream::new(incoming));
|
||||
|
@ -249,10 +249,14 @@ pub fn open(&mut self, path: PathBuf, action: Action) -> Result<DocumentId, Erro
|
||||
let mut doc = Document::open(&path, None, Some(&self.theme), Some(&self.syn_loader))?;
|
||||
|
||||
// try to find a language server based on the language name
|
||||
let language_server = doc
|
||||
.language
|
||||
.as_ref()
|
||||
.and_then(|language| self.language_servers.get(language).ok());
|
||||
let language_server = doc.language.as_ref().and_then(|language| {
|
||||
self.language_servers
|
||||
.get(language)
|
||||
.map_err(|e| {
|
||||
log::error!("Failed to get LSP, {}, for `{}`", e, language.scope())
|
||||
})
|
||||
.ok()
|
||||
});
|
||||
|
||||
if let Some(language_server) = language_server {
|
||||
let language_id = doc
|
||||
|
Loading…
Reference in New Issue
Block a user