Take a reference in LSP notify (#23077)
In current code this doesn't have benefit. In preparation for avoiding a clone of workspace configuration. Having the interface this way may make opportunities for efficiency clearer in the future Release Notes: - N/A
This commit is contained in:
parent
c1c767a5bd
commit
2f762955cd
10 changed files with 52 additions and 51 deletions
|
@ -302,7 +302,7 @@ impl LocalLspStore {
|
|||
|
||||
language_server
|
||||
.notify::<lsp::notification::DidChangeConfiguration>(
|
||||
lsp::DidChangeConfigurationParams {
|
||||
&lsp::DidChangeConfigurationParams {
|
||||
settings: workspace_config,
|
||||
},
|
||||
)
|
||||
|
@ -1922,7 +1922,7 @@ impl LocalLspStore {
|
|||
};
|
||||
|
||||
server
|
||||
.notify::<lsp::notification::DidOpenTextDocument>(lsp::DidOpenTextDocumentParams {
|
||||
.notify::<lsp::notification::DidOpenTextDocument>(&lsp::DidOpenTextDocumentParams {
|
||||
text_document: lsp::TextDocumentItem::new(
|
||||
uri.clone(),
|
||||
adapter.language_id(&language.name()),
|
||||
|
@ -1968,7 +1968,7 @@ impl LocalLspStore {
|
|||
for (_, language_server) in self.language_servers_for_buffer(buffer, cx) {
|
||||
language_server
|
||||
.notify::<lsp::notification::DidCloseTextDocument>(
|
||||
lsp::DidCloseTextDocumentParams {
|
||||
&lsp::DidCloseTextDocumentParams {
|
||||
text_document: lsp::TextDocumentIdentifier::new(file_url.clone()),
|
||||
},
|
||||
)
|
||||
|
@ -5068,7 +5068,7 @@ impl LspStore {
|
|||
|
||||
language_server
|
||||
.notify::<lsp::notification::DidChangeTextDocument>(
|
||||
lsp::DidChangeTextDocumentParams {
|
||||
&lsp::DidChangeTextDocumentParams {
|
||||
text_document: lsp::VersionedTextDocumentIdentifier::new(
|
||||
uri.clone(),
|
||||
next_version,
|
||||
|
@ -5104,7 +5104,7 @@ impl LspStore {
|
|||
};
|
||||
server
|
||||
.notify::<lsp::notification::DidSaveTextDocument>(
|
||||
lsp::DidSaveTextDocumentParams {
|
||||
&lsp::DidSaveTextDocumentParams {
|
||||
text_document: text_document.clone(),
|
||||
text,
|
||||
},
|
||||
|
@ -5174,7 +5174,7 @@ impl LspStore {
|
|||
|
||||
server
|
||||
.notify::<lsp::notification::DidChangeConfiguration>(
|
||||
lsp::DidChangeConfigurationParams { settings },
|
||||
&lsp::DidChangeConfigurationParams { settings },
|
||||
)
|
||||
.ok();
|
||||
}
|
||||
|
@ -6215,7 +6215,7 @@ impl LspStore {
|
|||
|
||||
if filter.should_send_did_rename(&old_uri, is_dir) {
|
||||
language_server
|
||||
.notify::<DidRenameFiles>(RenameFilesParams {
|
||||
.notify::<DidRenameFiles>(&RenameFilesParams {
|
||||
files: vec![FileRename {
|
||||
old_uri: old_uri.clone(),
|
||||
new_uri: new_uri.clone(),
|
||||
|
@ -6322,7 +6322,7 @@ impl LspStore {
|
|||
if !changes.is_empty() {
|
||||
server
|
||||
.notify::<lsp::notification::DidChangeWatchedFiles>(
|
||||
lsp::DidChangeWatchedFilesParams { changes },
|
||||
&lsp::DidChangeWatchedFilesParams { changes },
|
||||
)
|
||||
.log_err();
|
||||
}
|
||||
|
@ -7534,7 +7534,7 @@ impl LspStore {
|
|||
let uri = lsp::Url::from_file_path(file.abs_path(cx)).unwrap();
|
||||
language_server
|
||||
.notify::<lsp::notification::DidOpenTextDocument>(
|
||||
lsp::DidOpenTextDocumentParams {
|
||||
&lsp::DidOpenTextDocumentParams {
|
||||
text_document: lsp::TextDocumentItem::new(
|
||||
uri,
|
||||
adapter.language_id(&language.name()),
|
||||
|
@ -7636,10 +7636,11 @@ impl LspStore {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if progress.is_cancellable {
|
||||
server
|
||||
.notify::<lsp::notification::WorkDoneProgressCancel>(
|
||||
WorkDoneProgressCancelParams {
|
||||
&WorkDoneProgressCancelParams {
|
||||
token: lsp::NumberOrString::String(token.clone()),
|
||||
},
|
||||
)
|
||||
|
@ -7649,7 +7650,7 @@ impl LspStore {
|
|||
if progress.is_cancellable {
|
||||
server
|
||||
.notify::<lsp::notification::WorkDoneProgressCancel>(
|
||||
WorkDoneProgressCancelParams {
|
||||
&WorkDoneProgressCancelParams {
|
||||
token: lsp::NumberOrString::String(token.clone()),
|
||||
},
|
||||
)
|
||||
|
@ -7784,7 +7785,7 @@ impl LspStore {
|
|||
};
|
||||
if !params.changes.is_empty() {
|
||||
server
|
||||
.notify::<lsp::notification::DidChangeWatchedFiles>(params)
|
||||
.notify::<lsp::notification::DidChangeWatchedFiles>(¶ms)
|
||||
.log_err();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1269,7 +1269,7 @@ async fn test_disk_based_diagnostics_progress(cx: &mut gpui::TestAppContext) {
|
|||
}
|
||||
);
|
||||
|
||||
fake_server.notify::<lsp::notification::PublishDiagnostics>(lsp::PublishDiagnosticsParams {
|
||||
fake_server.notify::<lsp::notification::PublishDiagnostics>(&lsp::PublishDiagnosticsParams {
|
||||
uri: Url::from_file_path("/dir/a.rs").unwrap(),
|
||||
version: None,
|
||||
diagnostics: vec![lsp::Diagnostic {
|
||||
|
@ -1321,7 +1321,7 @@ async fn test_disk_based_diagnostics_progress(cx: &mut gpui::TestAppContext) {
|
|||
});
|
||||
|
||||
// Ensure publishing empty diagnostics twice only results in one update event.
|
||||
fake_server.notify::<lsp::notification::PublishDiagnostics>(lsp::PublishDiagnosticsParams {
|
||||
fake_server.notify::<lsp::notification::PublishDiagnostics>(&lsp::PublishDiagnosticsParams {
|
||||
uri: Url::from_file_path("/dir/a.rs").unwrap(),
|
||||
version: None,
|
||||
diagnostics: Default::default(),
|
||||
|
@ -1334,7 +1334,7 @@ async fn test_disk_based_diagnostics_progress(cx: &mut gpui::TestAppContext) {
|
|||
}
|
||||
);
|
||||
|
||||
fake_server.notify::<lsp::notification::PublishDiagnostics>(lsp::PublishDiagnosticsParams {
|
||||
fake_server.notify::<lsp::notification::PublishDiagnostics>(&lsp::PublishDiagnosticsParams {
|
||||
uri: Url::from_file_path("/dir/a.rs").unwrap(),
|
||||
version: None,
|
||||
diagnostics: Default::default(),
|
||||
|
@ -1453,7 +1453,7 @@ async fn test_restarting_server_with_diagnostics_published(cx: &mut gpui::TestAp
|
|||
|
||||
// Publish diagnostics
|
||||
let fake_server = fake_servers.next().await.unwrap();
|
||||
fake_server.notify::<lsp::notification::PublishDiagnostics>(lsp::PublishDiagnosticsParams {
|
||||
fake_server.notify::<lsp::notification::PublishDiagnostics>(&lsp::PublishDiagnosticsParams {
|
||||
uri: Url::from_file_path("/dir/a.rs").unwrap(),
|
||||
version: None,
|
||||
diagnostics: vec![lsp::Diagnostic {
|
||||
|
@ -1534,7 +1534,7 @@ async fn test_restarted_server_reporting_invalid_buffer_version(cx: &mut gpui::T
|
|||
|
||||
// Before restarting the server, report diagnostics with an unknown buffer version.
|
||||
let fake_server = fake_servers.next().await.unwrap();
|
||||
fake_server.notify::<lsp::notification::PublishDiagnostics>(lsp::PublishDiagnosticsParams {
|
||||
fake_server.notify::<lsp::notification::PublishDiagnostics>(&lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path("/dir/a.rs").unwrap(),
|
||||
version: Some(10000),
|
||||
diagnostics: Vec::new(),
|
||||
|
@ -1784,7 +1784,7 @@ async fn test_transforming_diagnostics(cx: &mut gpui::TestAppContext) {
|
|||
assert!(change_notification_1.text_document.version > open_notification.text_document.version);
|
||||
|
||||
// Report some diagnostics for the initial version of the buffer
|
||||
fake_server.notify::<lsp::notification::PublishDiagnostics>(lsp::PublishDiagnosticsParams {
|
||||
fake_server.notify::<lsp::notification::PublishDiagnostics>(&lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path("/dir/a.rs").unwrap(),
|
||||
version: Some(open_notification.text_document.version),
|
||||
diagnostics: vec![
|
||||
|
@ -1870,7 +1870,7 @@ async fn test_transforming_diagnostics(cx: &mut gpui::TestAppContext) {
|
|||
});
|
||||
|
||||
// Ensure overlapping diagnostics are highlighted correctly.
|
||||
fake_server.notify::<lsp::notification::PublishDiagnostics>(lsp::PublishDiagnosticsParams {
|
||||
fake_server.notify::<lsp::notification::PublishDiagnostics>(&lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path("/dir/a.rs").unwrap(),
|
||||
version: Some(open_notification.text_document.version),
|
||||
diagnostics: vec![
|
||||
|
@ -1962,7 +1962,7 @@ async fn test_transforming_diagnostics(cx: &mut gpui::TestAppContext) {
|
|||
);
|
||||
|
||||
// Handle out-of-order diagnostics
|
||||
fake_server.notify::<lsp::notification::PublishDiagnostics>(lsp::PublishDiagnosticsParams {
|
||||
fake_server.notify::<lsp::notification::PublishDiagnostics>(&lsp::PublishDiagnosticsParams {
|
||||
uri: lsp::Url::from_file_path("/dir/a.rs").unwrap(),
|
||||
version: Some(change_notification_2.text_document.version),
|
||||
diagnostics: vec![
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue