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

Identation inside a multi-line string not aware of surrounding context #8446

Closed
leandrobbraga opened this issue Oct 2, 2023 · 1 comment
Closed
Labels
C-bug Category: This is a bug R-duplicate Duplicated issue: please refer to the linked issue

Comments

@leandrobbraga
Copy link
Contributor

leandrobbraga commented Oct 2, 2023

Summary

Would be nice if the context indentation level would be maintained while editing multi-line strings.

For example:

Vscode
vscode-indent

Helix
helix-indent

My guess is that Helix is using the current indent level of the surrounding function, instead of using the string's internal content indentation level.

NOTE: I tried with a new commit as well (4e86d1c), same behavior

Reproduction Steps

Create a multi-line string that have some indentation level, example:

fn my_function() {
    let query = r#"
    SELECT
        id|<- cursor here 
    FROM table"#
}

If you try to add a newline with "open-below" (o), the indentation will match the "let" level instead of the "id".

What happens

fn my_function() {
    let query = r#"
    SELECT
        id
    |<- here
    FROM table"#
}

What's expected

fn my_function() {
    let query = r#"
    SELECT
        id
        |<- here
    FROM table"#
}

Platform

Linux

Terminal Emulator

alacritty 0.12.2 (9d9982df)

Helix Version

helix 23.05

@leandrobbraga leandrobbraga added the C-bug Category: This is a bug label Oct 2, 2023
@leandrobbraga leandrobbraga changed the title Identation insde a string not aware of content context Identation inside a multi-line string not aware of surrounding context Oct 2, 2023
@kirawi
Copy link
Member

kirawi commented Oct 2, 2023

Looks like a duplicate of #6939 which is partially resolved by #8307

@kirawi kirawi closed this as completed Oct 2, 2023
@kirawi kirawi added the R-duplicate Duplicated issue: please refer to the linked issue label Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug R-duplicate Duplicated issue: please refer to the linked issue
Projects
None yet
Development

No branches or pull requests

2 participants