New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto-pairs for multiple characters #4035
Comments
There is one more complex, which is auto-closing HTML/XML-like tags, like |
I'd be happy to help implement this. I have started some work but before I continue I wanted to discuss a few things. There was a couple approaches I was looking at for changes to the
#[derive(Debug, Clone, Copy)]
pub enum Pair {
Single {
open: char,
close: char,
},
Multi {
open: &'static str,
close: &'static str,
},
} This could also apply if a separate struct for a single and multi character pairing was made, but I believe that is unnecessary as we can just have struct-like enum variants and an enum would probably have to be used anyways to we could keep the
#[derive(Debug, Clone, Copy)]
pub struct Pair {
pub open: &'static str,
pub close: &'static str,
} This would mean we wouldn't have to have to have an enum. In addition, Let me know your thoughts and suggestions! |
Any word, ideas, thoughts, or suggestions on this? |
I haven't done any work on Helix's code before, but it seems to be that the second option is by far the cleanest - the If I were you, I'd just give it a go and see what happens. Worst case, it doesn't work and you come away with more knowledge :) |
@bindsdev did you end up making any progress on this issue? Are you still working on it? |
I stumbled upon this issue, as I was just trying to configure the auto-pair |
Sorry for going slightly off-topic, but I can recommend using |
Found this thread after noticing quote pairs don't work with Python's f-strings. The chain of linked issues led me here. If the following config were valid, f-strings should work with quote auto-pairs. [[language]]
name = "python"
[language.auto-pairs]
'f"' = '"' Well, maybe at least. For instance, I'm not sure what would happen in this example:
This is the sort of thing where I'd be tempted to reach for a regular expression, e.g. Anyway, those are just my thoughts as a user. Up till now I've had to do next to no work to get Helix to work well with Python. Really enjoying it. <3 Just a bit surprised this didn't work out of the box, since f-strings are by far the more 'blessed' of Python's three mechanisms for string formatting. |
Sorry, I am just seeing this. No, I am not working on it anymore. Everything got busy. You are welcome to take it on if you'd like. |
Auto-pairs currently only work for single characters, like pairing
(
and)
. Multi-character auto-pairs are also useful in some languages. For example,```
pairs in markdown.The text was updated successfully, but these errors were encountered: