Snippets manager with treeview

snippets

#1

I would like to propose the support for snippets manager that allows adding and organizing snippets in a tree view to group them by categories.

This would greatly enhance the experience of reusing various functions and macros.

Proposed IDE solution:

Additional Pane in bottom_right corner where Plots, Help, Files are located would present a tree ordering snippets in various categories.

Double-click on the label, node of a of the tree would unfold the node
and if it is the lowest level, it would paste the snippet under the to the current script.

To create a new snippet one would left click the node parent node and choose: "create snippet: from_selection:?

Left click on a snippet would show a prompt if the user wants to "replace snippet with selection"

Physically on the disk:
the snippets would be organized as R script text files and categories as folders.

  • This would allow easily to import large amounts of snippets and categories from other sources.
  • It would also allow the programmer to reuse an existing code normally used for file navigation.

=========================
Similar solutions:
I have seen a similar solution in a software named LINQPAD where code snippets were organized by chapters in handbooks teaching programming whereby clicking a snippet pasted the example code from the chapter in the book,in the main script pane at the cursor location.
Note that RStudio community would use snippets for the same purpose, generate content with accompanying snippets. This solution would open new channel for communication and education.

A snippet manager would grow to be a knowledge base for the user. A tree view is often used to organize knowledge in other popular software and for managing files, a non-trivial example of a desktop application is WIKIDPAD, a text organizer written in Python which detects camelCase syntax to automatically create a link to a card with that camelCase name.


#2

Do you have an example of this used elsewhere? Would it mean they have to abandon the big text-box?

The RStudio IDE team put together this guide for how to submit ideas like this.


#3

Thanks and sorry, I updated my feature request.