Bug 309657

Summary: Spaces are removed as fields are replaced with values
Product: [Developer tools] kdevplatform Reporter: svanur <svanur>
Component: snippetAssignee: kdevelop-bugs-null
Status: RESOLVED WORKSFORME    
Severity: normal Keywords: investigated, triaged
Priority: NOR    
Version First Reported In: 1.4.1   
Target Milestone: 1.3.0   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description svanur 2012-11-06 15:24:45 UTC
If I create a snippet for header files like this:
/**
 * @brief ${clsname} is a class that...
 * @namespace ${nsname}
namespace ${nsname}
{
    class ${clsname}
    {
        ${clsname}();
    };
} // namespace ${nsname}

All spaces will disappear in front of the placeholders and I wind up with code looking like this (substituting ${clsname} with MyClass and ${nsname} with mynamespace - leaving the class name and namespace name clamped to the keywords:

/**
 * @brief MyClass is a class that ...
 * @namespace mynamespace
 */
namespacemynamespace
{
    classMyClass
    {
        MyClass();
    };
} // namespacemynamespace


Reproducible: Always

Steps to Reproduce:
1. Create the following snippet:
/**
 * @brief ${clsname} is a class that...
 * @namespace ${nsname}
namespace ${nsname}
{
    class ${clsname}
    {
        ${clsname}();
    };
} // namespace ${nsname}
2. Invoke it and substitute ${clsname} with MyClass and ${nsname} with mynamespace 
3. You get  this:
/**
 * @brief MyClass is a class that ...
 * @namespace mynamespace
 */
namespacemynamespace
{
    classMyClass
    {
        MyClass();
    };
} // namespacemynamespace
Actual Results:  
/**
 * @brief MyClass is a class that ...
 * @namespace mynamespace
 */
namespacemynamespace
{
    classMyClass
    {
        MyClass();
    };
} // namespacemynamespace

Expected Results:  
/**
 * @brief MyClass is a class that ...
 * @namespace mynamespace
 */
namespace mynamespace
{
    class MyClass
    {
        MyClass();
    };
} // namespace mynamespace
Comment 1 Milian Wolff 2012-11-11 13:33:21 UTC
That works just fine for me, could you try with up2date kate and see whether you can reproduce it there? Also, your example is broken, no? You miss to close the doxygen comment.
Comment 2 svanur 2012-11-11 13:46:33 UTC
I'll try with an up2date kate and let you know - sorry about the non-closing doxygen comment, it was a typo in the bug description.  By the way - I'm working on Fedora 18
Comment 3 Andrew Crouthamel 2018-09-19 14:23:56 UTC
This bug has had its resolution changed, but accidentally has been left in NEEDSINFO status. I am thus closing this bug and setting the status as RESOLVED to reflect the resolution change.