@@ -453,6 +453,9 @@ impl Editor {
453453
454454 /// Launch a language server for a given document
455455 fn launch_language_server(ls: &mut helix_lsp::Registry, doc: &mut Document) -> Option<()> {
456+ // if doc doesn't have a URL it's a scratch buffer, ignore it
457+ let doc_url = doc.url()?;
458+
456459 // try to find a language server based on the language name
457460 let language_server = doc.language.as_ref().and_then(|language| {
458461 ls.get(language)
@@ -476,7 +479,7 @@ impl Editor {
476479
477480 // TODO: this now races with on_init code if the init happens too quickly
478481 tokio::spawn(language_server.text_document_did_open(
479− doc.url().unwrap(),
482+ doc_url,
480483 doc.version(),
481484 doc.text(),
482485 language_id,