aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernardo <[email protected]>2018-12-21 17:51:31 +0000
committerBernardo <[email protected]>2018-12-25 19:03:14 +0000
commitd6312085a1ac97030fa768366585b9cfb6c955cd (patch)
treebdd36cd3efd76fc3a1561847ed66ccece7b75303
parenta005d2a614031a18c9a5bf6557789a41f1b25c31 (diff)
remove slower impl, add benchmarks
-rw-r--r--Cargo.lock178
-rw-r--r--crates/ra_editor/Cargo.toml8
-rw-r--r--crates/ra_editor/benches/translate_offset_with_edit_benchmark.rs88
-rw-r--r--crates/ra_editor/src/lib.rs4
-rw-r--r--crates/ra_editor/src/line_index_utils.rs218
-rw-r--r--crates/ra_text_edit/src/test_utils.rs9
6 files changed, 304 insertions, 201 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 127d7772a..1ee2df8dd 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -123,6 +123,11 @@ dependencies = [
123] 123]
124 124
125[[package]] 125[[package]]
126name = "cast"
127version = "0.2.2"
128source = "registry+https://github.com/rust-lang/crates.io-index"
129
130[[package]]
126name = "cc" 131name = "cc"
127version = "1.0.27" 132version = "1.0.27"
128source = "registry+https://github.com/rust-lang/crates.io-index" 133source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -165,6 +170,51 @@ dependencies = [
165] 170]
166 171
167[[package]] 172[[package]]
173name = "criterion"
174version = "0.2.5"
175source = "registry+https://github.com/rust-lang/crates.io-index"
176dependencies = [
177 "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
178 "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
179 "criterion-plot 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
180 "criterion-stats 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
181 "csv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
182 "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
183 "failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
184 "handlebars 0.32.4 (registry+https://github.com/rust-lang/crates.io-index)",
185 "itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
186 "itertools-num 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
187 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
188 "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
189 "serde_derive 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
190 "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
191 "simplelog 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
192 "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
193]
194
195[[package]]
196name = "criterion-plot"
197version = "0.2.5"
198source = "registry+https://github.com/rust-lang/crates.io-index"
199dependencies = [
200 "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
201 "cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
202 "itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
203]
204
205[[package]]
206name = "criterion-stats"
207version = "0.2.5"
208source = "registry+https://github.com/rust-lang/crates.io-index"
209dependencies = [
210 "cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
211 "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
212 "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
213 "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
214 "thread-scoped 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
215]
216
217[[package]]
168name = "crossbeam-channel" 218name = "crossbeam-channel"
169version = "0.2.6" 219version = "0.2.6"
170source = "registry+https://github.com/rust-lang/crates.io-index" 220source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -234,6 +284,23 @@ dependencies = [
234] 284]
235 285
236[[package]] 286[[package]]
287name = "csv"
288version = "1.0.5"
289source = "registry+https://github.com/rust-lang/crates.io-index"
290dependencies = [
291 "csv-core 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
292 "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
293]
294
295[[package]]
296name = "csv-core"
297version = "0.1.5"
298source = "registry+https://github.com/rust-lang/crates.io-index"
299dependencies = [
300 "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
301]
302
303[[package]]
237name = "derive-new" 304name = "derive-new"
238version = "0.5.6" 305version = "0.5.6"
239source = "registry+https://github.com/rust-lang/crates.io-index" 306source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -369,6 +436,21 @@ version = "0.2.11"
369source = "registry+https://github.com/rust-lang/crates.io-index" 436source = "registry+https://github.com/rust-lang/crates.io-index"
370 437
371[[package]] 438[[package]]
439name = "handlebars"
440version = "0.32.4"
441source = "registry+https://github.com/rust-lang/crates.io-index"
442dependencies = [
443 "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
444 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
445 "pest 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
446 "pest_derive 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
447 "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
448 "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
449 "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
450 "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
451]
452
453[[package]]
372name = "heck" 454name = "heck"
373version = "0.3.1" 455version = "0.3.1"
374source = "registry+https://github.com/rust-lang/crates.io-index" 456source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -419,6 +501,14 @@ dependencies = [
419] 501]
420 502
421[[package]] 503[[package]]
504name = "itertools-num"
505version = "0.1.3"
506source = "registry+https://github.com/rust-lang/crates.io-index"
507dependencies = [
508 "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
509]
510
511[[package]]
422name = "itoa" 512name = "itoa"
423version = "0.4.3" 513version = "0.4.3"
424source = "registry+https://github.com/rust-lang/crates.io-index" 514source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -598,6 +688,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
598 688
599[[package]] 689[[package]]
600name = "pest" 690name = "pest"
691version = "1.0.6"
692source = "registry+https://github.com/rust-lang/crates.io-index"
693
694[[package]]
695name = "pest"
601version = "2.0.2" 696version = "2.0.2"
602source = "registry+https://github.com/rust-lang/crates.io-index" 697source = "registry+https://github.com/rust-lang/crates.io-index"
603dependencies = [ 698dependencies = [
@@ -606,6 +701,16 @@ dependencies = [
606 701
607[[package]] 702[[package]]
608name = "pest_derive" 703name = "pest_derive"
704version = "1.0.8"
705source = "registry+https://github.com/rust-lang/crates.io-index"
706dependencies = [
707 "pest 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
708 "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
709 "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
710]
711
712[[package]]
713name = "pest_derive"
609version = "2.0.1" 714version = "2.0.1"
610source = "registry+https://github.com/rust-lang/crates.io-index" 715source = "registry+https://github.com/rust-lang/crates.io-index"
611dependencies = [ 716dependencies = [
@@ -667,6 +772,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
667 772
668[[package]] 773[[package]]
669name = "quote" 774name = "quote"
775version = "0.3.15"
776source = "registry+https://github.com/rust-lang/crates.io-index"
777
778[[package]]
779name = "quote"
670version = "0.6.10" 780version = "0.6.10"
671source = "registry+https://github.com/rust-lang/crates.io-index" 781source = "registry+https://github.com/rust-lang/crates.io-index"
672dependencies = [ 782dependencies = [
@@ -721,11 +831,15 @@ dependencies = [
721name = "ra_editor" 831name = "ra_editor"
722version = "0.1.0" 832version = "0.1.0"
723dependencies = [ 833dependencies = [
834 "criterion 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
724 "itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", 835 "itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
725 "join_to_string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 836 "join_to_string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
837 "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
726 "proptest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)", 838 "proptest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)",
727 "ra_syntax 0.1.0", 839 "ra_syntax 0.1.0",
728 "ra_text_edit 0.1.0", 840 "ra_text_edit 0.1.0",
841 "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
842 "rand_xorshift 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
729 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 843 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
730 "superslice 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 844 "superslice 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
731 "test_utils 0.1.0", 845 "test_utils 0.1.0",
@@ -1127,6 +1241,16 @@ dependencies = [
1127] 1241]
1128 1242
1129[[package]] 1243[[package]]
1244name = "simplelog"
1245version = "0.5.3"
1246source = "registry+https://github.com/rust-lang/crates.io-index"
1247dependencies = [
1248 "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
1249 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
1250 "term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
1251]
1252
1253[[package]]
1130name = "slug" 1254name = "slug"
1131version = "0.1.4" 1255version = "0.1.4"
1132source = "registry+https://github.com/rust-lang/crates.io-index" 1256source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1167,6 +1291,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1167 1291
1168[[package]] 1292[[package]]
1169name = "syn" 1293name = "syn"
1294version = "0.11.11"
1295source = "registry+https://github.com/rust-lang/crates.io-index"
1296dependencies = [
1297 "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
1298 "synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)",
1299 "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
1300]
1301
1302[[package]]
1303name = "syn"
1170version = "0.14.9" 1304version = "0.14.9"
1171source = "registry+https://github.com/rust-lang/crates.io-index" 1305source = "registry+https://github.com/rust-lang/crates.io-index"
1172dependencies = [ 1306dependencies = [
@@ -1186,6 +1320,14 @@ dependencies = [
1186] 1320]
1187 1321
1188[[package]] 1322[[package]]
1323name = "synom"
1324version = "0.11.3"
1325source = "registry+https://github.com/rust-lang/crates.io-index"
1326dependencies = [
1327 "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
1328]
1329
1330[[package]]
1189name = "synstructure" 1331name = "synstructure"
1190version = "0.10.1" 1332version = "0.10.1"
1191source = "registry+https://github.com/rust-lang/crates.io-index" 1333source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1250,6 +1392,15 @@ dependencies = [
1250] 1392]
1251 1393
1252[[package]] 1394[[package]]
1395name = "term"
1396version = "0.5.1"
1397source = "registry+https://github.com/rust-lang/crates.io-index"
1398dependencies = [
1399 "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
1400 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
1401]
1402
1403[[package]]
1253name = "termion" 1404name = "termion"
1254version = "1.5.1" 1405version = "1.5.1"
1255source = "registry+https://github.com/rust-lang/crates.io-index" 1406source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1286,6 +1437,11 @@ dependencies = [
1286] 1437]
1287 1438
1288[[package]] 1439[[package]]
1440name = "thread-scoped"
1441version = "1.0.2"
1442source = "registry+https://github.com/rust-lang/crates.io-index"
1443
1444[[package]]
1289name = "thread_local" 1445name = "thread_local"
1290version = "0.3.6" 1446version = "0.3.6"
1291source = "registry+https://github.com/rust-lang/crates.io-index" 1447source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1415,6 +1571,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1415 1571
1416[[package]] 1572[[package]]
1417name = "unicode-xid" 1573name = "unicode-xid"
1574version = "0.0.4"
1575source = "registry+https://github.com/rust-lang/crates.io-index"
1576
1577[[package]]
1578name = "unicode-xid"
1418version = "0.1.0" 1579version = "0.1.0"
1419source = "registry+https://github.com/rust-lang/crates.io-index" 1580source = "registry+https://github.com/rust-lang/crates.io-index"
1420 1581
@@ -1527,11 +1688,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1527"checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" 1688"checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40"
1528"checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" 1689"checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d"
1529"checksum cargo_metadata 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e5d1b4d380e1bab994591a24c2bdd1b054f64b60bef483a8c598c7c345bc3bbe" 1690"checksum cargo_metadata 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e5d1b4d380e1bab994591a24c2bdd1b054f64b60bef483a8c598c7c345bc3bbe"
1691"checksum cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "926013f2860c46252efceabb19f4a6b308197505082c609025aa6706c011d427"
1530"checksum cc 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)" = "155ed195f7bd722d1dfeb30365b9d0c1f6a078fa7ca4014497e5935d90993d6f" 1692"checksum cc 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)" = "155ed195f7bd722d1dfeb30365b9d0c1f6a078fa7ca4014497e5935d90993d6f"
1531"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" 1693"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4"
1532"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" 1694"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878"
1533"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" 1695"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
1534"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" 1696"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
1697"checksum criterion 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c47d2b548c5647e1a436dc0cb78d4ebf51b6bf7ab101ed76662828bdd4d3a24a"
1698"checksum criterion-plot 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6e649d6aacdbbdb94ec659561a309a71336fc5655ed408f3afd28df2fc0c4f4f"
1699"checksum criterion-stats 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ff43cac80562f91ead0b617c1be74edf350adfaa195809d355de98dfc8f9237d"
1535"checksum crossbeam-channel 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7b85741761b7f160bc5e7e0c14986ef685b7f8bf9b7ad081c60c604bb4649827" 1700"checksum crossbeam-channel 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7b85741761b7f160bc5e7e0c14986ef685b7f8bf9b7ad081c60c604bb4649827"
1536"checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3" 1701"checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3"
1537"checksum crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150" 1702"checksum crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150"
@@ -1539,6 +1704,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1539"checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9" 1704"checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9"
1540"checksum crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "677d453a17e8bd2b913fa38e8b9cf04bcdbb5be790aa294f2389661d72036015" 1705"checksum crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "677d453a17e8bd2b913fa38e8b9cf04bcdbb5be790aa294f2389661d72036015"
1541"checksum crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "41ee4864f4797060e52044376f7d107429ce1fb43460021b126424b7180ee21a" 1706"checksum crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "41ee4864f4797060e52044376f7d107429ce1fb43460021b126424b7180ee21a"
1707"checksum csv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "9fd1c44c58078cfbeaf11fbb3eac9ae5534c23004ed770cc4bfb48e658ae4f04"
1708"checksum csv-core 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fa5cdef62f37e6ffe7d1f07a381bc0db32b7a3ff1cac0de56cb0d81e71f53d65"
1542"checksum derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6ca414e896ae072546f4d789f452daaecf60ddee4c9df5dc6d5936d769e3d87c" 1709"checksum derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6ca414e896ae072546f4d789f452daaecf60ddee4c9df5dc6d5936d769e3d87c"
1543"checksum deunicode 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "850878694b7933ca4c9569d30a34b55031b9b139ee1fc7b94a527c4ef960d690" 1710"checksum deunicode 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "850878694b7933ca4c9569d30a34b55031b9b139ee1fc7b94a527c4ef960d690"
1544"checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" 1711"checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
@@ -1556,6 +1723,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1556"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" 1723"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
1557"checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d" 1724"checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d"
1558"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" 1725"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
1726"checksum handlebars 0.32.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d89ec99d1594f285d4590fc32bac5f75cdab383f1123d504d27862c644a807dd"
1559"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" 1727"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
1560"checksum humansize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b6cab2627acfc432780848602f3f558f7e9dd427352224b0d9324025796d2a5e" 1728"checksum humansize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b6cab2627acfc432780848602f3f558f7e9dd427352224b0d9324025796d2a5e"
1561"checksum id-arena 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3a7250033feafee46a1cecd2c2616a64aec1d064f38c9ae2bdd297728542843e" 1729"checksum id-arena 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3a7250033feafee46a1cecd2c2616a64aec1d064f38c9ae2bdd297728542843e"
@@ -1563,6 +1731,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1563"checksum im 12.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ae9c7f9bb8aee47fc16d535a705f7867a9fc83bb822e5e1043bb98e77ffeed3c" 1731"checksum im 12.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ae9c7f9bb8aee47fc16d535a705f7867a9fc83bb822e5e1043bb98e77ffeed3c"
1564"checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d" 1732"checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d"
1565"checksum itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0d47946d458e94a1b7bcabbf6521ea7c037062c81f534615abcad76e84d4970d" 1733"checksum itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0d47946d458e94a1b7bcabbf6521ea7c037062c81f534615abcad76e84d4970d"
1734"checksum itertools-num 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a872a22f9e6f7521ca557660adb96dd830e54f0f490fa115bb55dd69d38b27e7"
1566"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" 1735"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b"
1567"checksum join_to_string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7bddc885f3fd69dd4b5d747c2efe6dd2c36d795ea9938281ed50910e32c95e31" 1736"checksum join_to_string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7bddc885f3fd69dd4b5d747c2efe6dd2c36d795ea9938281ed50910e32c95e31"
1568"checksum languageserver-types 0.53.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0be4f8f783832a308975035043c0e8ad18e11c3f3d395aa6f1a9f3a30b8e654" 1737"checksum languageserver-types 0.53.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0be4f8f783832a308975035043c0e8ad18e11c3f3d395aa6f1a9f3a30b8e654"
@@ -1586,13 +1755,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1586"checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c" 1755"checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c"
1587"checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" 1756"checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9"
1588"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" 1757"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
1758"checksum pest 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0fce5d8b5cc33983fc74f78ad552b5522ab41442c4ca91606e4236eb4b5ceefc"
1589"checksum pest 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a677051ad923732bb5c70f2d45f8985a96e3eee2e2bff86697e3b11b0c3fcfde" 1759"checksum pest 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a677051ad923732bb5c70f2d45f8985a96e3eee2e2bff86697e3b11b0c3fcfde"
1760"checksum pest_derive 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3294f437119209b084c797604295f40227cffa35c57220b1e99a6ff3bf8ee4"
1590"checksum pest_derive 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b76f477146419bc539a63f4ef40e902166cb43b3e51cecc71d9136fd12c567e7" 1761"checksum pest_derive 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b76f477146419bc539a63f4ef40e902166cb43b3e51cecc71d9136fd12c567e7"
1591"checksum pest_generator 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ebee4e9680be4fd162e6f3394ae4192a6b60b1e4d17d845e631f0c68d1a3386" 1762"checksum pest_generator 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ebee4e9680be4fd162e6f3394ae4192a6b60b1e4d17d845e631f0c68d1a3386"
1592"checksum pest_meta 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1f6d5f6f0e6082578c86af197d780dc38328e3f768cec06aac9bc46d714e8221" 1763"checksum pest_meta 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1f6d5f6f0e6082578c86af197d780dc38328e3f768cec06aac9bc46d714e8221"
1593"checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" 1764"checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09"
1594"checksum proptest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)" = "926d0604475349f463fe44130aae73f2294b5309ab2ca0310b998bd334ef191f" 1765"checksum proptest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)" = "926d0604475349f463fe44130aae73f2294b5309ab2ca0310b998bd334ef191f"
1595"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" 1766"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
1767"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
1596"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" 1768"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c"
1597"checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd" 1769"checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd"
1598"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" 1770"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c"
@@ -1629,22 +1801,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1629"checksum serde_derive 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)" = "96a7f9496ac65a2db5929afa087b54f8fc5008dcfbe48a8874ed20049b0d6154" 1801"checksum serde_derive 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)" = "96a7f9496ac65a2db5929afa087b54f8fc5008dcfbe48a8874ed20049b0d6154"
1630"checksum serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)" = "c37ccd6be3ed1fdf419ee848f7c758eb31b054d7cd3ae3600e3bae0adf569811" 1802"checksum serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)" = "c37ccd6be3ed1fdf419ee848f7c758eb31b054d7cd3ae3600e3bae0adf569811"
1631"checksum sha-1 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9d1f3b5de8a167ab06834a7c883bd197f2191e1dda1a22d9ccfeedbf9aded" 1803"checksum sha-1 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9d1f3b5de8a167ab06834a7c883bd197f2191e1dda1a22d9ccfeedbf9aded"
1804"checksum simplelog 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e95345f185d5adeb8ec93459d2dc99654e294cc6ccf5b75414d8ea262de9a13"
1632"checksum slug 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b3bc762e6a4b6c6fcaade73e77f9ebc6991b676f88bb2358bddb56560f073373" 1805"checksum slug 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b3bc762e6a4b6c6fcaade73e77f9ebc6991b676f88bb2358bddb56560f073373"
1633"checksum smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ea3738b47563803ef814925e69be00799a8c07420be8b996f8e98fb2336db" 1806"checksum smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ea3738b47563803ef814925e69be00799a8c07420be8b996f8e98fb2336db"
1634"checksum smol_str 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "486a74e9b9fc53373808f7a17e10fc728adcb1fbe272292271d8bea61175e181" 1807"checksum smol_str 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "486a74e9b9fc53373808f7a17e10fc728adcb1fbe272292271d8bea61175e181"
1635"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" 1808"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
1636"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" 1809"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
1637"checksum superslice 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b50b13d42370e0f5fc62eafdd5c2d20065eaf5458dab215ff3e20e63eea96b30" 1810"checksum superslice 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b50b13d42370e0f5fc62eafdd5c2d20065eaf5458dab215ff3e20e63eea96b30"
1811"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
1638"checksum syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)" = "261ae9ecaa397c42b960649561949d69311f08eeaea86a65696e6e46517cf741" 1812"checksum syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)" = "261ae9ecaa397c42b960649561949d69311f08eeaea86a65696e6e46517cf741"
1639"checksum syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9545a6a093a3f0bd59adb472700acc08cad3776f860f16a897dfce8c88721cbc" 1813"checksum syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9545a6a093a3f0bd59adb472700acc08cad3776f860f16a897dfce8c88721cbc"
1814"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
1640"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" 1815"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015"
1641"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" 1816"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
1642"checksum tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7e91405c14320e5c79b3d148e1c86f40749a36e490642202a31689cb1a3452b2" 1817"checksum tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7e91405c14320e5c79b3d148e1c86f40749a36e490642202a31689cb1a3452b2"
1643"checksum tera 0.11.20 (registry+https://github.com/rust-lang/crates.io-index)" = "4b505279e19d8f7d24b1a9dc58327c9c36174b1a2c7ebdeac70792d017cb64f3" 1818"checksum tera 0.11.20 (registry+https://github.com/rust-lang/crates.io-index)" = "4b505279e19d8f7d24b1a9dc58327c9c36174b1a2c7ebdeac70792d017cb64f3"
1644"checksum teraron 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0d89ad4617d1dec55331067fadaa041e813479e1779616f3d3ce9308bf46184e" 1819"checksum teraron 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0d89ad4617d1dec55331067fadaa041e813479e1779616f3d3ce9308bf46184e"
1820"checksum term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5e6b677dd1e8214ea1ef4297f85dbcbed8e8cdddb561040cc998ca2551c37561"
1645"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" 1821"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
1646"checksum text_unit 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8009d7bdbd896a7e09b595f8f9325a19047fc708653e60d0895202b82135048f" 1822"checksum text_unit 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8009d7bdbd896a7e09b595f8f9325a19047fc708653e60d0895202b82135048f"
1647"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" 1823"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6"
1824"checksum thread-scoped 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bcbb6aa301e5d3b0b5ef639c9a9c7e2f1c944f177b460c04dc24c69b1fa2bd99"
1648"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" 1825"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
1649"checksum threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e2f0c90a5f3459330ac8bc0d2f879c693bb7a2f59689c1083fc4ef83834da865" 1826"checksum threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e2f0c90a5f3459330ac8bc0d2f879c693bb7a2f59689c1083fc4ef83834da865"
1650"checksum time 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "847da467bf0db05882a9e2375934a8a55cffdc9db0d128af1518200260ba1f6c" 1827"checksum time 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "847da467bf0db05882a9e2375934a8a55cffdc9db0d128af1518200260ba1f6c"
@@ -1661,6 +1838,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1661"checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25" 1838"checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25"
1662"checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1" 1839"checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1"
1663"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" 1840"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526"
1841"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
1664"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" 1842"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
1665"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" 1843"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
1666"checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" 1844"checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a"
diff --git a/crates/ra_editor/Cargo.toml b/crates/ra_editor/Cargo.toml
index 1ad99af28..039688d7d 100644
--- a/crates/ra_editor/Cargo.toml
+++ b/crates/ra_editor/Cargo.toml
@@ -18,3 +18,11 @@ proptest = "0.8.7"
18 18
19[dev-dependencies] 19[dev-dependencies]
20test_utils = { path = "../test_utils" } 20test_utils = { path = "../test_utils" }
21criterion = "0.2"
22rand = "*"
23rand_xorshift = "*"
24lazy_static = "*"
25
26[[bench]]
27name = "translate_offset_with_edit_benchmark"
28harness = false \ No newline at end of file
diff --git a/crates/ra_editor/benches/translate_offset_with_edit_benchmark.rs b/crates/ra_editor/benches/translate_offset_with_edit_benchmark.rs
new file mode 100644
index 000000000..b345a91ae
--- /dev/null
+++ b/crates/ra_editor/benches/translate_offset_with_edit_benchmark.rs
@@ -0,0 +1,88 @@
1use criterion::{criterion_group, criterion_main};
2use criterion::Criterion;
3use criterion::Fun;
4use ra_text_edit::AtomTextEdit;
5use ra_text_edit::test_utils::{arb_edits_custom, arb_offset};
6use ra_editor::line_index_utils;
7use ra_editor::LineIndex;
8use ra_syntax::TextUnit;
9use proptest::test_runner;
10use proptest::string::string_regex;
11use proptest::strategy::{Strategy, ValueTree};
12use rand_xorshift::XorShiftRng;
13use rand::SeedableRng;
14use lazy_static::lazy_static;
15
16#[derive(Debug)]
17struct Data {
18 text: String,
19 line_index: LineIndex,
20 edits: Vec<AtomTextEdit>,
21 offset: TextUnit,
22}
23
24fn setup_data() -> Data {
25 let mut runner = test_runner::TestRunner::default();
26 {
27 struct TestRng {
28 rng: XorShiftRng,
29 }
30 // HACK to be able to manually seed the TestRunner
31 let rng: &mut TestRng = unsafe { std::mem::transmute(runner.rng()) };
32 rng.rng = XorShiftRng::seed_from_u64(0);
33 }
34
35 let text = {
36 let arb = string_regex("([a-zA-Z_0-9]{10,50}.{1,5}\n){100,500}").unwrap();
37 let tree = arb.new_tree(&mut runner).unwrap();
38 tree.current()
39 };
40
41 let edits = {
42 let arb = arb_edits_custom(&text, 99, 100);
43 let tree = arb.new_tree(&mut runner).unwrap();
44 tree.current()
45 };
46
47 let offset = {
48 let arb = arb_offset(&text);
49 let tree = arb.new_tree(&mut runner).unwrap();
50 tree.current()
51 };
52
53 let line_index = LineIndex::new(&text);
54
55 Data {
56 text,
57 line_index,
58 edits,
59 offset,
60 }
61}
62
63lazy_static! {
64 static ref DATA: Data = setup_data();
65}
66
67fn compare_translates(c: &mut Criterion) {
68 let f1 = Fun::new("translate_after_edit", |b, _| {
69 b.iter(|| {
70 let d = &*DATA;
71 line_index_utils::translate_after_edit(&d.text, d.offset, d.edits.clone());
72 })
73 });
74
75 let f2 = Fun::new("count_newlines", |b, _| {
76 b.iter(|| {
77 let d = &*DATA;
78 line_index_utils::count_newlines(d.offset, &d.line_index, &d.edits);
79 })
80 });
81
82 let functions = vec![f1, f2];
83
84 c.bench_functions("translate", functions, ());
85}
86
87criterion_group!(benches, compare_translates);
88criterion_main!(benches);
diff --git a/crates/ra_editor/src/lib.rs b/crates/ra_editor/src/lib.rs
index 619497f0b..7145c6cfb 100644
--- a/crates/ra_editor/src/lib.rs
+++ b/crates/ra_editor/src/lib.rs
@@ -2,7 +2,8 @@ mod code_actions;
2mod extend_selection; 2mod extend_selection;
3mod folding_ranges; 3mod folding_ranges;
4mod line_index; 4mod line_index;
5mod line_index_utils; 5// public for benchmarkig
6pub mod line_index_utils;
6mod symbols; 7mod symbols;
7#[cfg(test)] 8#[cfg(test)]
8mod test_utils; 9mod test_utils;
@@ -13,7 +14,6 @@ pub use self::{
13 extend_selection::extend_selection, 14 extend_selection::extend_selection,
14 folding_ranges::{folding_ranges, Fold, FoldKind}, 15 folding_ranges::{folding_ranges, Fold, FoldKind},
15 line_index::{LineCol, LineIndex}, 16 line_index::{LineCol, LineIndex},
16 line_index_utils::translate_offset_with_edit,
17 symbols::{file_structure, file_symbols, FileSymbol, StructureNode}, 17 symbols::{file_structure, file_symbols, FileSymbol, StructureNode},
18 typing::{join_lines, on_enter, on_eq_typed}, 18 typing::{join_lines, on_enter, on_eq_typed},
19}; 19};
diff --git a/crates/ra_editor/src/line_index_utils.rs b/crates/ra_editor/src/line_index_utils.rs
index 5ce2446c1..e62c5089d 100644
--- a/crates/ra_editor/src/line_index_utils.rs
+++ b/crates/ra_editor/src/line_index_utils.rs
@@ -25,136 +25,6 @@ impl<'a> Iterator for OffsetNewlineIter<'a> {
25} 25}
26 26
27#[derive(Debug)] 27#[derive(Debug)]
28struct AltEdit<'a> {
29 insert_newlines: OffsetNewlineIter<'a>,
30 delete: TextRange,
31 diff: i64,
32}
33
34fn translate_range_by(range: TextRange, diff: i64) -> TextRange {
35 if diff == 0 {
36 range
37 } else {
38 let start = translate_by(range.start(), diff);
39 let end = translate_by(range.end(), diff);
40 TextRange::from_to(start, end)
41 }
42}
43
44fn translate_by(x: TextUnit, diff: i64) -> TextUnit {
45 if diff == 0 {
46 x
47 } else {
48 TextUnit::from((x.to_usize() as i64 + diff) as u32)
49 }
50}
51
52fn to_alt_edits<'a>(offset: TextUnit, edits: &'a [AtomTextEdit]) -> Vec<AltEdit<'a>> {
53 let mut xs: Vec<AltEdit<'a>> = Vec::with_capacity(edits.len());
54 // collect and sort edits
55 for edit in edits {
56 // TODO discard after translating?
57 // if edit.delete.start() >= offset {
58 // continue;
59 // }
60 let insert_index = xs.upper_bound_by_key(&edit.delete.start(), |x| x.delete.start());
61 let diff = edit.insert.len() as i64 - edit.delete.len().to_usize() as i64;
62 xs.insert(
63 insert_index,
64 AltEdit {
65 insert_newlines: OffsetNewlineIter {
66 offset: edit.delete.start(),
67 text: &edit.insert,
68 },
69 delete: edit.delete,
70 diff: diff,
71 },
72 );
73 }
74 // translate edits by previous edits
75 for i in 1..xs.len() {
76 let (x, prevs) = xs[0..=i].split_last_mut().unwrap();
77 for prev in prevs {
78 x.delete = translate_range_by(x.delete, prev.diff);
79 x.insert_newlines.offset = translate_by(x.insert_newlines.offset, prev.diff);
80 }
81 }
82 xs
83}
84
85#[derive(Debug)]
86enum NextNewline {
87 Use,
88 Discard,
89 Replace(TextUnit),
90 New(TextUnit),
91}
92
93fn next_newline(candidate: Option<TextUnit>, edits: &mut [AltEdit]) -> NextNewline {
94 let mut candidate = match candidate {
95 None => {
96 for edit in edits {
97 if let Some(inserted) = edit.insert_newlines.next() {
98 return NextNewline::New(inserted);
99 }
100 }
101 return NextNewline::Use; // END
102 }
103 Some(x) => x,
104 };
105
106 for edit in edits {
107 if candidate <= edit.delete.start() {
108 return NextNewline::Replace(candidate);
109 } else if candidate <= edit.delete.end() {
110 return match edit.insert_newlines.next() {
111 Some(x) => NextNewline::Replace(x),
112 None => NextNewline::Discard,
113 };
114 } else {
115 if let Some(inserted) = edit.insert_newlines.next() {
116 return NextNewline::New(inserted);
117 }
118 candidate = translate_by(candidate, edit.diff);
119 }
120 }
121 return NextNewline::Replace(candidate);
122}
123
124pub fn count_newlines(offset: TextUnit, line_index: &LineIndex, edits: &[AtomTextEdit]) -> u32 {
125 let mut edits = to_alt_edits(offset, edits);
126 let mut orig_newlines = line_index.newlines().iter().map(|x| *x).peekable();
127
128 let mut count = 0;
129
130 loop {
131 let res = next_newline(orig_newlines.peek().map(|x| *x), &mut edits);
132 let next = match res {
133 NextNewline::Use => orig_newlines.next(),
134 NextNewline::Discard => {
135 orig_newlines.next();
136 continue;
137 }
138 NextNewline::Replace(new) => {
139 orig_newlines.next();
140 Some(new)
141 }
142 NextNewline::New(new) => Some(new),
143 };
144 match next {
145 Some(n) if n <= offset => {
146 count += 1;
147 }
148 _ => {
149 break;
150 }
151 }
152 }
153
154 count
155}
156
157#[derive(Debug)]
158enum NextNewlines<'a> { 28enum NextNewlines<'a> {
159 Use, 29 Use,
160 ReplaceMany(OffsetNewlineIter<'a>), 30 ReplaceMany(OffsetNewlineIter<'a>),
@@ -188,7 +58,7 @@ impl<'a, 'b> Edits<'a, 'b> {
188 self.acc_diff += self.current.as_ref().map_or(0, |x| x.diff); 58 self.acc_diff += self.current.as_ref().map_or(0, |x| x.diff);
189 match self.edits.split_first() { 59 match self.edits.split_first() {
190 Some((next, rest)) => { 60 Some((next, rest)) => {
191 let delete = translate_range_by(next.delete, self.acc_diff); 61 let delete = self.translate_range(next.delete);
192 let diff = next.insert.len() as i64 - next.delete.len().to_usize() as i64; 62 let diff = next.insert.len() as i64 - next.delete.len().to_usize() as i64;
193 self.current = Some(TranslatedEdit { 63 self.current = Some(TranslatedEdit {
194 delete, 64 delete,
@@ -241,9 +111,27 @@ impl<'a, 'b> Edits<'a, 'b> {
241 }; 111 };
242 res 112 res
243 } 113 }
114
115 fn translate_range(&self, range: TextRange) -> TextRange {
116 if self.acc_diff == 0 {
117 range
118 } else {
119 let start = self.translate(range.start());
120 let end = self.translate(range.end());
121 TextRange::from_to(start, end)
122 }
123 }
124
125 fn translate(&self, x: TextUnit) -> TextUnit {
126 if self.acc_diff == 0 {
127 x
128 } else {
129 TextUnit::from((x.to_usize() as i64 + self.acc_diff) as u32)
130 }
131 }
244} 132}
245 133
246pub fn count_newlines_alt(offset: TextUnit, line_index: &LineIndex, edits: &[AtomTextEdit]) -> u32 { 134pub fn count_newlines(offset: TextUnit, line_index: &LineIndex, edits: &[AtomTextEdit]) -> u32 {
247 let mut sorted_edits: Vec<&AtomTextEdit> = Vec::with_capacity(edits.len()); 135 let mut sorted_edits: Vec<&AtomTextEdit> = Vec::with_capacity(edits.len());
248 for edit in edits { 136 for edit in edits {
249 let insert_index = 137 let insert_index =
@@ -257,7 +145,7 @@ pub fn count_newlines_alt(offset: TextUnit, line_index: &LineIndex, edits: &[Ato
257 145
258 for &orig_newline in line_index.newlines() { 146 for &orig_newline in line_index.newlines() {
259 loop { 147 loop {
260 let translated_newline = translate_by(orig_newline, state.acc_diff); 148 let translated_newline = state.translate(orig_newline);
261 match state.next_newlines(translated_newline) { 149 match state.next_newlines(translated_newline) {
262 NextNewlines::Use => { 150 NextNewlines::Use => {
263 if offset < translated_newline { 151 if offset < translated_newline {
@@ -369,69 +257,5 @@ mod test {
369 let actual_lines = count_newlines(x.offset, &line_index, &x.edits); 257 let actual_lines = count_newlines(x.offset, &line_index, &x.edits);
370 assert_eq!(actual_lines, expected.line); 258 assert_eq!(actual_lines, expected.line);
371 } 259 }
372
373 #[test]
374 fn test_translate_offset_with_edit_alt(x in arb_text_with_offset_and_edits()) {
375 let line_index = LineIndex::new(&x.text);
376 let expected = translate_after_edit(&x.text, x.offset, x.edits.clone());
377 let actual_lines = count_newlines_alt(x.offset, &line_index, &x.edits);
378 assert_eq!(actual_lines, expected.line);
379 }
380 }
381
382 #[test]
383 fn test_translate_offset_with_edit_alt_1() {
384 let x = ArbTextWithOffsetAndEdits {
385 text: String::from("aA\n"),
386 offset: 2.into(),
387 edits: vec![AtomTextEdit::delete(TextRange::from_to(1.into(), 2.into()))],
388 };
389 let line_index = LineIndex::new(&x.text);
390 let expected = translate_after_edit(&x.text, x.offset, x.edits.clone());
391 let actual_lines = count_newlines_alt(x.offset, &line_index, &x.edits);
392 assert_eq!(actual_lines, expected.line);
393 }
394
395 #[test]
396 fn test_translate_offset_with_edit_alt_2() {
397 let x = ArbTextWithOffsetAndEdits {
398 text: String::from("\nqꀸ#"),
399 offset: 5.into(),
400 edits: vec![AtomTextEdit::insert(1.into(), "\n".into())],
401 };
402 let line_index = LineIndex::new(&x.text);
403 let expected = translate_after_edit(&x.text, x.offset, x.edits.clone());
404 let actual_lines = count_newlines_alt(x.offset, &line_index, &x.edits);
405 assert_eq!(actual_lines, expected.line);
406 }
407
408 #[test]
409 fn test_translate_offset_with_edit_alt_3() {
410 let x = ArbTextWithOffsetAndEdits {
411 text: String::from("\n\n\n"),
412 offset: 0.into(),
413 edits: vec![AtomTextEdit::delete(TextRange::from_to(0.into(), 2.into()))],
414 };
415 let line_index = LineIndex::new(&x.text);
416 let expected = translate_after_edit(&x.text, x.offset, x.edits.clone());
417 let actual_lines = count_newlines_alt(x.offset, &line_index, &x.edits);
418 assert_eq!(actual_lines, expected.line);
419 } 260 }
420
421 #[test]
422 fn test_translate_offset_with_edit_alt_4() {
423 let x = ArbTextWithOffsetAndEdits {
424 text: String::from("☻54翑\"A"),
425 offset: 5.into(),
426 edits: vec![
427 AtomTextEdit::delete(TextRange::from_to(0.into(), 8.into())),
428 AtomTextEdit::insert(9.into(), String::from("\n")),
429 ],
430 };
431 let line_index = LineIndex::new(&x.text);
432 let expected = translate_after_edit(&x.text, x.offset, x.edits.clone());
433 let actual_lines = count_newlines_alt(x.offset, &line_index, &x.edits);
434 assert_eq!(actual_lines, expected.line);
435 }
436
437} 261}
diff --git a/crates/ra_text_edit/src/test_utils.rs b/crates/ra_text_edit/src/test_utils.rs
index 4a0ebc08e..f150288f6 100644
--- a/crates/ra_text_edit/src/test_utils.rs
+++ b/crates/ra_text_edit/src/test_utils.rs
@@ -24,6 +24,10 @@ pub fn arb_offset(text: &str) -> BoxedStrategy<TextUnit> {
24} 24}
25 25
26pub fn arb_edits(text: &str) -> BoxedStrategy<Vec<AtomTextEdit>> { 26pub fn arb_edits(text: &str) -> BoxedStrategy<Vec<AtomTextEdit>> {
27 arb_edits_custom(&text, 0, 7)
28}
29
30pub fn arb_edits_custom(text: &str, min: usize, max: usize) -> BoxedStrategy<Vec<AtomTextEdit>> {
27 if text.is_empty() { 31 if text.is_empty() {
28 // only valid edits 32 // only valid edits
29 return Just(vec![]) 33 return Just(vec![])
@@ -37,9 +41,10 @@ pub fn arb_edits(text: &str) -> BoxedStrategy<Vec<AtomTextEdit>> {
37 } 41 }
38 42
39 let offsets = text_offsets(text); 43 let offsets = text_offsets(text);
40 let max_cuts = offsets.len().min(7); 44 let max_cuts = max.min(offsets.len());
45 let min_cuts = min.min(offsets.len() - 1);
41 46
42 proptest::sample::subsequence(offsets, 0..max_cuts) 47 proptest::sample::subsequence(offsets, min_cuts..max_cuts)
43 .prop_flat_map(|cuts| { 48 .prop_flat_map(|cuts| {
44 let strategies: Vec<_> = cuts 49 let strategies: Vec<_> = cuts
45 .chunks(2) 50 .chunks(2)