aboutsummaryrefslogtreecommitdiff
path: root/helix-lsp
diff options
context:
space:
mode:
authorPascal Kuthe2023-03-19 19:40:33 +0000
committerBlaž Hrastnik2023-03-22 05:33:08 +0000
commit617f09adc4544a653b482139c8fef33c67fbfad5 (patch)
treef6c1665c004c8ded8c35a81600e5e3240fa617cf /helix-lsp
parentcabb746b7db0b4dc69997570d34a2133a43f59ab (diff)
fix single-char variable names
Diffstat (limited to 'helix-lsp')
-rw-r--r--helix-lsp/src/snippet.rs34
1 files changed, 17 insertions, 17 deletions
diff --git a/helix-lsp/src/snippet.rs b/helix-lsp/src/snippet.rs
index aa3496ed..e59351a4 100644
--- a/helix-lsp/src/snippet.rs
+++ b/helix-lsp/src/snippet.rs
@@ -196,23 +196,23 @@ mod parser {
fn var<'a>() -> impl Parser<'a, Output = &'a str> {
// var = [_a-zA-Z][_a-zA-Z0-9]*
- move |input: &'a str| match input
- .char_indices()
- .take_while(|(p, c)| {
- *c == '_'
- || if *p == 0 {
- c.is_ascii_alphabetic()
- } else {
- c.is_ascii_alphanumeric()
- }
- })
- .last()
- {
- Some((index, c)) if index >= 1 => {
- let index = index + c.len_utf8();
- Ok((&input[index..], &input[0..index]))
- }
- _ => Err(input),
+ move |input: &'a str| {
+ input
+ .char_indices()
+ .take_while(|(p, c)| {
+ *c == '_'
+ || if *p == 0 {
+ c.is_ascii_alphabetic()
+ } else {
+ c.is_ascii_alphanumeric()
+ }
+ })
+ .last()
+ .map(|(index, c)| {
+ let index = index + c.len_utf8();
+ (&input[index..], &input[0..index])
+ })
+ .ok_or(input)
}
}