mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
fix(lsp): make the server available in nvim-lspconfig (#1823)
1. It seems that nvim-lspconfig diagnostics handler require **version** of **document**, now we can use `oxc_vscode` language server in neomvin with [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) 
This commit is contained in:
parent
7be3b1eec6
commit
c1bac34c76
1 changed files with 10 additions and 4 deletions
|
|
@ -173,7 +173,7 @@ impl LanguageServer for Backend {
|
|||
if self.is_ignored(¶ms.text_document.uri).await {
|
||||
return;
|
||||
}
|
||||
self.handle_file_update(params.text_document.uri, None).await;
|
||||
self.handle_file_update(params.text_document.uri, None, None).await;
|
||||
}
|
||||
|
||||
/// When the document changed, it may not be written to disk, so we should
|
||||
|
|
@ -188,7 +188,12 @@ impl LanguageServer for Backend {
|
|||
return;
|
||||
}
|
||||
let content = params.content_changes.first().map(|c| c.text.clone());
|
||||
self.handle_file_update(params.text_document.uri, content).await;
|
||||
self.handle_file_update(
|
||||
params.text_document.uri,
|
||||
content,
|
||||
Some(params.text_document.version),
|
||||
)
|
||||
.await;
|
||||
}
|
||||
|
||||
async fn did_open(&self, params: DidOpenTextDocumentParams) {
|
||||
|
|
@ -199,7 +204,8 @@ impl LanguageServer for Backend {
|
|||
if self.is_ignored(¶ms.text_document.uri).await {
|
||||
return;
|
||||
}
|
||||
self.handle_file_update(params.text_document.uri, None).await;
|
||||
self.handle_file_update(params.text_document.uri, None, Some(params.text_document.version))
|
||||
.await;
|
||||
}
|
||||
|
||||
async fn did_close(&self, params: DidCloseTextDocumentParams) {
|
||||
|
|
@ -304,7 +310,7 @@ impl Backend {
|
|||
.await;
|
||||
}
|
||||
|
||||
async fn handle_file_update(&self, uri: Url, content: Option<String>) {
|
||||
async fn handle_file_update(&self, uri: Url, content: Option<String>, version: Option<i32>) {
|
||||
if let Some(Some(root_uri)) = self.root_uri.get() {
|
||||
self.server_linter.make_plugin(root_uri);
|
||||
if let Some(diagnostics) = self.server_linter.run_single(root_uri, &uri, content) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue