Skip to content
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

Improvements to snippets with multiple lines from the same file #2385

Open
shaedrich opened this issue May 26, 2024 · 5 comments
Open

Improvements to snippets with multiple lines from the same file #2385

shaedrich opened this issue May 26, 2024 · 5 comments
Labels
T: feature Feature.

Comments

@shaedrich
Copy link

Description

Let's assume, we have a snippet, where we want to "collapse" the middle part

// we want this line
    // we don't want this line
    // we want this line

Currently, this can only be done with the block format

```
--8<--
my_file:1:1
my_file:3:3
--8<--
```

Benefits

It works but it could be improved

  • It would be just handy if we could write something like this
--8<-- "my_file:1,3"

or even something like

--8<-- "my_other_file:1:2,4:5"

Solution Idea

  • But where it really would be without any alternative, is when using with auto dedention (Unindent for snippets #1945). Line 3 would always be incorrectly be dedented. This could, if the previous solution is not wanted, be done by taking all snippets from the same file into account but I can see that this is not a very
@shaedrich shaedrich added the T: feature Feature. label May 26, 2024
@gir-bot gir-bot added the S: triage Issue needs triage. label May 26, 2024
@shaedrich shaedrich changed the title Improvements to snippet multiple lines from the same file Improvements to snippets multiple lines from the same file May 26, 2024
@shaedrich shaedrich changed the title Improvements to snippets multiple lines from the same file Improvements to snippets with multiple lines from the same file May 26, 2024
@facelessuser
Copy link
Owner

I am not certain if we will go in this direction. We are certainly not prevented from specifying multiple lines as it can be done in block format. With that said, I will not rule this out as a possibility at this time for the future.

@shaedrich
Copy link
Author

I never said, we were prevented of specifying lines. As I said, it can even lead to problems with dedention.

@facelessuser
Copy link
Owner

I never claimed you said it was not possible, I was just reiterating that this does not enable something that could not previously be done. This enables no new functionality per se, but is an enhancement to syntax. No one is blocked due this request not being fulfilled. Multiple lines are possible in the current framework. For this reason, it is likely less critical and would be lower priority. But I've left the idea open because I can see that it may be viewed as less cumbersome to some, assuming there are no conflicts with the syntax.

I will sometimes restate things so I can reference my comment without having to read the whole thread. It helps me remember my thinking at the time.

@shaedrich
Copy link
Author

shaedrich commented May 27, 2024

I will sometimes restate things so I can reference my comment without having to read the whole thread. It helps me remember my thinking at the time.

Thanks for the explanation 👍

This enables no new functionality per se, but is an enhancement to syntax.

Since it's your repository, you are free to change the label from "T: feature" to "T: enhancement" or whatever you like. I would have chosen that myself, but it wasn't an option when creating the issue and I didn't want to submit it as a bug report.

One way to solve the presented problem would come from #2217 if you happen to stumble upon a solution that works for you there. #2386 might present an alternative.

@facelessuser
Copy link
Owner

After giving this some thought, I'm okay with extending this. I'll probably implement something like this in the next release.

@facelessuser facelessuser removed the S: triage Issue needs triage. label Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: feature Feature.
Projects
None yet
Development

No branches or pull requests

3 participants