Auto-commenting on newline, SublimeText - comments

Could someone point me how to make SublimeText insert comment continuation double-slashes when I enter a new line while inside a comment block?
// I have comments like this, and when I enter a '\n'
// it break's out of comment-entering mode
like this (drops slashes, cursor stays at leftmost column)
// and I want to have them automatically inserted after hiting '\n'
// like this
I might have changed that on accident while tweaking preference file, and I don't know how to set it back.
here is my user prefs:
{
"animation_enabled": false,
"auto_complete_commit_on_tab": true,
"auto_complete_delay": 200,
"auto_complete_size_limit": 2097152,
"auto_complete_triggers":
[
{
"characters": "<",
"selector": "text.html"
},
{
"characters": ".",
"selector": "source.python"
},
{
"characters": ".",
"selector": "source.javascript"
}
],
"bold_folder_labels": true,
"caret_extra_bottom": 1,
"caret_extra_top": 1,
"caret_extra_width": 0,
"caret_style": "solid",
"color_scheme": "Packages/User/base16-compact.dark (SL).tmTheme",
"copy_with_empty_selection": false,
"default_line_ending": "unix",
"drag_text": false,
"draw_white_space": "none",
"fade_fold_buttons": false,
"font_face": "Inconsolata",
"font_size": 10,
"highlight_modified_tabs": true,
"ignored_packages":
[
"Vintage",
"Diff",
"DocBlockr",
"Markdown",
"Shell Command"
],
"indent_guide_options":
[
"draw_normal"
],
"line_padding_bottom": 1,
"line_padding_top": 1,
"logging_level": "error",
"margin": 0,
"match_brackets_content": false,
"remember_open_files": false,
"scroll_past_end": true,
"scroll_speed": 0,
"shift_tab_unindent": true,
"show_encoding": true,
"show_line_endings": true,
"soda_classic_tabs": true,
"spell_check": false,
"tab_size": 2,
"theme": "Soda Dark.sublime-theme",
"translate_tabs_to_spaces": true,
"tree_animation_enabled": false,
"trim_automatic_white_space": false,
"use_tab_stops": true
}

The DocBlockr package adds this functionality. If you remove it from your 'ignored_packages', that should fix it!
(nb. I see from the comments above that this did indeed fix it, but I'm putting this here as an answer, because it's easy to miss the comments & took me a while to figure out that this functionality came from DocBlockr rather than Sublime Text itself)

just type this command:
CTRL + /
single line comments are single line, if you want to use another line use the multi-line comment.
/* */
to revert your preference:
remove all of the code on your user preference and replace it with {} and press CTRL+S to save it. it should do the revert.

If I'm understanding the OP correctly, what we want is, let's say we have this:
int foo; // a foo|
Treat the | as a cursor. And if we hit return at the trailing end of the line we automatically get
int foo; // a foo
// |
This is the functionality I've been trying to look for anyway. I found that the package DoxyDoxygen conveniently does this for me.

Related

Access Spock data provider variable from inside where: block

