on master help sign in
argh -> clap to speed up compilation (no syn/proc_macro)
commite39bd211d1579bfafa1774f6915af5725041781e authorBlaž Hrastnik <blaz@mxxn.io> dateThu 1 Oct 2020, 12:23 (6 years ago) parent1da0be0
9 files changed+114−184
Cargo.lock+91−163 helix-core/src/state.rs−2 helix-syntax/Cargo.toml−1 helix-syntax/src/lib.rs+1−2 helix-term/Cargo.toml+4−3 helix-term/src/editor.rs+2−2 helix-term/src/main.rs+12−9 helix-view/Cargo.toml+3−2 helix-view/src/commands.rs+1
Cargo.lock+91−163
@@ -21,35 +21,6 @@ version = "0.4.7"
2121source = "registry+https://github.com/rust-lang/crates.io-index"
2222checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034"
2323
24−[[package]]
25−name = "argh"
26−version = "0.1.3"
27−source = "registry+https://github.com/rust-lang/crates.io-index"
28−checksum = "ca1877e24cecacd700d469066e0160c4f8497cc5635367163f50c8beec820154"
29−dependencies = [
30− "argh_derive",
31− "argh_shared",
32−]
33−
34−[[package]]
35−name = "argh_derive"
36−version = "0.1.1"
37−source = "registry+https://github.com/rust-lang/crates.io-index"
38−checksum = "e742194e0f43fc932bcb801708c2b279d3ec8f527e3acda05a6a9f342c5ef764"
39−dependencies = [
40− "argh_shared",
41− "heck",
42− "proc-macro2",
43− "quote",
44− "syn",
45−]
46−
47−[[package]]
48−name = "argh_shared"
49−version = "0.1.1"
50−source = "registry+https://github.com/rust-lang/crates.io-index"
51−checksum = "e1ba68f4276a778591e36a0c348a269888f3a177c8d2054969389e3b59611ff5"
52−
5324[[package]]
5425name = "async-barrier"
5526version = "1.1.0"
@@ -97,9 +68,9 @@ dependencies = [
9768
9869[[package]]
9970name = "async-io"
100−version = "1.1.3"
71+version = "1.1.5"
10172source = "registry+https://github.com/rust-lang/crates.io-index"
102−checksum = "a9951f92a2b4f7793f8fc06a80bdb89b62c618c993497d4606474fb8c34941b5"
73+checksum = "6e727cebd055ab2861a854f79def078c4b99ea722d54c6800a0e274389882d4c"
10374dependencies = [
10475 "concurrent-queue",
10576 "fastrand",
@@ -136,9 +107,9 @@ dependencies = [
136107
137108[[package]]
138109name = "async-net"
139−version = "1.4.3"
110+version = "1.4.6"
140111source = "registry+https://github.com/rust-lang/crates.io-index"
141−checksum = "fb04482b77baa38d59d56aee0a7b4266600ab28e2b8be7af03508f6a30ecbdcf"
112+checksum = "14a5335056541826f855bf95b936df9788adbacf94b15ef7104029f7fff3e82a"
142113dependencies = [
143114 "async-io",
144115 "blocking",
@@ -193,6 +164,12 @@ version = "1.0.0"
193164source = "registry+https://github.com/rust-lang/crates.io-index"
194165checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a"
195166
167+[[package]]
168+name = "autocfg"
169+version = "1.0.1"
170+source = "registry+https://github.com/rust-lang/crates.io-index"
171+checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
172+
196173[[package]]
197174name = "bitflags"
198175version = "1.2.1"
@@ -240,11 +217,25 @@ version = "0.1.10"
240217source = "registry+https://github.com/rust-lang/crates.io-index"
241218checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
242219
220+[[package]]
221+name = "clap"
222+version = "3.0.0-beta.2"
223+source = "registry+https://github.com/rust-lang/crates.io-index"
224+checksum = "4bd1061998a501ee7d4b6d449020df3266ca3124b941ec56cf2005c3779ca142"
225+dependencies = [
226+ "bitflags",
227+ "indexmap",
228+ "os_str_bytes",
229+ "textwrap",
230+ "unicode-width",
231+ "vec_map",
232+]
233+
243234[[package]]
244235name = "cloudabi"
245−version = "0.0.3"
236+version = "0.1.0"
246237source = "registry+https://github.com/rust-lang/crates.io-index"
247−checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
238+checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467"
248239dependencies = [
249240 "bitflags",
250241]
@@ -260,13 +251,13 @@ dependencies = [
260251
261252[[package]]
262253name = "crossterm"
263−version = "0.17.7"
254+version = "0.18.0"
264255source = "registry+https://github.com/rust-lang/crates.io-index"
265−checksum = "6f4919d60f26ae233e14233cc39746c8c8bb8cd7b05840ace83604917b51b6c7"
256+checksum = "c2fcdc3c9cf8ee446222e8ee8691a6d21b563b8fe1a64b1873080db7b5b23cf0"
266257dependencies = [
267258 "bitflags",
268259 "crossterm_winapi",
269− "futures-util",
260+ "futures-core",
270261 "lazy_static",
271262 "libc",
272263 "mio",
@@ -284,26 +275,6 @@ dependencies = [
284275 "winapi",
285276]
286277
287−[[package]]
288−name = "enum-iterator"
289−version = "0.6.0"
290−source = "registry+https://github.com/rust-lang/crates.io-index"
291−checksum = "c79a6321a1197d7730510c7e3f6cb80432dfefecb32426de8cea0aa19b4bb8d7"
292−dependencies = [
293− "enum-iterator-derive",
294−]
295−
296−[[package]]
297−name = "enum-iterator-derive"
298−version = "0.6.0"
299−source = "registry+https://github.com/rust-lang/crates.io-index"
300−checksum = "1e94aa31f7c0dc764f57896dc615ddd76fc13b0d5dca7eb6cc5e018a5a09ec06"
301−dependencies = [
302− "proc-macro2",
303− "quote",
304− "syn",
305−]
306−
307278[[package]]
308279name = "event-listener"
309280version = "2.5.1"
@@ -354,31 +325,10 @@ dependencies = [
354325]
355326
356327[[package]]
357−name = "futures-task"
358−version = "0.3.5"
359−source = "registry+https://github.com/rust-lang/crates.io-index"
360−checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626"
361−
362−[[package]]
363−name = "futures-util"
364−version = "0.3.5"
365−source = "registry+https://github.com/rust-lang/crates.io-index"
366−checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6"
367−dependencies = [
368− "futures-core",
369− "futures-task",
370− "pin-project",
371− "pin-utils",
372−]
373−
374−[[package]]
375−name = "heck"
376−version = "0.3.1"
328+name = "hashbrown"
329+version = "0.9.1"
377330source = "registry+https://github.com/rust-lang/crates.io-index"
378−checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
379−dependencies = [
380− "unicode-segmentation",
381−]
331+checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
382332
383333[[package]]
384334name = "helix-core"
@@ -401,7 +351,6 @@ name = "helix-syntax"
401351version = "0.1.0"
402352dependencies = [
403353 "cc",
404− "enum-iterator",
405354 "tree-sitter",
406355]
407356
@@ -410,7 +359,7 @@ name = "helix-term"
410359version = "0.1.0"
411360dependencies = [
412361 "anyhow",
413− "argh",
362+ "clap",
414363 "crossterm",
415364 "helix-core",
416365 "helix-view",
@@ -439,6 +388,25 @@ dependencies = [
439388 "libc",
440389]
441390
391+[[package]]
392+name = "indexmap"
393+version = "1.6.0"
394+source = "registry+https://github.com/rust-lang/crates.io-index"
395+checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2"
396+dependencies = [
397+ "autocfg",
398+ "hashbrown",
399+]
400+
401+[[package]]
402+name = "instant"
403+version = "0.1.7"
404+source = "registry+https://github.com/rust-lang/crates.io-index"
405+checksum = "63312a18f7ea8760cdd0a7c5aac1a619752a246b833545e3e36d1f81f7cd9e66"
406+dependencies = [
407+ "cfg-if",
408+]
409+
442410[[package]]
443411name = "jobserver"
444412version = "0.1.21"
@@ -462,9 +430,9 @@ checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235"
462430
463431[[package]]
464432name = "lock_api"
465−version = "0.3.4"
433+version = "0.4.1"
466434source = "registry+https://github.com/rust-lang/crates.io-index"
467−checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75"
435+checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c"
468436dependencies = [
469437 "scopeguard",
470438]
@@ -492,11 +460,10 @@ checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
492460
493461[[package]]
494462name = "mio"
495−version = "0.7.0"
463+version = "0.7.1"
496464source = "registry+https://github.com/rust-lang/crates.io-index"
497−checksum = "6e9971bc8349a361217a8f2a41f5d011274686bd4436465ba51730921039d7fb"
465+checksum = "d1bb17be6a300845baad6dc2062a31de575e9148696df52f040aea6398627350"
498466dependencies = [
499− "lazy_static",
500467 "libc",
501468 "log",
502469 "miow",
@@ -516,9 +483,9 @@ dependencies = [
516483
517484[[package]]
518485name = "nb-connect"
519−version = "1.0.0"
486+version = "1.0.1"
520487source = "registry+https://github.com/rust-lang/crates.io-index"
521−checksum = "e847c76b390f44529c2071ef06d0b52fbb4bdb04cc8987a5cfa63954c000abca"
488+checksum = "701f47aeb98466d0a7fea67e2c2f667c33efa1f2e4fd7f76743aac1153196f72"
522489dependencies = [
523490 "libc",
524491 "winapi",
@@ -555,6 +522,12 @@ version = "1.4.1"
555522source = "registry+https://github.com/rust-lang/crates.io-index"
556523checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad"
557524
525+[[package]]
526+name = "os_str_bytes"
527+version = "2.3.2"
528+source = "registry+https://github.com/rust-lang/crates.io-index"
529+checksum = "2ac6fe3538f701e339953a3ebbe4f39941aababa8a3f6964635b24ab526daeac"
530+
558531[[package]]
559532name = "parking"
560533version = "2.0.0"
@@ -563,59 +536,35 @@ checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72"
563536
564537[[package]]
565538name = "parking_lot"
566−version = "0.10.2"
539+version = "0.11.0"
567540source = "registry+https://github.com/rust-lang/crates.io-index"
568−checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e"
541+checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733"
569542dependencies = [
543+ "instant",
570544 "lock_api",
571545 "parking_lot_core",
572546]
573547
574548[[package]]
575549name = "parking_lot_core"
576−version = "0.7.2"
550+version = "0.8.0"
577551source = "registry+https://github.com/rust-lang/crates.io-index"
578−checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3"
552+checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b"
579553dependencies = [
580554 "cfg-if",
581555 "cloudabi",
556+ "instant",
582557 "libc",
583558 "redox_syscall",
584559 "smallvec",
585560 "winapi",
586561]
587562
588−[[package]]
589−name = "pin-project"
590−version = "0.4.23"
591−source = "registry+https://github.com/rust-lang/crates.io-index"
592−checksum = "ca4433fff2ae79342e497d9f8ee990d174071408f28f726d6d83af93e58e48aa"
593−dependencies = [
594− "pin-project-internal",
595−]
596−
597−[[package]]
598−name = "pin-project-internal"
599−version = "0.4.23"
600−source = "registry+https://github.com/rust-lang/crates.io-index"
601−checksum = "2c0e815c3ee9a031fdf5af21c10aa17c573c9c6a566328d99e3936c34e36461f"
602−dependencies = [
603− "proc-macro2",
604− "quote",
605− "syn",
606−]
607−
608563[[package]]
609564name = "pin-project-lite"
610−version = "0.1.7"
565+version = "0.1.9"
611566source = "registry+https://github.com/rust-lang/crates.io-index"
612−checksum = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715"
613−
614−[[package]]
615−name = "pin-utils"
616−version = "0.1.0"
617−source = "registry+https://github.com/rust-lang/crates.io-index"
618−checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
567+checksum = "4fe74897791e156a0cd8cce0db31b9b2198e67877316bf3086c3acd187f719f0"
619568
620569[[package]]
621570name = "polling"
@@ -630,24 +579,6 @@ dependencies = [
630579 "winapi",
631580]
632581
633−[[package]]
634−name = "proc-macro2"
635−version = "1.0.21"
636−source = "registry+https://github.com/rust-lang/crates.io-index"
637−checksum = "36e28516df94f3dd551a587da5357459d9b36d945a7c37c3557928c1c2ff2a2c"
638−dependencies = [
639− "unicode-xid",
640−]
641−
642−[[package]]
643−name = "quote"
644−version = "1.0.7"
645−source = "registry+https://github.com/rust-lang/crates.io-index"
646−checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
647−dependencies = [
648− "proc-macro2",
649−]
650−
651582[[package]]
652583name = "redox_syscall"
653584version = "0.1.57"
@@ -716,9 +647,9 @@ checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252"
716647
717648[[package]]
718649name = "smol"
719−version = "1.2.1"
650+version = "1.2.2"
720651source = "registry+https://github.com/rust-lang/crates.io-index"
721−checksum = "d41237ba3e3ada55ff3515d37becc8fa90e5e4af2b13a011ec3f932d9f1b2405"
652+checksum = "7ca2722989073e89917a575862fb49dba3321af152f0cf4a4164d9482aabdf28"
722653dependencies = [
723654 "async-channel",
724655 "async-executor",
@@ -744,17 +675,6 @@ dependencies = [
744675 "winapi",
745676]
746677
747−[[package]]
748−name = "syn"
749−version = "1.0.41"
750−source = "registry+https://github.com/rust-lang/crates.io-index"
751−checksum = "6690e3e9f692504b941dc6c3b188fd28df054f7fb8469ab40680df52fdcc842b"
752−dependencies = [
753− "proc-macro2",
754− "quote",
755− "unicode-xid",
756−]
757−
758678[[package]]
759679name = "tendril"
760680version = "0.4.1"
@@ -765,6 +685,15 @@ dependencies = [
765685 "utf-8",
766686]
767687
688+[[package]]
689+name = "textwrap"
690+version = "0.12.1"
691+source = "registry+https://github.com/rust-lang/crates.io-index"
692+checksum = "203008d98caf094106cfaba70acfed15e18ed3ddb7d94e49baec153a2b462789"
693+dependencies = [
694+ "unicode-width",
695+]
696+
768697[[package]]
769698name = "thread_local"
770699version = "1.0.1"
@@ -786,9 +715,8 @@ dependencies = [
786715
787716[[package]]
788717name = "tui"
789−version = "0.11.0"
790−source = "registry+https://github.com/rust-lang/crates.io-index"
791−checksum = "36626dee5ede9fd34015e9fb4fd7eedf3f3d05bdf1436aaef15b7d0a24233778"
718+version = "0.12.0"
719+source = "git+https://github.com/fdehau/tui-rs#25ff2e5e61f8902101e485743992db2412f77aad"
792720dependencies = [
793721 "bitflags",
794722 "cassowary",
@@ -809,12 +737,6 @@ version = "0.1.8"
809737source = "registry+https://github.com/rust-lang/crates.io-index"
810738checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
811739
812−[[package]]
813−name = "unicode-xid"
814−version = "0.2.1"
815−source = "registry+https://github.com/rust-lang/crates.io-index"
816−checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
817−
818740[[package]]
819741name = "utf-8"
820742version = "0.7.5"
@@ -827,6 +749,12 @@ version = "1.0.0"
827749source = "registry+https://github.com/rust-lang/crates.io-index"
828750checksum = "eafc1b9b2dfc6f5529177b62cf806484db55b32dc7c9658a118e11bbeb33061d"
829751
752+[[package]]
753+name = "vec_map"
754+version = "0.8.2"
755+source = "registry+https://github.com/rust-lang/crates.io-index"
756+checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
757+
830758[[package]]
831759name = "waker-fn"
832760version = "1.1.0"
helix-core/src/state.rs−2
@@ -244,8 +244,6 @@ impl State {
244244 skip_over_next(slice, &mut pos, |ch| ch.is_ascii_punctuation());
245245 }
246246
247− // TODO: stops on spaces
248−
249247 pos.saturating_sub(1)
250248 }
251249
helix-syntax/Cargo.toml−1
@@ -8,7 +8,6 @@ edition = "2018"
88
99[dependencies]
1010tree-sitter = "0.17"
11−enum-iterator = "0.6"
1211
1312[build-dependencies]
1413cc = { version = "1", features = ["parallel"] }
helix-syntax/src/lib.rs+1−2
@@ -1,4 +1,3 @@
1−use enum_iterator::IntoEnumIterator;
21use tree_sitter::Language;
32
43#[macro_export]
@@ -13,7 +12,7 @@ macro_rules! mk_extern {
1312#[macro_export]
1413macro_rules! mk_enum {
1514 ( $( $camel:ident ),* ) => {
16− #[derive(Clone, Copy, Debug, IntoEnumIterator, PartialEq)]
15+ #[derive(Clone, Copy, Debug, PartialEq)]
1716 pub enum LANG {
1817 $(
1918 $camel,
helix-term/Cargo.toml+4−3
@@ -15,9 +15,10 @@ helix-core = { path = "../helix-core" }
1515helix-view = { path = "../helix-view", features = ["term"]}
1616
1717anyhow = "1"
18−argh = "0.1"
1918
2019smol = "1"
2120num_cpus = "1.13"
22−tui = { version = "0.11", default-features = false, features = ["crossterm"] }
23−crossterm = { version = "0.17", features = ["event-stream"] }
21+# tui = { version = "0.12", default-features = false, features = ["crossterm"] }
22+tui = { git = "https://github.com/fdehau/tui-rs", default-features = false, features = ["crossterm"] }
23+crossterm = { version = "0.18", features = ["event-stream"] }
24+clap = { version = "3.0.0-beta.2 ", default-features = false, features = ["std"] }
helix-term/src/editor.rs+2−2
@@ -1,4 +1,4 @@
1−use crate::Args;
1+use clap::ArgMatches as Args;
22use helix_core::{state::coords_at_pos, state::Mode, syntax::HighlightEvent, Range, State};
33use helix_view::{commands, keymap, View};
44
@@ -53,7 +53,7 @@ impl Editor {
5353 // TODO; move to state
5454 };
5555
56− if let Some(file) = args.files.pop() {
56+ if let Some(file) = args.values_of_t::<PathBuf>("files").unwrap().pop() {
5757 editor.open(file)?;
5858 }
5959
helix-term/src/main.rs+12−9
@@ -4,22 +4,25 @@ mod editor;
44
55use editor::Editor;
66
7−use argh::FromArgs;
7+use clap::{App, Arg};
88use std::path::PathBuf;
99
1010use anyhow::Error;
1111
12−#[derive(FromArgs)]
13−/// A post-modern text editor.
14−pub struct Args {
15− #[argh(positional)]
16− files: Vec<PathBuf>,
17−}
18−
1912static EX: smol::Executor = smol::Executor::new();
2013
2114fn main() -> Result<(), Error> {
22− let args: Args = argh::from_env();
15+ let args = App::new("helix")
16+ .version("0.1")
17+ .about("A post-modern text editor.")
18+ .arg(
19+ Arg::new("files")
20+ .about("Sets the input file to use")
21+ .required(true)
22+ .multiple(true)
23+ .index(1),
24+ )
25+ .get_matches();
2326
2427 for _ in 0..num_cpus::get() {
2528 std::thread::spawn(move || smol::block_on(EX.run(smol::future::pending::<()>())));
helix-view/Cargo.toml+3−2
@@ -15,6 +15,7 @@ anyhow = "1"
1515helix-core = { path = "../helix-core" }
1616
1717# Conversion traits
18−tui = { version = "0.11", default-features = false, features = ["crossterm"], optional = true}
19−crossterm = { version = "0.17", features = ["event-stream"], optional = true}
18+# tui = { version = "0.12", default-features = false, features = ["crossterm"], optional = true}
19+tui = { git = "https://github.com/fdehau/tui-rs", default-features = false, features = ["crossterm"], optional = true}
20+crossterm = { version = "0.18", features = ["event-stream"], optional = true}
2021once_cell = "1.4"
helix-view/src/commands.rs+1
@@ -151,6 +151,7 @@ pub fn extend_line_down(view: &mut View, count: usize) {
151151pub fn split_selection_on_newline(view: &mut View, _count: usize) {
152152 let text = &view.state.doc.slice(..);
153153 // only compile the regex once
154+ #[allow(clippy::trivial_regex)]
154155 static REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r"\n").unwrap());
155156 // TODO: use a transaction
156157 view.state.selection = selection::split_on_matches(text, view.state.selection(), &REGEX)