Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#617 improve the management of the Snippets

open
nobody
None
5
2012-08-18
2012-08-18
Vinnie
No

I have two requests:
1) add tags to snippets.conf to allow writing code directly without any special formatting (like \n); this to make the code more readable and editable, exampe:
<no_format>
some
code
</no_format>

instead of this: some\n code

2)add an entry in the context menu that allows you to add the selected text in the file snippets.conf, example:
- select text
- contex menu--->add snippets
- windows with drop-down menu for choose section and text-box for autocompletition word

Discussion

  • Vinnie
    Vinnie
    2012-08-18

    Currently the code is unreadable and misbehaves with the automatic indentation, example of proposal:

    Current mode:

    _cl=void Cl(char colore)%brace_open%colore = tolower(colore);\n\n#ifdef linux\nswitch (colore)%brace_open%case 'k': cout <<"\e[30m"; break; //black\ncase 'r': cout <<"\e[31m"; break; //red\ncase 'g': cout <<"\e[32m"; break; //green\ncase 'y': cout <<"\e[33m"; break; //yellow\ncase 'b': cout <<"\e[34m"; break; //blue\ncase 'p': cout <<"\e[35m"; break; //purple\ncase 'c': cout <<"\e[36m"; break; //cyan\ncase 'w': cout <<"\e[37m"; break; //white\ncase 'x': cout <<"\e[0m"; break; //reset\ndefault: cout <<"\e[0m"; break; //reset\n%brace_close%#else\n#endif\n%brace_close%\n

    Suggested mode:

    _cl=<no_format>
    void Cl(char colore)
    {
    colore = tolower(colore);

    #ifdef linux
    switch (colore)
    {
    case 'k': cout <<"\e[30m"; break; //black
    case 'r': cout <<"\e[31m"; break; //red
    case 'g': cout <<"\e[32m"; break; //green
    case 'y': cout <<"\e[33m"; break; //yellow
    case 'b': cout <<"\e[34m"; break; //blue
    case 'p': cout <<"\e[35m"; break; //purple
    case 'c': cout <<"\e[36m"; break; //cyan
    case 'w': cout <<"\e[37m"; break; //white
    case 'x': cout <<"\e[0m"; break; //reset
    default: cout <<"\e[0m"; break; //reset
    }
    #else
    #endif
    }
    </no_format>

     
  • Vinnie
    Vinnie
    2012-08-18

    P.s. sourceforge removed the indentation and does not allow me to edit the message

     
  • Lex Trotman
    Lex Trotman
    2012-08-19

    The snippet files are parsed by Glib library code which does not support your suggestion.

    So Geany would have to have a complete parsing routine, maintained patches are welcome.

     
  • Vinnie
    Vinnie
    2012-08-20

    if I knew how to do, I would do it, but I can not do it, this makes me unable to use the snippets feature of geany, too bad!

    However, I will not change editor, I still think it's the best editor that is close to my use, meanwhile I'm trying to use cherrytree for pieces of code, it isn't light and it is not immediately and integrated, but better than nothing