[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#61578: 30.0.50; c-ts-mode feature request intendation pragmas
From: |
Ergus |
Subject: |
bug#61578: 30.0.50; c-ts-mode feature request intendation pragmas |
Date: |
Fri, 17 Feb 2023 18:01:44 +0100 |
This is a feature request related with:
f1f571e Add electric indent for preproc directives
c-mode had by default the [0] indentation for #preprocesor directives,
but there are some use cases where that behavior is not desired (i.e
#pragma).
Actually there are even multi-line pragmas when using OpenMP and similes:
int main()
{
#pragma omp parallel for first private(x) \
shared(y) etc
for (...) {
....
}
#pragma omp parallel
{
#pragma omp task
{
...
}
#pragma omp taskwait
}
}
In these cases the pragma in column zero will very confusing.
Some years ago Alan added a new mode (c-toggle-cpp-indent-to-body) which
worked around this issue.
At that moment I requested the possibility to make #pragma a syntactic
symbol to control its indentation consistently like anything else in
c-mode (C-c C-o and +, ++, -, 0 or [0]). But such approach required too
many changes in c-mode, so he offered this "toggle" solution.
Now with three-sitter, is it possible to add some way to produce the
desired behavior? Either with a mode as it is in c-mode; or (probably
better) by adding some syntactic entry like: (node-is pragma) in the new
ts-mode indentation function?
I prefer the second one because it seems more consistent with the rest
of the syntax, and not an exception. But I am fine with any solution.
Best, and thanks in advance,
Ergus
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#61578: 30.0.50; c-ts-mode feature request intendation pragmas,
Ergus <=