on master help sign in
Update deps, introduce the new tree-sitter lifetimes
094203cBlaž Hrastnik
Cargo.lock+16−16
@@ -52,9 +52,9 @@ checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
52
52
53[[package]]
53[[package]]
54name = "cc"
54name = "cc"
55−version = "1.0.67"
55+version = "1.0.68"
56source = "registry+https://github.com/rust-lang/crates.io-index"
56source = "registry+https://github.com/rust-lang/crates.io-index"
57−checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd"
57+checksum = "4a72c244c1ff497a746a7e1fb3d14bd08420ecda70c8f25c7112f2781652d787"
58dependencies = [
58dependencies = [
59 "jobserver",
59 "jobserver",
60]
60]
@@ -244,9 +244,9 @@ dependencies = [
244
244
245[[package]]
245[[package]]
246name = "getrandom"
246name = "getrandom"
247−version = "0.2.2"
247+version = "0.2.3"
248source = "registry+https://github.com/rust-lang/crates.io-index"
248source = "registry+https://github.com/rust-lang/crates.io-index"
249−checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8"
249+checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
250dependencies = [
250dependencies = [
251 "cfg-if",
251 "cfg-if",
252 "libc",
252 "libc",
@@ -477,9 +477,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
477
477
478[[package]]
478[[package]]
479name = "libc"
479name = "libc"
480−version = "0.2.94"
480+version = "0.2.95"
481source = "registry+https://github.com/rust-lang/crates.io-index"
481source = "registry+https://github.com/rust-lang/crates.io-index"
482−checksum = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e"
482+checksum = "789da6d93f1b866ffe175afc5322a4d76c038605a1c3319bb57b06967ca98a36"
483
483
484[[package]]
484[[package]]
485name = "lock_api"
485name = "lock_api"
@@ -501,9 +501,9 @@ dependencies = [
501
501
502[[package]]
502[[package]]
503name = "lsp-types"
503name = "lsp-types"
504−version = "0.89.0"
504+version = "0.89.1"
505source = "registry+https://github.com/rust-lang/crates.io-index"
505source = "registry+https://github.com/rust-lang/crates.io-index"
506−checksum = "07731ecd4ee0654728359a5b95e2a254c857876c04b85225496a35d60345daa7"
506+checksum = "48b8a871b0a450bcec0e26d74a59583c8173cb9fb7d7f98889e18abb84838e0f"
507dependencies = [
507dependencies = [
508 "bitflags",
508 "bitflags",
509 "serde",
509 "serde",
@@ -659,9 +659,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
659
659
660[[package]]
660[[package]]
661name = "proc-macro2"
661name = "proc-macro2"
662−version = "1.0.26"
662+version = "1.0.27"
663source = "registry+https://github.com/rust-lang/crates.io-index"
663source = "registry+https://github.com/rust-lang/crates.io-index"
664−checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec"
664+checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038"
665dependencies = [
665dependencies = [
666 "unicode-xid",
666 "unicode-xid",
667]
667]
@@ -868,18 +868,18 @@ dependencies = [
868
868
869[[package]]
869[[package]]
870name = "thiserror"
870name = "thiserror"
871−version = "1.0.24"
871+version = "1.0.25"
872source = "registry+https://github.com/rust-lang/crates.io-index"
872source = "registry+https://github.com/rust-lang/crates.io-index"
873−checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e"
873+checksum = "fa6f76457f59514c7eeb4e59d891395fab0b2fd1d40723ae737d64153392e9c6"
874dependencies = [
874dependencies = [
875 "thiserror-impl",
875 "thiserror-impl",
876]
876]
877
877
878[[package]]
878[[package]]
879name = "thiserror-impl"
879name = "thiserror-impl"
880−version = "1.0.24"
880+version = "1.0.25"
881source = "registry+https://github.com/rust-lang/crates.io-index"
881source = "registry+https://github.com/rust-lang/crates.io-index"
882−checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0"
882+checksum = "8a36768c0fbf1bb15eca10defa29526bda730a2376c2ab4393ccfa16fb1a318d"
883dependencies = [
883dependencies = [
884 "proc-macro2",
884 "proc-macro2",
885 "quote",
885 "quote",
@@ -972,9 +972,9 @@ dependencies = [
972
972
973[[package]]
973[[package]]
974name = "tree-sitter"
974name = "tree-sitter"
975−version = "0.19.3"
975+version = "0.19.5"
976source = "registry+https://github.com/rust-lang/crates.io-index"
976source = "registry+https://github.com/rust-lang/crates.io-index"
977−checksum = "1f41201fed3db3b520405a9c01c61773a250d4c3f43e9861c14b2bb232c981ab"
977+checksum = "ad726ec26496bf4c083fff0f43d4eb3a2ad1bba305323af5ff91383c0b6ecac0"
978dependencies = [
978dependencies = [
979 "cc",
979 "cc",
980 "regex",
980 "regex",
TODO.md+5
@@ -2,6 +2,8 @@
2
2
3------
3------
4
4
5+as you type completion!
6+
5- tree sitter:
7- tree sitter:
6 - lua
8 - lua
7 - markdown
9 - markdown
@@ -18,6 +20,9 @@
18- [ ] document.on_type provider triggers
20- [ ] document.on_type provider triggers
19- [ ] completion isIncomplete support
21- [ ] completion isIncomplete support
20
22
23+- [ ] scroll wheel support
24+- [ ] matching bracket highlight
25+
211
261
22- [ ] respect view fullscreen flag
27- [ ] respect view fullscreen flag
23- [ ] Implement marks (superset of Selection/Range)
28- [ ] Implement marks (superset of Selection/Range)
helix-core/src/syntax.rs+8−8
@@ -745,7 +745,7 @@ struct LocalScope<'a> {
745 local_defs: Vec<LocalDef<'a>>,
745 local_defs: Vec<LocalDef<'a>>,
746}
746}
747
747
748−struct HighlightIter<'a, F>
748+struct HighlightIter<'a, 'tree: 'a, F>
749where
749where
750 F: FnMut(&str) -> Option<&'a HighlightConfiguration> + 'a,
750 F: FnMut(&str) -> Option<&'a HighlightConfiguration> + 'a,
751{
751{
@@ -753,16 +753,16 @@ where
753 byte_offset: usize,
753 byte_offset: usize,
754 injection_callback: F,
754 injection_callback: F,
755 cancellation_flag: Option<&'a AtomicUsize>,
755 cancellation_flag: Option<&'a AtomicUsize>,
756− layers: Vec<HighlightIterLayer<'a>>,
756+ layers: Vec<HighlightIterLayer<'a, 'tree>>,
757 iter_count: usize,
757 iter_count: usize,
758 next_event: Option<HighlightEvent>,
758 next_event: Option<HighlightEvent>,
759 last_highlight_range: Option<(usize, usize, usize)>,
759 last_highlight_range: Option<(usize, usize, usize)>,
760}
760}
761
761
762−struct HighlightIterLayer<'a> {
762+struct HighlightIterLayer<'a, 'tree: 'a> {
763 _tree: Option<Tree>,
763 _tree: Option<Tree>,
764 cursor: QueryCursor,
764 cursor: QueryCursor,
765− captures: iter::Peekable<QueryCaptures<'a, Cow<'a, [u8]>>>,
765+ captures: iter::Peekable<QueryCaptures<'a, 'tree, Cow<'a, [u8]>>>,
766 config: &'a HighlightConfiguration,
766 config: &'a HighlightConfiguration,
767 highlight_end_stack: Vec<usize>,
767 highlight_end_stack: Vec<usize>,
768 scope_stack: Vec<LocalScope<'a>>,
768 scope_stack: Vec<LocalScope<'a>>,
@@ -929,7 +929,7 @@ impl HighlightConfiguration {
929 }
929 }
930}
930}
931
931
932−impl<'a> HighlightIterLayer<'a> {
932+impl<'a, 'tree: 'a> HighlightIterLayer<'a, 'tree> {
933 /// Create a new 'layer' of highlighting for this document.
933 /// Create a new 'layer' of highlighting for this document.
934 ///
934 ///
935 /// In the even that the new layer contains "combined injections" (injections where multiple
935 /// In the even that the new layer contains "combined injections" (injections where multiple
@@ -1193,7 +1193,7 @@ impl<'a> HighlightIterLayer<'a> {
1193 }
1193 }
1194}
1194}
1195
1195
1196−impl<'a, F> HighlightIter<'a, F>
1196+impl<'a, 'tree: 'a, F> HighlightIter<'a, 'tree, F>
1197where
1197where
1198 F: FnMut(&str) -> Option<&'a HighlightConfiguration> + 'a,
1198 F: FnMut(&str) -> Option<&'a HighlightConfiguration> + 'a,
1199{
1199{
@@ -1244,7 +1244,7 @@ where
1244 }
1244 }
1245 }
1245 }
1246
1246
1247− fn insert_layer(&mut self, mut layer: HighlightIterLayer<'a>) {
1247+ fn insert_layer(&mut self, mut layer: HighlightIterLayer<'a, 'tree>) {
1248 if let Some(sort_key) = layer.sort_key() {
1248 if let Some(sort_key) = layer.sort_key() {
1249 let mut i = 1;
1249 let mut i = 1;
1250 while i < self.layers.len() {
1250 while i < self.layers.len() {
@@ -1263,7 +1263,7 @@ where
1263 }
1263 }
1264}
1264}
1265
1265
1266−impl<'a, F> Iterator for HighlightIter<'a, F>
1266+impl<'a, 'tree: 'a, F> Iterator for HighlightIter<'a, 'tree, F>
1267where
1267where
1268 F: FnMut(&str) -> Option<&'a HighlightConfiguration> + 'a,
1268 F: FnMut(&str) -> Option<&'a HighlightConfiguration> + 'a,
1269{
1269{
helix-term/src/commands.rs+4
@@ -674,6 +674,7 @@ pub fn search(cx: &mut Context) {
674
674
675 cx.push_layer(Box::new(prompt));
675 cx.push_layer(Box::new(prompt));
676}
676}
677+// can't search next for ""compose"" for some reason
677
678
678pub fn _search_next(cx: &mut Context, extend: bool) {
679pub fn _search_next(cx: &mut Context, extend: bool) {
679 if let Some(query) = register::get('\\') {
680 if let Some(query) = register::get('\\') {
@@ -1670,6 +1671,9 @@ pub mod insert {
1670
1671
1671 let head = pos + offs + text.len();
1672 let head = pos + offs + text.len();
1672
1673
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
1673 ranges.push(Range::new(
1677 ranges.push(Range::new(
1674 if range.is_empty() {
1678 if range.is_empty() {
1675 head
1679 head
helix-term/src/ui/completion.rs+1−4
@@ -19,10 +19,7 @@ use lsp::CompletionItem;
19
19
20impl menu::Item for CompletionItem {
20impl menu::Item for CompletionItem {
21 fn filter_text(&self) -> &str {
21 fn filter_text(&self) -> &str {
22− self.filter_text
22+ self.filter_text.as_ref().unwrap_or(&self.label).as_str()
23− .as_ref()
24− .unwrap_or_else(|| &self.label)
25− .as_str()
26 }
23 }
27
24
28 fn label(&self) -> &str {
25 fn label(&self) -> &str {
helix-term/src/ui/editor.rs+7
@@ -148,6 +148,13 @@ impl EditorView {
148 // TODO: scope matching: biggest union match? [string] & [html, string], [string, html] & [ string, html]
148 // TODO: scope matching: biggest union match? [string] & [html, string], [string, html] & [ string, html]
149 // can do this by sorting our theme matches based on array len (longest first) then stopping at the
149 // can do this by sorting our theme matches based on array len (longest first) then stopping at the
150 // first rule that matches (rule.all(|scope| scopes.contains(scope)))
150 // 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+ // );
151 let style = match spans.first() {
158 let style = match spans.first() {
152 Some(span) => theme.get(theme.scopes()[span.0].as_str()),
159 Some(span) => theme.get(theme.scopes()[span.0].as_str()),
153 None => theme.get("ui.text"),
160 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> {
107 None => text_style,
107 None => text_style,
108 };
108 };
109
109
110+ // TODO: replace tabs with indentation
111+
110 let mut slice = &text[start..end];
112 let mut slice = &text[start..end];
111 while let Some(end) = slice.find('\n') {
113 while let Some(end) = slice.find('\n') {
112 // emit span up to newline
114 // emit span up to newline
@@ -153,6 +155,7 @@ fn parse<'a>(contents: &'a str, theme: Option<&Theme>) -> tui::text::Text<'a> {
153 }
155 }
154 }
156 }
155 Event::Code(text) | Event::Html(text) => {
157 Event::Code(text) | Event::Html(text) => {
158+ log::warn!("code {:?}", text);
156 let mut span = to_span(text);
159 let mut span = to_span(text);
157 span.style = code_style;
160 span.style = code_style;
158 spans.push(span);
161 spans.push(span);
@@ -167,7 +170,9 @@ fn parse<'a>(contents: &'a str, theme: Option<&Theme>) -> tui::text::Text<'a> {
167 lines.push(Spans::default());
170 lines.push(Spans::default());
168 }
171 }
169 // TaskListMarker(bool) true if checked
172 // TaskListMarker(bool) true if checked
170− _ => (),
173+ _ => {
174+ log::warn!("unhandled markdown event {:?}", event);
175+ }
171 }
176 }
172 // build up a vec of Paragraph tui widgets
177 // build up a vec of Paragraph tui widgets
173 }
178 }
helix-term/src/ui/prompt.rs+1−1
@@ -272,7 +272,7 @@ impl Component for Prompt {
272
272
273 fn cursor_position(&self, area: Rect, editor: &Editor) -> Option<Position> {
273 fn cursor_position(&self, area: Rect, editor: &Editor) -> Option<Position> {
274 Some(Position::new(
274 Some(Position::new(
275− area.height as usize,
275+ area.y as usize,
276 area.x as usize + self.prompt.len() + self.cursor,
276 area.x as usize + self.prompt.len() + self.cursor,
277 ))
277 ))
278 }
278 }
runtime/queries/go/indents.toml+1
@@ -3,6 +3,7 @@ indent = [
3 "const_declaration",
3 "const_declaration",
4 "var_declaration",
4 "var_declaration",
5 "type_declaration",
5 "type_declaration",
6+ "type_spec",
6 "function_declaration",
7 "function_declaration",
7 "method_declaration",
8 "method_declaration",
8 "composite_literal",
9 "composite_literal",
shell.nix+2−1
@@ -12,6 +12,7 @@ pkgs.mkShell {
12 # https://github.com/rust-lang/rust/issues/55979
12 # https://github.com/rust-lang/rust/issues/55979
13 LD_LIBRARY_PATH="${stdenv.cc.cc.lib}/lib64:$LD_LIBRARY_PATH";
13 LD_LIBRARY_PATH="${stdenv.cc.cc.lib}/lib64:$LD_LIBRARY_PATH";
14
14
15− HELIX_RUNTIME=./runtime;
15+ # HELIX_RUNTIME=./runtime;
16+ HELIX_RUNTIME="/home/speed/src/helix/runtime";
16}
17}
17
18
theme.toml+2
@@ -47,6 +47,8 @@
47"ui.text" = { fg = "#a4a0e8"} # lavender
47"ui.text" = { fg = "#a4a0e8"} # lavender
48"ui.text.focus" = { fg = "#dbbfef"} # lilac
48"ui.text.focus" = { fg = "#dbbfef"} # lilac
49
49
50+"ui.menu.selected" = { fg = "#281733", bg = "#ffffff" } # revolver
51+
50"warning" = "#ffcd1c"
52"warning" = "#ffcd1c"
51"error" = "#f47868"
53"error" = "#f47868"
52"info" = "#6F44F0"
54"info" = "#6F44F0"