Add support for the experimental Next LS for Elixir (#3024)
This is a PR I built for a friend of a friend at StrangeLoop, who is making a much better LSP for elixir that elixir folks want to experiment with. This PR also improves the our debug log viewer to handle LSP restarts. TODO: - [ ] Make sure NextLS binary loading works. Release Notes: - Added support for the experimental Next LS for Elxir, to enable it add the following field to your settings to enable: ```json "elixir": { "next": "on" } ```
This commit is contained in:
commit
591ec02cea
12 changed files with 397 additions and 16 deletions
|
@ -2280,11 +2280,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();
|
||||
|
@ -8325,3 +8327,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