mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-19 18:41:56 +03:00
lsp: Fill in version for SnippetEdit from drive (#17360)
Related to #16680 Release Notes: - N/A
This commit is contained in:
parent
30b2133336
commit
8d4bdd6dc6
@ -5715,11 +5715,10 @@ impl LspStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !snippet_edits.is_empty() {
|
if !snippet_edits.is_empty() {
|
||||||
if let Some(buffer_version) = op.text_document.version {
|
|
||||||
let buffer_id = buffer_to_edit.read(cx).remote_id();
|
let buffer_id = buffer_to_edit.read(cx).remote_id();
|
||||||
// Check if the edit that triggered that edit has been made by this participant.
|
let version = if let Some(buffer_version) = op.text_document.version
|
||||||
let most_recent_edit = this
|
{
|
||||||
.buffer_snapshots
|
this.buffer_snapshots
|
||||||
.get(&buffer_id)
|
.get(&buffer_id)
|
||||||
.and_then(|server_to_snapshots| {
|
.and_then(|server_to_snapshots| {
|
||||||
let all_snapshots = server_to_snapshots
|
let all_snapshots = server_to_snapshots
|
||||||
@ -5731,10 +5730,16 @@ impl LspStore {
|
|||||||
.ok()
|
.ok()
|
||||||
.and_then(|index| all_snapshots.get(index))
|
.and_then(|index| all_snapshots.get(index))
|
||||||
})
|
})
|
||||||
.and_then(|lsp_snapshot| {
|
.map(|lsp_snapshot| lsp_snapshot.snapshot.version())
|
||||||
let version = lsp_snapshot.snapshot.version();
|
} else {
|
||||||
|
Some(buffer_to_edit.read(cx).saved_version())
|
||||||
|
};
|
||||||
|
|
||||||
|
let most_recent_edit = version.and_then(|version| {
|
||||||
version.iter().max_by_key(|timestamp| timestamp.value)
|
version.iter().max_by_key(|timestamp| timestamp.value)
|
||||||
});
|
});
|
||||||
|
// Check if the edit that triggered that edit has been made by this participant.
|
||||||
|
|
||||||
if let Some(most_recent_edit) = most_recent_edit {
|
if let Some(most_recent_edit) = most_recent_edit {
|
||||||
cx.emit(LspStoreEvent::SnippetEdit {
|
cx.emit(LspStoreEvent::SnippetEdit {
|
||||||
buffer_id,
|
buffer_id,
|
||||||
@ -5743,7 +5748,6 @@ impl LspStore {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
this.edits_from_lsp(
|
this.edits_from_lsp(
|
||||||
&buffer_to_edit,
|
&buffer_to_edit,
|
||||||
|
Loading…
Reference in New Issue
Block a user