on master help sign in
Update deps, introduce the new tree-sitter lifetimes
commit094203c74e19d49b3bfc74cf2ab4f853a773c195 authorBlaž Hrastnik <blaz@mxxn.io> dateFri 28 May 2021, 00:00 (5 years ago) parentb114cfa
11 files changed+53−31
Cargo.lock+16−16 TODO.md+5 helix-core/src/syntax.rs+8−8 helix-term/src/commands.rs+4 helix-term/src/ui/completion.rs+1−4 helix-term/src/ui/editor.rs+7 helix-term/src/ui/markdown.rs+6−1 helix-term/src/ui/prompt.rs+1−1 runtime/queries/go/indents.toml+1 shell.nix+2−1 theme.toml+2
Cargo.lock+16−16
@@ -52,9 +52,9 @@ checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
5252
5353[[package]]
5454name = "cc"
55−version = "1.0.67"
55+version = "1.0.68"
5656source = "registry+https://github.com/rust-lang/crates.io-index"
57−checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd"
57+checksum = "4a72c244c1ff497a746a7e1fb3d14bd08420ecda70c8f25c7112f2781652d787"
5858dependencies = [
5959 "jobserver",
6060]
@@ -244,9 +244,9 @@ dependencies = [
244244
245245[[package]]
246246name = "getrandom"
247−version = "0.2.2"
247+version = "0.2.3"
248248source = "registry+https://github.com/rust-lang/crates.io-index"
249−checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8"
249+checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
250250dependencies = [
251251 "cfg-if",
252252 "libc",
@@ -477,9 +477,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
477477
478478[[package]]
479479name = "libc"
480−version = "0.2.94"
480+version = "0.2.95"
481481source = "registry+https://github.com/rust-lang/crates.io-index"
482−checksum = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e"
482+checksum = "789da6d93f1b866ffe175afc5322a4d76c038605a1c3319bb57b06967ca98a36"
483483
484484[[package]]
485485name = "lock_api"
@@ -501,9 +501,9 @@ dependencies = [
501501
502502[[package]]
503503name = "lsp-types"
504−version = "0.89.0"
504+version = "0.89.1"
505505source = "registry+https://github.com/rust-lang/crates.io-index"
506−checksum = "07731ecd4ee0654728359a5b95e2a254c857876c04b85225496a35d60345daa7"
506+checksum = "48b8a871b0a450bcec0e26d74a59583c8173cb9fb7d7f98889e18abb84838e0f"
507507dependencies = [
508508 "bitflags",
509509 "serde",
@@ -659,9 +659,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
659659
660660[[package]]
661661name = "proc-macro2"
662−version = "1.0.26"
662+version = "1.0.27"
663663source = "registry+https://github.com/rust-lang/crates.io-index"
664−checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec"
664+checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038"
665665dependencies = [
666666 "unicode-xid",
667667]
@@ -868,18 +868,18 @@ dependencies = [
868868
869869[[package]]
870870name = "thiserror"
871−version = "1.0.24"
871+version = "1.0.25"
872872source = "registry+https://github.com/rust-lang/crates.io-index"
873−checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e"
873+checksum = "fa6f76457f59514c7eeb4e59d891395fab0b2fd1d40723ae737d64153392e9c6"
874874dependencies = [
875875 "thiserror-impl",
876876]
877877
878878[[package]]
879879name = "thiserror-impl"
880−version = "1.0.24"
880+version = "1.0.25"
881881source = "registry+https://github.com/rust-lang/crates.io-index"
882−checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0"
882+checksum = "8a36768c0fbf1bb15eca10defa29526bda730a2376c2ab4393ccfa16fb1a318d"
883883dependencies = [
884884 "proc-macro2",
885885 "quote",
@@ -972,9 +972,9 @@ dependencies = [
972972
973973[[package]]
974974name = "tree-sitter"
975−version = "0.19.3"
975+version = "0.19.5"
976976source = "registry+https://github.com/rust-lang/crates.io-index"
977−checksum = "1f41201fed3db3b520405a9c01c61773a250d4c3f43e9861c14b2bb232c981ab"
977+checksum = "ad726ec26496bf4c083fff0f43d4eb3a2ad1bba305323af5ff91383c0b6ecac0"
978978dependencies = [
979979 "cc",
980980 "regex",
TODO.md+5
@@ -2,6 +2,8 @@
22
33------
44
5+as you type completion!
6+
57- tree sitter:
68 - lua
79 - markdown
@@ -18,6 +20,9 @@
1820- [ ] document.on_type provider triggers
1921- [ ] completion isIncomplete support
2022
23+- [ ] scroll wheel support
24+- [ ] matching bracket highlight
25+
21261
2227- [ ] respect view fullscreen flag
2328- [ ] Implement marks (superset of Selection/Range)
helix-core/src/syntax.rs+8−8
@@ -745,7 +745,7 @@ struct LocalScope<'a> {
745745 local_defs: Vec<LocalDef<'a>>,
746746}
747747
748−struct HighlightIter<'a, F>
748+struct HighlightIter<'a, 'tree: 'a, F>
749749where
750750 F: FnMut(&str) -> Option<&'a HighlightConfiguration> + 'a,
751751{
@@ -753,16 +753,16 @@ where
753753 byte_offset: usize,
754754 injection_callback: F,
755755 cancellation_flag: Option<&'a AtomicUsize>,
756− layers: Vec<HighlightIterLayer<'a>>,
756+ layers: Vec<HighlightIterLayer<'a, 'tree>>,
757757 iter_count: usize,
758758 next_event: Option<HighlightEvent>,
759759 last_highlight_range: Option<(usize, usize, usize)>,
760760}
761761
762−struct HighlightIterLayer<'a> {
762+struct HighlightIterLayer<'a, 'tree: 'a> {
763763 _tree: Option<Tree>,
764764 cursor: QueryCursor,
765− captures: iter::Peekable<QueryCaptures<'a, Cow<'a, [u8]>>>,
765+ captures: iter::Peekable<QueryCaptures<'a, 'tree, Cow<'a, [u8]>>>,
766766 config: &'a HighlightConfiguration,
767767 highlight_end_stack: Vec<usize>,
768768 scope_stack: Vec<LocalScope<'a>>,
@@ -929,7 +929,7 @@ impl HighlightConfiguration {
929929 }
930930}
931931
932−impl<'a> HighlightIterLayer<'a> {
932+impl<'a, 'tree: 'a> HighlightIterLayer<'a, 'tree> {
933933 /// Create a new 'layer' of highlighting for this document.
934934 ///
935935 /// In the even that the new layer contains "combined injections" (injections where multiple
@@ -1193,7 +1193,7 @@ impl<'a> HighlightIterLayer<'a> {
11931193 }
11941194}
11951195
1196−impl<'a, F> HighlightIter<'a, F>
1196+impl<'a, 'tree: 'a, F> HighlightIter<'a, 'tree, F>
11971197where
11981198 F: FnMut(&str) -> Option<&'a HighlightConfiguration> + 'a,
11991199{
@@ -1244,7 +1244,7 @@ where
12441244 }
12451245 }
12461246
1247− fn insert_layer(&mut self, mut layer: HighlightIterLayer<'a>) {
1247+ fn insert_layer(&mut self, mut layer: HighlightIterLayer<'a, 'tree>) {
12481248 if let Some(sort_key) = layer.sort_key() {
12491249 let mut i = 1;
12501250 while i < self.layers.len() {
@@ -1263,7 +1263,7 @@ where
12631263 }
12641264}
12651265
1266−impl<'a, F> Iterator for HighlightIter<'a, F>
1266+impl<'a, 'tree: 'a, F> Iterator for HighlightIter<'a, 'tree, F>
12671267where
12681268 F: FnMut(&str) -> Option<&'a HighlightConfiguration> + 'a,
12691269{
helix-term/src/commands.rs+4
@@ -674,6 +674,7 @@ pub fn search(cx: &mut Context) {
674674
675675 cx.push_layer(Box::new(prompt));
676676}
677+// can't search next for ""compose"" for some reason
677678
678679pub fn _search_next(cx: &mut Context, extend: bool) {
679680 if let Some(query) = register::get('\\') {
@@ -1670,6 +1671,9 @@ pub mod insert {
16701671
16711672 let head = pos + offs + text.len();
16721673
1674+ // TODO: range replace or extend
1675+ // range.replace(|range| range.is_empty(), head); -> fn extend if cond true, new head pos
1676+ // can be used with cx.mode to do replace or extend on most changes
16731677 ranges.push(Range::new(
16741678 if range.is_empty() {
16751679 head
helix-term/src/ui/completion.rs+1−4
@@ -19,10 +19,7 @@ use lsp::CompletionItem;
1919
2020impl menu::Item for CompletionItem {
2121 fn filter_text(&self) -> &str {
22− self.filter_text
23− .as_ref()
24− .unwrap_or_else(|| &self.label)
25− .as_str()
22+ self.filter_text.as_ref().unwrap_or(&self.label).as_str()
2623 }
2724
2825 fn label(&self) -> &str {
helix-term/src/ui/editor.rs+7
@@ -148,6 +148,13 @@ impl EditorView {
148148 // TODO: scope matching: biggest union match? [string] & [html, string], [string, html] & [ string, html]
149149 // can do this by sorting our theme matches based on array len (longest first) then stopping at the
150150 // first rule that matches (rule.all(|scope| scopes.contains(scope)))
151+ // log::info!(
152+ // "scopes: {:?}",
153+ // spans
154+ // .iter()
155+ // .map(|span| theme.scopes()[span.0].as_str())
156+ // .collect::<Vec<_>>()
157+ // );
151158 let style = match spans.first() {
152159 Some(span) => theme.get(theme.scopes()[span.0].as_str()),
153160 None => theme.get("ui.text"),
helix-term/src/ui/markdown.rs+6−1
@@ -107,6 +107,8 @@ fn parse<'a>(contents: &'a str, theme: Option<&Theme>) -> tui::text::Text<'a> {
107107 None => text_style,
108108 };
109109
110+ // TODO: replace tabs with indentation
111+
110112 let mut slice = &text[start..end];
111113 while let Some(end) = slice.find('\n') {
112114 // emit span up to newline
@@ -153,6 +155,7 @@ fn parse<'a>(contents: &'a str, theme: Option<&Theme>) -> tui::text::Text<'a> {
153155 }
154156 }
155157 Event::Code(text) | Event::Html(text) => {
158+ log::warn!("code {:?}", text);
156159 let mut span = to_span(text);
157160 span.style = code_style;
158161 spans.push(span);
@@ -167,7 +170,9 @@ fn parse<'a>(contents: &'a str, theme: Option<&Theme>) -> tui::text::Text<'a> {
167170 lines.push(Spans::default());
168171 }
169172 // TaskListMarker(bool) true if checked
170− _ => (),
173+ _ => {
174+ log::warn!("unhandled markdown event {:?}", event);
175+ }
171176 }
172177 // build up a vec of Paragraph tui widgets
173178 }
helix-term/src/ui/prompt.rs+1−1
@@ -272,7 +272,7 @@ impl Component for Prompt {
272272
273273 fn cursor_position(&self, area: Rect, editor: &Editor) -> Option<Position> {
274274 Some(Position::new(
275− area.height as usize,
275+ area.y as usize,
276276 area.x as usize + self.prompt.len() + self.cursor,
277277 ))
278278 }
runtime/queries/go/indents.toml+1
@@ -3,6 +3,7 @@ indent = [
33 "const_declaration",
44 "var_declaration",
55 "type_declaration",
6+ "type_spec",
67 "function_declaration",
78 "method_declaration",
89 "composite_literal",
shell.nix+2−1
@@ -12,6 +12,7 @@ pkgs.mkShell {
1212 # https://github.com/rust-lang/rust/issues/55979
1313 LD_LIBRARY_PATH="${stdenv.cc.cc.lib}/lib64:$LD_LIBRARY_PATH";
1414
15− HELIX_RUNTIME=./runtime;
15+ # HELIX_RUNTIME=./runtime;
16+ HELIX_RUNTIME="/home/speed/src/helix/runtime";
1617}
1718
theme.toml+2
@@ -47,6 +47,8 @@
4747"ui.text" = { fg = "#a4a0e8"} # lavender
4848"ui.text.focus" = { fg = "#dbbfef"} # lilac
4949
50+"ui.menu.selected" = { fg = "#281733", bg = "#ffffff" } # revolver
51+
5052"warning" = "#ffcd1c"
5153"error" = "#f47868"
5254"info" = "#6F44F0"