Skip to content

[draft] Add snippets logic#180

Open
ILDaviz wants to merge 4 commits intomainfrom
features/snippet-logic
Open

[draft] Add snippets logic#180
ILDaviz wants to merge 4 commits intomainfrom
features/snippet-logic

Conversation

@ILDaviz
Copy link
Member

@ILDaviz ILDaviz commented Sep 30, 2025

This PR introduces a comprehensive "Snippet" management system, designed to improve productivity and code reuse within the application. Users can now save frequently used code fragments, organize them with names and tags, and quickly insert them into the active editor.

Saving Snippets:

  • The ability to save a code fragment directly from the editor has been implemented.
  • Users can select the desired text and save it as a snippet using the keyboard shortcut Cmd/Ctrl + Shift + S
  • A modal (SnippetSaveView) opens, allowing users to assign a name and tags to the new snippet for easy categorization.

Managing and Viewing Snippets:

  • A new button with the "Manage your snippets" has been added to the toolbar (Toolbar.vue) to access the snippet manager.
  • TheSnippetHistoryView modal offers a two-pane view with a list of all saved snippets and a preview of the selected fragment's code.
  • A search bar is available to filter snippets by name, tag, or content.

Editing and Deleting:

  • Users have the ability to edit the name, tags, and code content of an existing snippet directly from the management interface.
  • The functionality to delete a snippet has been implemented, with a confirmation modal (ModalConfirmation) to prevent accidental deletions.

Inserting into the Editor:

  • A double-click on a snippet in the list or using the "Add" button inserts the corresponding code at the current cursor position in the main editor

@ILDaviz ILDaviz changed the title Add snippets logic [test] Add snippets logic Sep 30, 2025
@ILDaviz ILDaviz changed the title [test] Add snippets logic [draft] Add snippets logic Sep 30, 2025
@saeedvaziry
Copy link
Member

Thanks @ILDaviz for the PR. I found it too difficult to use this feature. Can we work on the UX a bit?

Currently user needs to select a text and hit a key combinatino to open the save snippet. However I think it would be easier to just click the bookmark icon without selecting a text and in the bookmark modal we offer to save the current code as snippet or load a new snippet. or even replace the snippet with an existing one there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants