Add local next LSP adapter
This commit is contained in:
parent
0cceb3fdf1
commit
02a85b1252
5 changed files with 206 additions and 12 deletions
|
@ -2267,11 +2267,13 @@ impl Project {
|
|||
};
|
||||
|
||||
for (_, _, server) in self.language_servers_for_worktree(worktree_id) {
|
||||
let text = include_text(server.as_ref()).then(|| buffer.read(cx).text());
|
||||
|
||||
server
|
||||
.notify::<lsp::notification::DidSaveTextDocument>(
|
||||
lsp::DidSaveTextDocumentParams {
|
||||
text_document: text_document.clone(),
|
||||
text: None,
|
||||
text,
|
||||
},
|
||||
)
|
||||
.log_err();
|
||||
|
@ -8274,3 +8276,19 @@ async fn wait_for_loading_buffer(
|
|||
receiver.next().await;
|
||||
}
|
||||
}
|
||||
|
||||
fn include_text(server: &lsp::LanguageServer) -> bool {
|
||||
server
|
||||
.capabilities()
|
||||
.text_document_sync
|
||||
.as_ref()
|
||||
.and_then(|sync| match sync {
|
||||
lsp::TextDocumentSyncCapability::Kind(_) => None,
|
||||
lsp::TextDocumentSyncCapability::Options(options) => options.save.as_ref(),
|
||||
})
|
||||
.and_then(|save_options| match save_options {
|
||||
lsp::TextDocumentSyncSaveOptions::Supported(_) => None,
|
||||
lsp::TextDocumentSyncSaveOptions::SaveOptions(options) => options.include_text,
|
||||
})
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue