aboutsummaryrefslogtreecommitdiff
path: root/crates/ide
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-01-14 21:43:36 +0000
committerLukas Wirth <[email protected]>2021-01-14 21:43:36 +0000
commitd5095329a1c12e93653d8de4a93f0b4f5cad4c6e (patch)
tree1de73ddefe48cc9f82cb4f063eaddc069adf83bc /crates/ide
parente23bfafb32a235fdb60ba279ea68b5aa381c2110 (diff)
Phase out SourceFileEdits in favour of a plain HashMap
Diffstat (limited to 'crates/ide')
-rw-r--r--crates/ide/src/diagnostics.rs12
-rw-r--r--crates/ide/src/diagnostics/field_shorthand.rs6
-rw-r--r--crates/ide/src/diagnostics/fixes.rs18
-rw-r--r--crates/ide/src/lib.rs2
-rw-r--r--crates/ide/src/references/rename.rs195
-rw-r--r--crates/ide/src/typing.rs3
6 files changed, 111 insertions, 125 deletions
diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs
index a43188fb0..2e5395b51 100644
--- a/crates/ide/src/diagnostics.rs
+++ b/crates/ide/src/diagnostics.rs
@@ -13,7 +13,7 @@ use hir::{
13 diagnostics::{Diagnostic as _, DiagnosticCode, DiagnosticSinkBuilder}, 13 diagnostics::{Diagnostic as _, DiagnosticCode, DiagnosticSinkBuilder},
14 Semantics, 14 Semantics,
15}; 15};
16use ide_db::{base_db::SourceDatabase, source_change::SourceFileEdits, RootDatabase}; 16use ide_db::{base_db::SourceDatabase, RootDatabase};
17use itertools::Itertools; 17use itertools::Itertools;
18use rustc_hash::FxHashSet; 18use rustc_hash::FxHashSet;
19use syntax::{ 19use syntax::{
@@ -219,7 +219,7 @@ fn check_unnecessary_braces_in_use_statement(
219 Diagnostic::hint(use_range, "Unnecessary braces in use statement".to_string()) 219 Diagnostic::hint(use_range, "Unnecessary braces in use statement".to_string())
220 .with_fix(Some(Fix::new( 220 .with_fix(Some(Fix::new(
221 "Remove unnecessary braces", 221 "Remove unnecessary braces",
222 SourceFileEdits::from_text_edit(file_id, edit).into(), 222 SourceChange::from_text_edit(file_id, edit),
223 use_range, 223 use_range,
224 ))), 224 ))),
225 ); 225 );
@@ -264,10 +264,10 @@ mod tests {
264 .unwrap(); 264 .unwrap();
265 let fix = diagnostic.fix.unwrap(); 265 let fix = diagnostic.fix.unwrap();
266 let actual = { 266 let actual = {
267 let file_id = *fix.source_change.source_file_edits.edits.keys().next().unwrap(); 267 let file_id = *fix.source_change.source_file_edits.keys().next().unwrap();
268 let mut actual = analysis.file_text(file_id).unwrap().to_string(); 268 let mut actual = analysis.file_text(file_id).unwrap().to_string();
269 269
270 for edit in fix.source_change.source_file_edits.edits.values() { 270 for edit in fix.source_change.source_file_edits.values() {
271 edit.apply(&mut actual); 271 edit.apply(&mut actual);
272 } 272 }
273 actual 273 actual
@@ -613,9 +613,7 @@ fn test_fn() {
613 Fix { 613 Fix {
614 label: "Create module", 614 label: "Create module",
615 source_change: SourceChange { 615 source_change: SourceChange {
616 source_file_edits: SourceFileEdits { 616 source_file_edits: {},
617 edits: {},
618 },
619 file_system_edits: [ 617 file_system_edits: [
620 CreateFile { 618 CreateFile {
621 dst: AnchoredPathBuf { 619 dst: AnchoredPathBuf {
diff --git a/crates/ide/src/diagnostics/field_shorthand.rs b/crates/ide/src/diagnostics/field_shorthand.rs
index f4ec51b64..5c89e2170 100644
--- a/crates/ide/src/diagnostics/field_shorthand.rs
+++ b/crates/ide/src/diagnostics/field_shorthand.rs
@@ -1,7 +1,7 @@
1//! Suggests shortening `Foo { field: field }` to `Foo { field }` in both 1//! Suggests shortening `Foo { field: field }` to `Foo { field }` in both
2//! expressions and patterns. 2//! expressions and patterns.
3 3
4use ide_db::{base_db::FileId, source_change::SourceFileEdits}; 4use ide_db::{base_db::FileId, source_change::SourceChange};
5use syntax::{ast, match_ast, AstNode, SyntaxNode}; 5use syntax::{ast, match_ast, AstNode, SyntaxNode};
6use text_edit::TextEdit; 6use text_edit::TextEdit;
7 7
@@ -49,7 +49,7 @@ fn check_expr_field_shorthand(
49 Diagnostic::hint(field_range, "Shorthand struct initialization".to_string()).with_fix( 49 Diagnostic::hint(field_range, "Shorthand struct initialization".to_string()).with_fix(
50 Some(Fix::new( 50 Some(Fix::new(
51 "Use struct shorthand initialization", 51 "Use struct shorthand initialization",
52 SourceFileEdits::from_text_edit(file_id, edit).into(), 52 SourceChange::from_text_edit(file_id, edit),
53 field_range, 53 field_range,
54 )), 54 )),
55 ), 55 ),
@@ -88,7 +88,7 @@ fn check_pat_field_shorthand(
88 acc.push(Diagnostic::hint(field_range, "Shorthand struct pattern".to_string()).with_fix( 88 acc.push(Diagnostic::hint(field_range, "Shorthand struct pattern".to_string()).with_fix(
89 Some(Fix::new( 89 Some(Fix::new(
90 "Use struct field shorthand", 90 "Use struct field shorthand",
91 SourceFileEdits::from_text_edit(file_id, edit).into(), 91 SourceChange::from_text_edit(file_id, edit),
92 field_range, 92 field_range,
93 )), 93 )),
94 )); 94 ));
diff --git a/crates/ide/src/diagnostics/fixes.rs b/crates/ide/src/diagnostics/fixes.rs
index b04964ccd..e4335119b 100644
--- a/crates/ide/src/diagnostics/fixes.rs
+++ b/crates/ide/src/diagnostics/fixes.rs
@@ -10,7 +10,7 @@ use hir::{
10}; 10};
11use ide_db::{ 11use ide_db::{
12 base_db::{AnchoredPathBuf, FileId}, 12 base_db::{AnchoredPathBuf, FileId},
13 source_change::{FileSystemEdit, SourceFileEdits}, 13 source_change::{FileSystemEdit, SourceChange},
14 RootDatabase, 14 RootDatabase,
15}; 15};
16use syntax::{ 16use syntax::{
@@ -88,7 +88,7 @@ impl DiagnosticWithFix for MissingFields {
88 }; 88 };
89 Some(Fix::new( 89 Some(Fix::new(
90 "Fill struct fields", 90 "Fill struct fields",
91 SourceFileEdits::from_text_edit(self.file.original_file(sema.db), edit).into(), 91 SourceChange::from_text_edit(self.file.original_file(sema.db), edit),
92 sema.original_range(&field_list_parent.syntax()).range, 92 sema.original_range(&field_list_parent.syntax()).range,
93 )) 93 ))
94 } 94 }
@@ -101,8 +101,7 @@ impl DiagnosticWithFix for MissingOkOrSomeInTailExpr {
101 let tail_expr_range = tail_expr.syntax().text_range(); 101 let tail_expr_range = tail_expr.syntax().text_range();
102 let replacement = format!("{}({})", self.required, tail_expr.syntax()); 102 let replacement = format!("{}({})", self.required, tail_expr.syntax());
103 let edit = TextEdit::replace(tail_expr_range, replacement); 103 let edit = TextEdit::replace(tail_expr_range, replacement);
104 let source_change = 104 let source_change = SourceChange::from_text_edit(self.file.original_file(sema.db), edit);
105 SourceFileEdits::from_text_edit(self.file.original_file(sema.db), edit).into();
106 let name = if self.required == "Ok" { "Wrap with Ok" } else { "Wrap with Some" }; 105 let name = if self.required == "Ok" { "Wrap with Ok" } else { "Wrap with Some" };
107 Some(Fix::new(name, source_change, tail_expr_range)) 106 Some(Fix::new(name, source_change, tail_expr_range))
108 } 107 }
@@ -122,8 +121,7 @@ impl DiagnosticWithFix for RemoveThisSemicolon {
122 .text_range(); 121 .text_range();
123 122
124 let edit = TextEdit::delete(semicolon); 123 let edit = TextEdit::delete(semicolon);
125 let source_change = 124 let source_change = SourceChange::from_text_edit(self.file.original_file(sema.db), edit);
126 SourceFileEdits::from_text_edit(self.file.original_file(sema.db), edit).into();
127 125
128 Some(Fix::new("Remove this semicolon", source_change, semicolon)) 126 Some(Fix::new("Remove this semicolon", source_change, semicolon))
129 } 127 }
@@ -204,15 +202,11 @@ fn missing_record_expr_field_fix(
204 new_field = format!(",{}", new_field); 202 new_field = format!(",{}", new_field);
205 } 203 }
206 204
207 let source_change = SourceFileEdits::from_text_edit( 205 let source_change = SourceChange::from_text_edit(
208 def_file_id, 206 def_file_id,
209 TextEdit::insert(last_field_syntax.text_range().end(), new_field), 207 TextEdit::insert(last_field_syntax.text_range().end(), new_field),
210 ); 208 );
211 return Some(Fix::new( 209 return Some(Fix::new("Create field", source_change, record_expr_field.syntax().text_range()));
212 "Create field",
213 source_change.into(),
214 record_expr_field.syntax().text_range(),
215 ));
216 210
217 fn record_field_list(field_def_list: ast::FieldList) -> Option<ast::RecordFieldList> { 211 fn record_field_list(field_def_list: ast::FieldList) -> Option<ast::RecordFieldList> {
218 match field_def_list { 212 match field_def_list {
diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs
index 110920e58..afd552008 100644
--- a/crates/ide/src/lib.rs
+++ b/crates/ide/src/lib.rs
@@ -98,7 +98,7 @@ pub use ide_db::{
98 label::Label, 98 label::Label,
99 line_index::{LineCol, LineIndex}, 99 line_index::{LineCol, LineIndex},
100 search::SearchScope, 100 search::SearchScope,
101 source_change::{FileSystemEdit, SourceChange, SourceFileEdits}, 101 source_change::{FileSystemEdit, SourceChange},
102 symbol_index::Query, 102 symbol_index::Query,
103 RootDatabase, 103 RootDatabase,
104}; 104};
diff --git a/crates/ide/src/references/rename.rs b/crates/ide/src/references/rename.rs
index cd9c7c7e5..039efb26f 100644
--- a/crates/ide/src/references/rename.rs
+++ b/crates/ide/src/references/rename.rs
@@ -21,7 +21,7 @@ use text_edit::TextEdit;
21 21
22use crate::{ 22use crate::{
23 FilePosition, FileSystemEdit, RangeInfo, ReferenceKind, ReferenceSearchResult, SourceChange, 23 FilePosition, FileSystemEdit, RangeInfo, ReferenceKind, ReferenceSearchResult, SourceChange,
24 SourceFileEdits, TextRange, TextSize, 24 TextRange, TextSize,
25}; 25};
26 26
27type RenameResult<T> = Result<T, RenameError>; 27type RenameResult<T> = Result<T, RenameError>;
@@ -249,8 +249,8 @@ fn rename_mod(
249 if IdentifierKind::Ident != check_identifier(new_name)? { 249 if IdentifierKind::Ident != check_identifier(new_name)? {
250 bail!("Invalid name `{0}`: cannot rename module to {0}", new_name); 250 bail!("Invalid name `{0}`: cannot rename module to {0}", new_name);
251 } 251 }
252 let mut source_file_edits = SourceFileEdits::default(); 252
253 let mut file_system_edits = Vec::new(); 253 let mut source_change = SourceChange::default();
254 254
255 let src = module.definition_source(sema.db); 255 let src = module.definition_source(sema.db);
256 let file_id = src.file_id.original_file(sema.db); 256 let file_id = src.file_id.original_file(sema.db);
@@ -264,7 +264,7 @@ fn rename_mod(
264 }; 264 };
265 let dst = AnchoredPathBuf { anchor: file_id, path }; 265 let dst = AnchoredPathBuf { anchor: file_id, path };
266 let move_file = FileSystemEdit::MoveFile { src: file_id, dst }; 266 let move_file = FileSystemEdit::MoveFile { src: file_id, dst };
267 file_system_edits.push(move_file); 267 source_change.push_file_system_edit(move_file);
268 } 268 }
269 ModuleSource::Module(..) => {} 269 ModuleSource::Module(..) => {}
270 } 270 }
@@ -272,17 +272,19 @@ fn rename_mod(
272 if let Some(src) = module.declaration_source(sema.db) { 272 if let Some(src) = module.declaration_source(sema.db) {
273 let file_id = src.file_id.original_file(sema.db); 273 let file_id = src.file_id.original_file(sema.db);
274 let name = src.value.name().unwrap(); 274 let name = src.value.name().unwrap();
275 source_file_edits 275 source_change.insert_source_edit(
276 .insert(file_id, TextEdit::replace(name.syntax().text_range(), new_name.into())); 276 file_id,
277 TextEdit::replace(name.syntax().text_range(), new_name.into()),
278 );
277 } 279 }
278 280
279 let RangeInfo { range, info: refs } = find_all_refs(sema, position)?; 281 let RangeInfo { range, info: refs } = find_all_refs(sema, position)?;
280 let ref_edits = refs.references().iter().map(|(&file_id, references)| { 282 let ref_edits = refs.references().iter().map(|(&file_id, references)| {
281 source_edit_from_references(sema, file_id, references, new_name) 283 source_edit_from_references(sema, file_id, references, new_name)
282 }); 284 });
283 source_file_edits.extend(ref_edits); 285 source_change.extend(ref_edits);
284 286
285 Ok(RangeInfo::new(range, SourceChange::from_edits(source_file_edits, file_system_edits))) 287 Ok(RangeInfo::new(range, source_change))
286} 288}
287 289
288fn rename_to_self( 290fn rename_to_self(
@@ -331,13 +333,16 @@ fn rename_to_self(
331 333
332 let RangeInfo { range, info: refs } = find_all_refs(sema, position)?; 334 let RangeInfo { range, info: refs } = find_all_refs(sema, position)?;
333 335
334 let mut edits = SourceFileEdits::default(); 336 let mut source_change = SourceChange::default();
335 edits.extend(refs.references().iter().map(|(&file_id, references)| { 337 source_change.extend(refs.references().iter().map(|(&file_id, references)| {
336 source_edit_from_references(sema, file_id, references, "self") 338 source_edit_from_references(sema, file_id, references, "self")
337 })); 339 }));
338 edits.insert(position.file_id, TextEdit::replace(param_range, String::from(self_param))); 340 source_change.insert_source_edit(
341 position.file_id,
342 TextEdit::replace(param_range, String::from(self_param)),
343 );
339 344
340 Ok(RangeInfo::new(range, edits.into())) 345 Ok(RangeInfo::new(range, source_change))
341} 346}
342 347
343fn text_edit_from_self_param( 348fn text_edit_from_self_param(
@@ -391,7 +396,7 @@ fn rename_self_to_param(
391 .ok_or_else(|| format_err!("No surrounding method declaration found"))?; 396 .ok_or_else(|| format_err!("No surrounding method declaration found"))?;
392 let search_range = fn_def.syntax().text_range(); 397 let search_range = fn_def.syntax().text_range();
393 398
394 let mut edits = SourceFileEdits::default(); 399 let mut source_change = SourceChange::default();
395 400
396 for (idx, _) in text.match_indices("self") { 401 for (idx, _) in text.match_indices("self") {
397 let offset: TextSize = idx.try_into().unwrap(); 402 let offset: TextSize = idx.try_into().unwrap();
@@ -405,18 +410,18 @@ fn rename_self_to_param(
405 } else { 410 } else {
406 TextEdit::replace(usage.text_range(), String::from(new_name)) 411 TextEdit::replace(usage.text_range(), String::from(new_name))
407 }; 412 };
408 edits.insert(position.file_id, edit); 413 source_change.insert_source_edit(position.file_id, edit);
409 } 414 }
410 } 415 }
411 416
412 if edits.len() > 1 && ident_kind == IdentifierKind::Underscore { 417 if source_change.source_file_edits.len() > 1 && ident_kind == IdentifierKind::Underscore {
413 bail!("Cannot rename reference to `_` as it is being referenced multiple times"); 418 bail!("Cannot rename reference to `_` as it is being referenced multiple times");
414 } 419 }
415 420
416 let range = ast::SelfParam::cast(self_token.parent()) 421 let range = ast::SelfParam::cast(self_token.parent())
417 .map_or(self_token.text_range(), |p| p.syntax().text_range()); 422 .map_or(self_token.text_range(), |p| p.syntax().text_range());
418 423
419 Ok(RangeInfo::new(range, edits.into())) 424 Ok(RangeInfo::new(range, source_change))
420} 425}
421 426
422fn rename_reference( 427fn rename_reference(
@@ -453,12 +458,12 @@ fn rename_reference(
453 (IdentifierKind::Ident, _) | (IdentifierKind::Underscore, _) => mark::hit!(rename_ident), 458 (IdentifierKind::Ident, _) | (IdentifierKind::Underscore, _) => mark::hit!(rename_ident),
454 } 459 }
455 460
456 let mut edits = SourceFileEdits::default(); 461 let mut source_change = SourceChange::default();
457 edits.extend(refs.into_iter().map(|(file_id, references)| { 462 source_change.extend(refs.into_iter().map(|(file_id, references)| {
458 source_edit_from_references(sema, file_id, &references, new_name) 463 source_edit_from_references(sema, file_id, &references, new_name)
459 })); 464 }));
460 465
461 Ok(RangeInfo::new(range, edits.into())) 466 Ok(RangeInfo::new(range, source_change))
462} 467}
463 468
464#[cfg(test)] 469#[cfg(test)]
@@ -480,7 +485,7 @@ mod tests {
480 Ok(source_change) => { 485 Ok(source_change) => {
481 let mut text_edit_builder = TextEdit::builder(); 486 let mut text_edit_builder = TextEdit::builder();
482 let mut file_id: Option<FileId> = None; 487 let mut file_id: Option<FileId> = None;
483 for edit in source_change.info.source_file_edits.edits { 488 for edit in source_change.info.source_file_edits {
484 file_id = Some(edit.0); 489 file_id = Some(edit.0);
485 for indel in edit.1.into_iter() { 490 for indel in edit.1.into_iter() {
486 text_edit_builder.replace(indel.delete, indel.insert); 491 text_edit_builder.replace(indel.delete, indel.insert);
@@ -882,18 +887,16 @@ mod foo$0;
882 RangeInfo { 887 RangeInfo {
883 range: 4..7, 888 range: 4..7,
884 info: SourceChange { 889 info: SourceChange {
885 source_file_edits: SourceFileEdits { 890 source_file_edits: {
886 edits: { 891 FileId(
887 FileId( 892 1,
888 1, 893 ): TextEdit {
889 ): TextEdit { 894 indels: [
890 indels: [ 895 Indel {
891 Indel { 896 insert: "foo2",
892 insert: "foo2", 897 delete: 4..7,
893 delete: 4..7, 898 },
894 }, 899 ],
895 ],
896 },
897 }, 900 },
898 }, 901 },
899 file_system_edits: [ 902 file_system_edits: [
@@ -936,28 +939,26 @@ use crate::foo$0::FooContent;
936 RangeInfo { 939 RangeInfo {
937 range: 11..14, 940 range: 11..14,
938 info: SourceChange { 941 info: SourceChange {
939 source_file_edits: SourceFileEdits { 942 source_file_edits: {
940 edits: { 943 FileId(
941 FileId( 944 0,
942 0, 945 ): TextEdit {
943 ): TextEdit { 946 indels: [
944 indels: [ 947 Indel {
945 Indel { 948 insert: "quux",
946 insert: "quux", 949 delete: 8..11,
947 delete: 8..11, 950 },
948 }, 951 ],
949 ], 952 },
950 }, 953 FileId(
951 FileId( 954 2,
952 2, 955 ): TextEdit {
953 ): TextEdit { 956 indels: [
954 indels: [ 957 Indel {
955 Indel { 958 insert: "quux",
956 insert: "quux", 959 delete: 11..14,
957 delete: 11..14, 960 },
958 }, 961 ],
959 ],
960 },
961 }, 962 },
962 }, 963 },
963 file_system_edits: [ 964 file_system_edits: [
@@ -994,18 +995,16 @@ mod fo$0o;
994 RangeInfo { 995 RangeInfo {
995 range: 4..7, 996 range: 4..7,
996 info: SourceChange { 997 info: SourceChange {
997 source_file_edits: SourceFileEdits { 998 source_file_edits: {
998 edits: { 999 FileId(
999 FileId( 1000 0,
1000 0, 1001 ): TextEdit {
1001 ): TextEdit { 1002 indels: [
1002 indels: [ 1003 Indel {
1003 Indel { 1004 insert: "foo2",
1004 insert: "foo2", 1005 delete: 4..7,
1005 delete: 4..7, 1006 },
1006 }, 1007 ],
1007 ],
1008 },
1009 }, 1008 },
1010 }, 1009 },
1011 file_system_edits: [ 1010 file_system_edits: [
@@ -1043,18 +1042,16 @@ mod outer { mod fo$0o; }
1043 RangeInfo { 1042 RangeInfo {
1044 range: 16..19, 1043 range: 16..19,
1045 info: SourceChange { 1044 info: SourceChange {
1046 source_file_edits: SourceFileEdits { 1045 source_file_edits: {
1047 edits: { 1046 FileId(
1048 FileId( 1047 0,
1049 0, 1048 ): TextEdit {
1050 ): TextEdit { 1049 indels: [
1051 indels: [ 1050 Indel {
1052 Indel { 1051 insert: "bar",
1053 insert: "bar", 1052 delete: 16..19,
1054 delete: 16..19, 1053 },
1055 }, 1054 ],
1056 ],
1057 },
1058 }, 1055 },
1059 }, 1056 },
1060 file_system_edits: [ 1057 file_system_edits: [
@@ -1115,28 +1112,26 @@ pub mod foo$0;
1115 RangeInfo { 1112 RangeInfo {
1116 range: 8..11, 1113 range: 8..11,
1117 info: SourceChange { 1114 info: SourceChange {
1118 source_file_edits: SourceFileEdits { 1115 source_file_edits: {
1119 edits: { 1116 FileId(
1120 FileId( 1117 0,
1121 0, 1118 ): TextEdit {
1122 ): TextEdit { 1119 indels: [
1123 indels: [ 1120 Indel {
1124 Indel { 1121 insert: "foo2",
1125 insert: "foo2", 1122 delete: 27..30,
1126 delete: 27..30, 1123 },
1127 }, 1124 ],
1128 ], 1125 },
1129 }, 1126 FileId(
1130 FileId( 1127 1,
1131 1, 1128 ): TextEdit {
1132 ): TextEdit { 1129 indels: [
1133 indels: [ 1130 Indel {
1134 Indel { 1131 insert: "foo2",
1135 insert: "foo2", 1132 delete: 8..11,
1136 delete: 8..11, 1133 },
1137 }, 1134 ],
1138 ],
1139 },
1140 }, 1135 },
1141 }, 1136 },
1142 file_system_edits: [ 1137 file_system_edits: [
diff --git a/crates/ide/src/typing.rs b/crates/ide/src/typing.rs
index b3fc32645..e3c3aebac 100644
--- a/crates/ide/src/typing.rs
+++ b/crates/ide/src/typing.rs
@@ -17,7 +17,6 @@ mod on_enter;
17 17
18use ide_db::{ 18use ide_db::{
19 base_db::{FilePosition, SourceDatabase}, 19 base_db::{FilePosition, SourceDatabase},
20 source_change::SourceFileEdits,
21 RootDatabase, 20 RootDatabase,
22}; 21};
23use syntax::{ 22use syntax::{
@@ -59,7 +58,7 @@ pub(crate) fn on_char_typed(
59 let file = &db.parse(position.file_id).tree(); 58 let file = &db.parse(position.file_id).tree();
60 assert_eq!(file.syntax().text().char_at(position.offset), Some(char_typed)); 59 assert_eq!(file.syntax().text().char_at(position.offset), Some(char_typed));
61 let edit = on_char_typed_inner(file, position.offset, char_typed)?; 60 let edit = on_char_typed_inner(file, position.offset, char_typed)?;
62 Some(SourceFileEdits::from_text_edit(position.file_id, edit).into()) 61 Some(SourceChange::from_text_edit(position.file_id, edit))
63} 62}
64 63
65fn on_char_typed_inner(file: &SourceFile, offset: TextSize, char_typed: char) -> Option<TextEdit> { 64fn on_char_typed_inner(file: &SourceFile, offset: TextSize, char_typed: char) -> Option<TextEdit> {