aboutsummaryrefslogtreecommitdiff
path: root/helix-core
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-03-24 09:17:00 +0000
committerBlaž Hrastnik2021-03-24 09:17:00 +0000
commit9a36d2c2a8c4c7c3932de59d1ec145faf3301f2d (patch)
tree5a9a98879c6a87c5fdeff7370999a6f70af71299 /helix-core
parent025d63bc3065529b68945816e9652c779e4be862 (diff)
wip: Hooks & trigger characters for completion/signature_help.
Diffstat (limited to 'helix-core')
-rw-r--r--helix-core/src/auto_pairs.rs26
1 files changed, 19 insertions, 7 deletions
diff --git a/helix-core/src/auto_pairs.rs b/helix-core/src/auto_pairs.rs
index 7bb87e14..cd052489 100644
--- a/helix-core/src/auto_pairs.rs
+++ b/helix-core/src/auto_pairs.rs
@@ -28,13 +28,11 @@ const CLOSE_BEFORE: &str = ")]}'\":;> \n"; // includes space and newline
pub fn hook(doc: &Rope, selection: &Selection, ch: char) -> Option<Transaction> {
for &(open, close) in PAIRS {
if open == ch {
- let t = if open == close {
- return None;
- // handle_same()
+ if open == close {
+ return handle_same(doc, selection, open);
} else {
- handle_open(doc, selection, open, close, CLOSE_BEFORE)
- };
- return Some(t);
+ return Some(handle_open(doc, selection, open, close, CLOSE_BEFORE));
+ }
}
if close == ch {
@@ -115,7 +113,21 @@ fn handle_close(doc: &Rope, selection: &Selection, _open: char, close: char) ->
}
// handle cases where open and close is the same, or in triples ("""docstring""")
-fn handle_same() {
+fn handle_same(doc: &Rope, selection: &Selection, token: char) -> Option<Transaction> {
// if not cursor but selection, wrap
// let next = next char
+
+ // if next == bracket {
+ // // if start of syntax node, insert token twice (new pair because node is complete)
+ // // elseif colsedBracketAt
+ // // is_triple == allow triple && next 3 is equal
+ // // cursor jump over
+ // }
+ //} else if allow_triple && followed by triple {
+ //}
+ //} else if next != word char && prev != bracket && prev != word char {
+ // // condition checks for cases like I' where you don't want I'' (or I'm)
+ // insert pair ("")
+ //}
+ None
}