#19416
QiaoJiao
Participant

Sweet and simple (actually, totally based on Emura code with my brute force comment check).
I assigned it to ctrl+q

if( document.selection.IsEmpty ) {
	editor.ExecuteCommandByID(4154);  // select

	// if line has comment sign
	if ( document.selection.Text.substring(0,2) == '//' ) { // change to (0,1) and '#' if you use #
		editor.ExecuteCommandByID(4372); // uncomment
	} else {
		editor.ExecuteCommandByID(4371); // comment
	}

	document.selection.Collapse();  // unselect
}