Bug 423352 - Snippets should be able to turn off automatic indenting
Summary: Snippets should be able to turn off automatic indenting
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: plugin-snippets (show other bugs)
Version: 18.12.3
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-22 10:04 UTC by Alan Prescott
Modified: 2022-04-24 12:53 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Prescott 2020-06-22 10:04:44 UTC
SUMMARY
Inserting a snippet into the code follows the indexing rules for the language. When the language is Python it makes a mess of indenting because there's no way to detect end of block.
The indenting gets really messy very quickly with multiple if .. elif .. or try ... except blocks.

If individual snippets could temporarily switch of automatic indenting - or, even better, set the same indenting for each inserted line then the snippet could be set up with indenting as required and could be inserted verbatim.

STEPS TO REPRODUCE
1. Set up a snippet for a Python script as:-
<code>
def my_func():
    """my example function
    """
    if True:
        print('True')
    else:
        print('False')
    return True
</code>
2. Insert snippet into Python 
3. 

OBSERVED RESULT
<code>
def my_func():
    """my example function
    """
    if True:
        print('True')
        else:
            print('False')
            return True
</code>
Producing an indentation error in Python/pylint

EXPECTED RESULT
<code>
def my_func():
    """my example function
    """
    if True:
        print('True')
    else:
        print('False')
    return True
</code>

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Alan Prescott 2022-04-24 12:53:15 UTC
Currently running Version 21.12.3 of Kate and this has been implemented. Thank you, thank you, thank you :-)