Collapsing includes blank lines in Notepad++ when scripting in Vbscript - vbscript

When I wirte the following example code (in VBscript) in Notepad++
dim X
X = Array( "string1", _
"string2", _
"string3" )
Wscript.Echo X(1)
it looks as follows:
As you can see, the three blank lines are inside the code block which one can collapse and uncollapse, which is an annoying behavior. I'd rather have these three lines outside the array group like here, but without REM:
Is there a setting of Notepad++ I am missing to get the desired behaviour?

You can utilized custom language defined settings to make custom fold begin and end objects. This will allow you to insert start and end paramaters within your code so folding done by your configuration.
Here, the language is set to VB and includes the blank spaced lines.
Click on the User Defined Languages Icon(sorry for bad drawing....).
Here, i've saved the user language as Custvbs and applied '{ and '} as my start/end blocks for folding. There is an additional field for secondary folding labelled Folding in code 2 style (seperators needed)
And here is the resulting custom fold:

How about removing the surplus blank lines. You can do this by selecting TextFX -> TextFX Edit -> Delete Surplus Blank Lines

Related

Beyond compare ignore one side comments

I found some instructions on how to show/hide differences in comments using beyond compare. However most of the answers show how to set comment as important text or not. That is, if a portion of code is commented on both sides then check if the comment are different or not.
I would like to ignore when only one side of the comparison is commented. In other words if I have
# # line1
# line2
on one side and
# line1
line2
I would like both lines to be marked as "unimportant differences" (if indeed the text is the same, otherwise to be marked as differences).
Beyond Compare will only compare text if it is of the same grammar element type. If one side is regular code and the other side is a comment, it will always mark it as an important difference.
To make regular text on one side and the same text commented on the other side show as a match, you'll need to edit the definition of a comment in the file format.
To edit a format, open Tools > File Formats.
Select the format that matches your files.
Go to the Grammar tab.
Select the Comment grammar element, which might be defined as # to end of line.
Click the Edit (gear) button.
Set the Category radio button to Basic.
Text matching: ^#\s
Check Regular expression.
Click OK, then Save.
The updated file format will treat # followed by a whitespace character as an unimportant comment, the remaining text in the line will be treated as regular text and compared to the other side.

Beyond Compare 3.3.10 ignores checkboxes for 'leading whitespace" and "embedded whitespace"

I would expect that Beyond Compare would ignore differences based on tabs vs spaces if in the Session Settings/Importance Tab, I check the boxes labeled Leading Whitespace and Embedded Whitespace while comparing text files using the default format. Neither checked nor unchecked causes those differences to be ignored.
What am I missing?
The checkboxes there are controlling what's important to the comparison. Whitespace will be important if they're checked and unimportant if they're unchecked. They do only affect text that doesn't match something else in the grammar though. If you're comparing C++ code, for example, and the whitespace occurs at the end of a comment line it will be classified as a comment instead.
Assuming it's classified as "unimportant" correctly, BC will still show it as a difference, but will show it in blue rather than red. You can hide unimportant differences using the View->Ignore Unimportant Differences menu item, which will make them appear using the matching coloring and filter as such.
If you're still having trouble you'll have better luck getting support if you email support#scootersoftware.com or post in our support forums at http://www.scootersoftware.com/vbulletin/ with a bit more information.
Go to: Tools -> File formats -> Grammar. Add a grammar item (the +) and then mark the Regular expression check box.
There you can add a regex matching the items you want and define the severity of them.
In general, this is very useful when you have some differences that are not important to you.

Single Space Indent

Sometimes when i'm working in visual studio, I end up with a block of code that I need to indent a single space in order to make it align completely.
A normal sized indent would be done by selecting the text and pressing the tab key, however if I just want to move it along one space, selecting the text and pressing the space bar overwrites the code.
I know I could do this this by changing the tab spacing option so the indent size is 1, indenting the text and then changing it back but this seems a bit longwinded...
I've had no luck searching, so I've written a macro to do the above, but I thought i'd ask on here before i resigned to using it just in case the function/shortcut already existed...
Edit: Macro moved to answers
Here is said macro for anyone interested:
Sub SingleSpaceIndent()
Dim textEditor As Properties
textEditor = DTE.Properties("TextEditor", "AllLanguages")
textEditor.Item("IndentSize").Value = 1
DTE.ActiveDocument.Selection.Indent()
textEditor.Item("IndentSize").Value = 4
End Sub

TextExpander Whitespace Issue When Programming

I am an avid TextExpander for Mac user. I use it to expand code across multiple text editors. I have had one issue that I wanted to run by fellow programmers who use TextExpander for possible solutions.
When I am expanding multiple lines of code on a line that has leading whitespace, TextExpander resets the leading whitespace on all lines beyond the first one.
Example:
If I am trying to expand a debug snippet I use all the time, from an indented line, it appears like so.
echo '<pre>';
print_r();
echo '</pre>';
The first line is indented because that is where I typed the expand abbreviation. Is it possible to maintain the leading whitespace status across all lines?
echo '<pre>';
print_r();
echo '</pre>';
I'm afraid TextExpander can't mimic the auto-indent behavior of your code editor.
If you always enter these at the same indent level, please note that you can use option-Tab to insert a tab when editing a snippet in TextExpander's snippet editor.
If your code editor respects the indent level of formatted text, you could instead change the snippet type from Plain Text to Formatted Text, Pictures using the popup above the snippet editor then choose Format -> Text -> Show Ruler to show the text view ruler, which works the same as in TextEdit and other apps.
If you'd like further assistance, write us at: support#smilesoftware.com

How can I hide result of evaluation in Mathematica?

example:
Array = Range[1000]
I'll see 1000 numbers. Could I hide this output?
In Maple this problem solve by adding a ":" at the end.
First, in Mathematica you should not use capitalized variable names. The value "Array" is a built in function and Mathematica will not let you assign a value to it.
The answers above are completely correct, but there is another answer which some people might like. The Mathematica front end reformats output that it thinks might be hard to read. For example,
array = Range[100000]
will not print a giant list but instead will print:
"A very large output was generated. Here is a sample of it:"
It will then show only the beginning and end of the list with an ellipsis of sorts. Try it out. You will find 4 buttons beneath the output reading:
"Show Less", "Show More", "Show Full Output", "Set Size Limit..."
Their meaning is pretty clear. You can change Mathematica's option which tells it at what size to consider the output too big to put on the screen.
You can find this option by clicking on "Set Size Limit" or by going to the Evaluation Tab in the Preferences menu. The Preferences menu is found under Edit>Preferences or Mathematica>Preferences if you are using a Mac. In this dialog you will find a field called "Maximum output size before truncation". Here you can specify the number of bytes Mathematica can put on the screen before it should truncate your input for easier use.
Array = Range[1000];
The ";" hides the results in Mma.
HTH!
End the command in a ; like so:
Array = Range[1000];
Useful links:
The Mathematica help page on ;
you put a semicolon at the end. (eg: ar=Range[1000];)

Resources