I'm trying to access a where block variable from within the where block and it is not working. I'm thinking Spock doesn't allow this, but thought I'd give it a shot and see if anyone knows how to do it.
where:
testNumber << Stream.iterate(1, n -> n).iterator()
test << Stream.generate(() -> { testNumber > 15 }).iterator()
Result:
No such property: testNumber for class
If this isn't possible and someone has an alternative way to accomplish something similar I'm open to that. Basically I'm trying to make this test easier to manage, because keeping track of multiple arrays of 15-20 booleans is a bit of a pain:
testNumber << [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
post << [false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true]
postWeekend << [true, true, true, true, true, true, false, false, false, false, false, false, false, false, false]
dividendReinvested << [true, false, true, false, true, true, false, true, true, true, true, true, true, true, true]
createCCB << [false, false, false, false, false, false, false, false, false, false, false, false, false, false, true]
ntd << [false, false, false, false, false, false, false, false, false, false, false, false, false, false, false]
But many of them I can set up based on the test number instead, if I can access it (and having the test number available also makes it easy to determine which test failed).
It looks like you want to calculate something based on testNumber.
You can use data variables for that.
Another problem is that you are using an infinite stream, which will not terminate before the jvm will run out of memory. So you need to either use .limit(20) or just use a groovy range to define it more succinctly.
import spock.lang.*
class ASpec extends Specification {
def "hello world"() {
expect:
testNumber > 15 == test
where:
testNumber << (1..20)
test = testNumber > 15
}
}
Try it in the Groovy Web Console.
If that isn't what you wanted then you should update your question as #kriegaex suggested to tell us what you actually want to achieve.
Please do not accept this answer, Leonard's one solved the original problem. I am just presenting some more details.
The Spock manual explains how to access other data variables inside a where block.
Additionally, if in another situation you only need the iteration index in the unrolled method name, but not inside the feature method itself, you can use #iterationIndex. The count starts at index 0. Here is an example showing you both:
package de.scrum_master.stackoverflow.q70661506
import spock.lang.Shared
import spock.lang.Specification
class ReferringToDataTableVariablesTest extends Specification {
#Shared
final n = 8
def "feature [#iterationIndex]: #testNumber, #testRange"() {
println "$testNumber, $testRange, ${testClosure()}"
expect:
true
where:
testNumber << (1..n)
testRange = testNumber + 3..2 * testNumber
testClosure = { -> testNumber / 2 > 2 }
}
}
Try it in the Groovy Web Console.
In my IDE, running the test looks like this:

How can I disable syntax highlighting in SublimeREPL, without setting syntax to plain text?

When I run a program in SublimeREPL, I often get highlighted backslashes '' which show up in pink.
I can work around it, but it's annoying and It would be great if I could disable it. I read on other posts that you can convert the syntax to plain text, but I like having colored words so would prefer not to do that. I just want to remove the pink highlighting.
Screenshot of SublimeREPL with syntax highlighting
Thanks all!
Go to Sublime Text > Preferences > Package Settings > SublimeREPL > Settings - User
(If your 'Settings - User' is empty, first copy in the contents of 'Settings - Default')
under "repl_view_settings": add:
this is the first option: first option is without syntax highlighting all in white color.
// standard sublime view settings that will be overwritten on each repl view
// this has to be customized as a whole dictionary
"repl_view_settings": {
"translate_tabs_to_spaces": false,
"auto_indent": false,
"smart_indent": false,
"spell_check": false,
"indent_subsequent_lines": false,
"detect_indentation": false,
"auto_complete": true,
"line_numbers": false,
"gutter": false,
"syntax": "Packages/Text/Plain text.tmLanguage"
},
enter image description here
this is the second option: second option is based on unix syntax highlighting.
// standard sublime view settings that will be overwritten on each repl view
// this has to be customized as a whole dictionary
"repl_view_settings": {
"translate_tabs_to_spaces": false,
"auto_indent": false,
"smart_indent": false,
"spell_check": false,
"indent_subsequent_lines": false,
"detect_indentation": false,
"auto_complete": true,
"line_numbers": false,
"gutter": false,
"syntax": "Packages/ShellScript/Shell-Unix-Generic.tmLanguage"
},
enter image description here

Remove header w/o losing resizeability

Here below the table i'm currently working on it. What I'm trying to achieve is to remove the header (A, B, C, ...) without losing the resizeability feature for the columns.
'config' : [
'columns': {
['data':6, 'type': 'numeric', 'readOnly': false],
['data':7, 'type': 'numeric', 'readOnly': false],
},
'copyPaste' : true,
'colHeaders' : false,
'fillHandle': false,
'manualColumnResize': true,
'colHeaders': true,
'wordWrap' : false,
]
Basically, once I set manualColumnResize = True the A,B,C Header appers. Is there a way to keep the manual resize without the header?
You have the colHeaders option listed twice. Remove the one that is set to true and it should remove the headers.
EDIT: I believe the resize functionality actually requires the headers. When you hover in between two columns' headers, you trigger the selector to expand or retract the size of the column. If you want to remove the (A, B, C) default header names, you can always pass a custom function to overwrite them:
...
// as function
colHeaders: function(index) {
return index + ': AB';
}
...

CKEditor Custom ACF disabling all plugins

I am trying to set an explicit list of allowed contents in my ck editor, but it seems that I'm not being inclusive enough in my list because almost all my plugins are disabled. If I set the ACF back to auto (delete allowedContent) then all the plugins come back. Here is my allowedConent in the config.js
config.allowedContent =
{
h1: true,
h2: true,
h3: true,
'span, p, ul, ol, li,': {
styles: 'color, margin-left, margin-right, font-size'
},
'a[!href,target,name]': true,
b: true,
u: true,
i: true,
}
Yet the only buttons that seem to be enabled are bold, underline, and italics. I'm trying to figure out why my other plugins aren't working. For instance, the link plugin has the following:
var allowed = 'a[!href]',
required = 'a[href]';
// Add the link and unlink buttons.
editor.addCommand( 'link', new CKEDITOR.dialogCommand( 'link', {
allowedContent: allowed,
requiredContent: required
} ) );
editor.addCommand( 'anchor', new CKEDITOR.dialogCommand( 'anchor', {
allowedContent: 'a[!name,id]',
requiredContent: 'a[name]'
} ) );
As you can see, I have anchor with the necessary properties defined (anchor with an href and name), yet the button doesn't show up! I have verified my syntax is correct by printing out CKEDITOR.instances["editor-1"].filter.allowedContent and it shows the object I'm expecting. I have also tried adding a bunch of common elements like to see if adding one of them brings the plugins back, but it does not. So what am I missing?
Well it seems that I was mixing my object syntax and my string syntax. Once I corrected this, the anchor and font-size buttons started appearing. The following is what I have so far:
config.allowedContent =
{
h1: true,
h2: true,
h3: true,
a: {
attributes: ['!href','target','name']
},
b: true,
u: true,
i: true,
// font-size
span: {
styles: { 'font-size': '#(size)' },
overrides: [ { element :'font', attributes: { 'size': null } } ]
}
}
I still need to figure out the proper definition for font-color and a few others, but that's just a matter of inspecting the plugins' code and seeing what they expect.

how to disable a particular column using handsontable in handsontable

How to disable a particular column using handsontable in handsontable.I want first column only editable other three columns get disable.I'm using readonly true for three columns but it's not work how to disable....
columns: [
{
type:'handsontable',
handsontable: {
colHeaders: ['EmployeeNo','EmployeeName','Department','Designation'],
data: manufacturerData,
columns:[{},{readOnly: true},
{
readOnly: true
},
{
readOnly: true
}]
}
},
{}]
In Project i do it with this line of codes.
cells : function(row, col, prop) {
var cellProperties = {};
if (col > 0) {
cellProperties.readOnly = true;
}
else
{
cellProperties.readOnly = false;
}
return cellProperties;
}
You can find working example of it on given link. but give example is for set a row to readonly. http://handsontable.com/demo/conditional.html
Your code is working properly. Please see JSFiddle with approach similar to you.
$("#test").handsontable({
startRows: 1,
startCols: 1,
rowHeaders: true,
colHeaders: true,
minSpareCols: 0,
minSpareRows: 0,
contextMenu: false,
fillHandle: false,
outsideClickDeselects: false,
removeRowPlugin: false,
currentRowClassName: 'currentRow',
currentColClassName: 'currentCol',
columnSorting: true,
colHeaders: ['Col1','Col2','Col3','Col4'],
columns: [{},
{readOnly: true},
{readOnly: true},
{readOnly: true}]
});
Working link : http://jsfiddle.net/rvd61fuy/
Let me know, if you are facing anyother issue.
To disable you could make the cell/column readonly and maybe even set the background color to a grey(to give a special effect).Both the methods i.e the one where you use readonly:true in the column declaration when initializing the handsontable and also the one where you use cell properties and use conditions to determine if you need to set a cell to read only when the table is being rendered,both methods seem to be working for me.You need to instantiate your HOT correctly, that may be the problem. Also when using cell properties you needn't use cellProperties.readOnly = false as by default the cells are not read only unless you have coded for that seperately. If you need further assistance let me know.
Also check that you have the latest version of handsontable. I ran into problems trying to implement readonly on cells which had checkbox columns with erratic results.
Using the version below solved my issues (below is what I used in my HTML page)
<script src="http://docs.handsontable.com/pro/1.9.0/bower_components/handsontable-pro/dist/handsontable.full.min.js"></script>
<link type="text/css" rel="stylesheet" href="http://docs.handsontable.com/pro/1.9.0/bower_components/handsontable-pro/dist/handsontable.full.min.css">

Resources