Timeline for How can I prevent adding a TAB if inner block is already aligned, in `pine-script-mode`?
Current License: CC BY-SA 4.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 4, 2023 at 14:22 | comment | added | orgtre |
Ok, I edited it to move when there is nothing to do and point is before beginning of text (like in lisp mode). If you also want it to move when in text, remove the (when (< (current-column) tcol) part and its closing parenthesis.
|
|
Jan 4, 2023 at 14:19 | history | edited | orgtre | CC BY-SA 4.0 |
move point properly
|
Jan 4, 2023 at 14:13 | comment | added | alper | This works golden thanks a lot for the edit! Just small request :) when TAB is entered and there is nothing to do can cursor just move point to the beginning of text on the current line? | |
Jan 4, 2023 at 13:55 | vote | accept | alper | ||
Jan 4, 2023 at 13:54 | comment | added | orgtre | I edited the response with a version that tries to account for some keywords, but I think to do this properly takes more time. | |
Jan 4, 2023 at 13:52 | history | edited | orgtre | CC BY-SA 4.0 |
add alternative
|
Jan 4, 2023 at 13:24 | comment | added | alper |
Inside if or else if block indenting one level would be enough for the complete block. I think there is only if , else if and else . In python-mode this issue was handled but I was not able to make it what was working in python mode into pine-script . Indentation based on indentation of previous line is not helpful since there could be multiple lines in a condition block. I can ask new question related to this related to handle indention multiple lines for the if block.
|
|
Jan 4, 2023 at 13:01 | comment | added | orgtre | It is possible, but then how would you add a tab in the cases where you actually want a tab? I only know about pine-script syntax from the image in the Github repo you linked, but from that it looks like one would want further indentation quite often, e.g. after a nested if or for, so again one would have to make the script know about all keywords/syntax structures after which there should be extra indentation (maybe they are not too many?). On the other hand, indenting more than one level compared to the previous one seems never allowed so that is easy to implement. | |
Jan 4, 2023 at 10:53 | comment | added | alper |
Seems like Set indentation based on indentation of previous line. approach does not work properly when there is multiple lines under if statement. For example for if x == 1 line_1 = 10 line_2 = 20 additional tab is added before second line line_2 = 20 // it is also possible to prevent that as well?
|
|
Jan 4, 2023 at 9:52 | history | bounty ended | alper | ||
Jan 4, 2023 at 9:52 | vote | accept | alper | ||
Jan 4, 2023 at 13:25 | |||||
Jan 3, 2023 at 14:28 | history | answered | orgtre | CC BY-SA 4.0 |