diff options
Diffstat (limited to 'crates/ra_lsp_server')
-rw-r--r-- | crates/ra_lsp_server/src/conv.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/crates/ra_lsp_server/src/conv.rs b/crates/ra_lsp_server/src/conv.rs index 63827aeea..5a911d9d2 100644 --- a/crates/ra_lsp_server/src/conv.rs +++ b/crates/ra_lsp_server/src/conv.rs | |||
@@ -235,13 +235,15 @@ impl TryConvWith for SourceChange { | |||
235 | None => None, | 235 | None => None, |
236 | Some(pos) => { | 236 | Some(pos) => { |
237 | let line_index = world.analysis().file_line_index(pos.file_id); | 237 | let line_index = world.analysis().file_line_index(pos.file_id); |
238 | let edits = self | 238 | let edit = self |
239 | .source_file_edits | 239 | .source_file_edits |
240 | .iter() | 240 | .iter() |
241 | .find(|it| it.file_id == pos.file_id) | 241 | .find(|it| it.file_id == pos.file_id) |
242 | .map(|it| it.edit.as_atoms()) | 242 | .map(|it| &it.edit); |
243 | .unwrap_or(&[]); | 243 | let line_col = match edit { |
244 | let line_col = translate_offset_with_edit(&*line_index, pos.offset, edits); | 244 | Some(edit) => translate_offset_with_edit(&*line_index, pos.offset, edit), |
245 | None => line_index.line_col(pos.offset), | ||
246 | }; | ||
245 | let position = | 247 | let position = |
246 | Position::new(u64::from(line_col.line), u64::from(line_col.col_utf16)); | 248 | Position::new(u64::from(line_col.line), u64::from(line_col.col_utf16)); |
247 | Some(TextDocumentPositionParams { | 249 | Some(TextDocumentPositionParams { |