hotkey for comment/uncomment lines/blocks

Bug #1251365 reported by swizzle
24
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Scratch
Confirmed
Wishlist
Unassigned

Bug Description

PhpStorm has the hotkey Ctrl + / which comments the current line or the selected block.
Of course every language has its own comment system but Scratch should be smart enough to put the right comment symbols
around the line/block.

PS: For commenting a line the cursor just needs to be in the current line itself. The line doesn't have to be selected.

Tags: plugin

Related branches

Changed in scratch:
milestone: none → 2.1
status: New → Confirmed
importance: Undecided → Wishlist
tags: added: plugin
Cody Garver (codygarver)
Changed in scratch:
milestone: isis-beta1 → feature-future
Revision history for this message
Julien Spautz (julien-spautz) wrote :

Little hint: gtksourceview knows what tokens the language uses for line and block comments, if the .lang file specifies this, ofc.

See: <metadata> on https://developer.gnome.org/gtksourceview/unstable/lang-reference.html
and http://valadoc.org/#!api=gtksourceview-3.0/Gtk.SourceLanguage.get_metadata

Haven't tried this, but it should work somewhat like this:

var line_comment_start = source_language.get_metadata ("line-comment-start"); // block-comment-start, block-comment-end

for C this would return "//", "/*", "*/" respectively.

Changed in scratch:
assignee: nobody → Julien Spautz (julien-spautz)
Changed in scratch:
status: Confirmed → In Progress
Changed in scratch:
status: In Progress → Confirmed
assignee: Julien Spautz (julien-spautz) → nobody
Revision history for this message
Antonio Camargo (antoniop-camargo) wrote :

Gedit already has a plugin that does this job. Couldn't it be ported to scratch?
Here's a blog entry describing the plugin: https://delightlylinux.wordpress.com/2015/05/22/code-comment-gedit-plugin/

The plugin code is here:
https://github.com/purpleidea/gedit-plugins

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.