Lazy tips ? (Like Visual Studio) - zerobrane

I recently discover Löve and Zerobrane, I come from VB.NET on Visual Studio 2013/17 and I look for configure some tricks.
After some search, I write this in system preferences :
acandtip.fillups = " +-*/%.,(){}[]"
Whith it, auto complete is quick (generally, I accept suggestion and I use these keys to continue my line)
But I don't find preferences for this :
When I write "if true" and I press Enter, Visual Studio automaticaly write :
if true then
--my cursor is here
end
(Same trick on function, for, etc ...)
Another trick that I don't find :
When I write "a=b+c", Visual Studio automaticaly write :
a = b + c
It's very usefull when you read your code ;)
I'm french, maybe I don't find correct words on google to find these preferences.
Thanks for your read and maybe for your help :D

ZeroBrane Studio doesn't automatically add those whitespaces and doesn't add then end snippets when typing if true in the current version.

Related

Visual Studio 2013 VB intellisense

Apologies upfront if this is a silly question, but it's annoying me to no end and I can't figure it out.
I'm using Visual Studio 2013 Professional, and I usually code in C# where when using the Intellisense, when I press Enter to select a method or something it adds my selection and I can continue typing on the same line.
But at the moment I'm working on a project which is in VB.NET, and when I use the Intellisense in the same way it puts my cursor in the next line, i.e. I press Enter to select whatever, it adds my selection and starts a new line, so I have to press the Backspace to go back to the previous line. It's so annoying!
Is there a way to change this behaviour so the cursor doesn't go to the next line? I've looked at the settings available in Tools > Options but can't figure it out, and searching Google for anything similar hasn't been successful.
Found it here (paragraph List Members)
You have toggled to suggestion mode instead of completion mode.
You can also change to suggestion mode, in which only the text you type is inserted into the code. For example, if you enter an identifier that is not in the list and press TAB, in completion mode the entry would replace the typed identifier. To toggle between completion mode and suggestion mode, press CTRL+ALT+SPACEBAR or click Edit/IntelliSense/Toggle Completion Mode.
So, either use TAB/SPACEBAR (as I said in the comment) or press CTRL+ALT+SPACEBAR to switch back to completion mode.
EDIT: I've found out that whenever you type Stri (String will show highlighted in the list now) and you press . (dot) it will autocomplete and stay at the same line.
I think your way of doing this in C# isn't possible in Visual Basic.
I had the same problem and discovered that Auto list members was not enabled on my machine. It's under Tools > Options > Text Editor > Basic > General. This gave me the intellisense I was looking for.
Simple thing which can be used when you face this kind of issue is to press
tab key instead of Enter key when the IntelliSense provided me prediction list.

Is there a way to keep the VS 2010 VB.NET IDE from doing things that it thinks I want it to do?

Do this in VS 2010 with VB.NET:
On a blank line, type anything that isn't a variable, property, method, etc. I will use woo as an example.
Hit Enter or move the cursor up or down a line.
VS will add parenthesis to the end of it, turning it into woo().
Annoying, isn't it? Now insert foo in front of woo(), separated by a space like this: foo woo().
Move the cursor up or down (don't use Enter). VS turns it into foo(woo()), somehow drawing the conclusion that you want to pass woo() through foo(). What gave it that idea?
I know that the IDE isn't a text editor, but there are many times when I will want to paste in some text from a business requirements document or even some SQL and then comment it out after the fact. c# is great for this since it never assumes that I am trying to do anything, but the VB.NET IDE ends up parsing the holy love out of whatever block of text I paste into it and I end up having to edit out everything it added in.
Why does it do this? Can I tell it not to?
Unselect Pretty listing (reformatting) of code. You can find this under: Tools -> Options -> Text Editor -> Basic -> VB Specific

How do I output code while debugging in Visual Basic 2010?

When I'm debugging my application something is not right, and I can't continue.
So is it possible to see the output code of my app while I'm testing it to see what is wrong?
I open the output window but nothing happens in there it's just stay blank.
In two words: I want to see what my app is actually doing while I'm testing it.
I'm using Visual Studio 2010.
So is it possible to see the output code of my app while im testing it to see what is wrong?
Yes, but you actually have to output something, otherwise nothing will show up. In VB.NET (which is the language you're using if you have Visual Studio 2010), this is accomplished with the following code:
Debug.Print("Here is some text that will be output.")
The documentation for the Debug.Print method is here. In order to call it like that, you will also have to have imported the System.Diagnostics namespace. You do so by placing the following line at the top of your code file (with all the other statements that look like it):
Imports System.Diagnostics
The output will automatically appear in the Output Window. If you still don't see anything, ensure that output is not being redirected to the Immediate Window instead: Tools -> Options -> Debugging -> General -> uncheck the option "Redirect all Output Window text to the Immediate Window".
Confusingly, you use the word "code" in your question, saying that you wish to "see the output code of [your] app while testing it". I'm not sure if by "code" you actually mean "output", in which case the solution above will work for you.
If you actually mean code, as in your program's source code, then you can use the Break toolbar button (or press Ctrl+Break) in the IDE to pause the execution of your program. This will automatically dump you back into the code editor with the currently-executing line of code highlighted.
Visual Studio has some very powerful debugging tools. If you don't already have a general idea of how to use them, I strongly recommend picking up a book on either it or VB 2010 that will teach these things to you. They can be very confusing to learn by trial and error, but are not all that difficult if you have a good guide. Spend that time debugging your code, not figuring out how to use the IDE.

Move line Up/Down shortcut in Visual Studio 2012

In VS2010 I had a shortcut set up Alt+Up/Down to move lines of code up or down, just like I used to have in Eclipse in my Java days.
Now since Power Tools and macros (which is how I set up this shortcut in VS2010) are not available in VS2012, how do I get this to work?
I've seen somebody mentioned that Resharper can do this, but for the love of fire and water, I can't find the command names in the list of commands that can do that.
I have tried ReSharper_MoveUp/MoveDown and that does not move lines up/down:
This moves blocks of text up and down. I just want line-by-line up or down, no fancy logic there.
Before
After ALT+Up (when cursor is on WriteLine line) I would like to see this:
I have seen these threads: What's the equivalent for eclipse's ALT+UP/DOWN (move line) in Visual Studio?, Visual Studio: hotkeys to move line up/down and move through recent changes, but none of the suggested solutions work in VS2012.
Any other ideas?
UPD 7 Nov 2012: . Extensions are catching up with Visual Studio 2012. Now I know at least 3 extensions that provide this functionality:
MoveLine Extension. Link provided by Carl G
Move Line Extension with modifications to 2010 version. By gius
Productivity Power Tools 2012. Have not actually tried this, but this blog post states it does the line move up/down
UPD 15 Nov 2012: Just stumbled across another extension that claims it does what is required here. Have not tried it though: LineMan Extension
UPD 10 May 2015 Just installed VS2015 RC and this is built-in already:
For those who arrived on this question using Visual Studio 2013 or above, the feature is built right into the program. Just use AltUp and AltDown to move the line with your cursor—or the selected lines—up and down.
If you wish to rebind it in Tools > Options > Environment > Keyboard, the keys are Edit.MoveSelectedLinesUp and Edit.MoveSelectedLinesDown. You may need to remove your new combination from other existing keys first.
Update: huzzah, Productivity PowerTools VS2012 is now available and offers this functionality (along with another personal favorite, Tools.AddEndTokenAtTheEnd.)
MoveLine Extension (compatible with VS 2012; I had to manually restart my VS in order to see the commands in VS's keyboard shortcut tool.)
Install ReSharper.
Open Tools -> Options -> Environment -> Keyboard (as shown in a picture)
Find "ReSharper.ReSharper_MoveUp"
In "Use new shortcut in:" choose: "Text Editor"
Click in "Press shortcut keys:" and press your shortcut (for example Alt+ArrowUp)
Press "Assign" button
Same with with "ReSharper.ReSharper_MoveDown"
P.S. Works fine for single lines and multiple selected lines, but removes selection after moved 1 line. Hope there are way to move multiple lines multiple times in one selection.
If you have Resharper, then you can hit Ctrl + Shift + Alt + ↑ to move the current line up. or Ctrl + Shift + Alt + ↓ to move one line down.
This works in VS 2012 Premium with Visual Studio keyboard scheme in Resharper 7 (7.0.97.60 to
be precise).
Edit: This is mapped to 'ReSharper.ReSharper_MoveUp'/'MoveDown' commands.
In Visual Studio 2017(atleast) I have below
You can use Move Line Command extension.
Just follow formula349's comment:
I was able to get this working with 2012 as-is.
Rename the package to .zip and unzip all files into a folder. Edit the extension.vsixmanifest file and look for the SupportedProducts XML node. Change the Version="10.0" to Version="11.0".
Re-zip the folder contents and rename back to .vsix. Works great!
While a lot of people seem to be recommending misc. Visual Studio Extensions and Resharper, I would like to point out there is a native hotkey that accomplishes this goal. I came to this question trying to find the answer, as my Resharper replaced my default hotkeys with their MoveUp and MoveDown versions.
And while Resharper's hotkeys do move things up and down, they are not what the original poster are looking for, and they are not what I wanted. These hotkeys move methods and blocks of code, not individual lines.
Visual studio has two hotkey commands to move your selected lines upwards or downwards.
These hotkeys are:
Edit.MoveSelectedLinesDown
Edit.MoveSelectedLinesUp
I am using Visual Studio 2013 however, so I am unaware if these exist in an older version. If 2012 does not have these hotkeys then perhaps an extension is the only solution.
Either way, I had an issue locating the exact hotkey within visual studio's list and it took me a good while to find these, so I hope that my solution manages to help someone else in a similar situation to my own.
Shift+Del and then Ctrl+V
Shift+Del does the cut (same as Ctrl+X) operation on the current line on which cursor is positioned.
Then you can use Ctrl+V to paste it at any place you like.
Good thing is that you don't need to select the complete current line, just the cursor needs to be positioned on the line.
One downside to using this shortcut is that you won't be able to see the line moving ( up or down ) lively in front of your eyes.
ReSharper's move up and move down shortcuts are smart - instead of just moving the current line (which can easily result in broken code), it will move the current statement up and down in the list of statements that make up the method body. This is much more powerful than just moving a single line of code.
But this doesn't help you get your statement inside the if block. Here you need to do one of two things.
Firstly, move the statement above the if block, then use Ctrl+Shift+Alt+Right to push it down in scope. The statement will now be inside the if block, and you can use up and down to move it around in there. You can also use Ctrl+Shift+Alt+Left to pull it up in scope, outside of the if block.
Alternatively, you can put the text caret on the outside of the closing brace of the if block and use Ctrl+Shift+Alt+Down to move the brace down, stepping over following statements, including them inside the if block.
These keys can do a lot more than just move a single statement. If you put the text caret on a method or class declaration, Up and Down will move the entire method or class declaration up and down. If you put the text caret in the parameter list of a method, Left and Right will rearrange individual parameters (and then Alt+Enter can invoke the Change Signature refactoring).
More details in the help pages.

Disabling Intellisense Auto Line Return [duplicate]

When editing C# code in Visual Studio 2010, the ENTER key makes IntelliSense complete the current suggestion, without adding a new line.
In VB.NET, the default IntelliSense behavior for the ENTER key is to add a new line after completing the current suggestion.
How can I configure IntelliSense to change the VB.NET behavior to the C# one?
I already know that I could press TAB or SPACE, but out of habit I always end up hitting ENTER (and changing line).
UPDATE VISUAL STUDIO 2017:
Now with Visual Studio 2017 you can change it. Tools -> Options -> Text Editor -> Basic -> IntelliSense.
In Enter key behavior select Never add new line on enter
ANSWER FOR VISUAL STUDIO 2015 AND PREVIOUS:
If you want to avoid inserting new line on enter with autocomplete suggestion, just don't press enter. Instead of Enter press Space bar which completes your autofill and just inserts a space.
Or you may use this third party app:
Resharper makes it possible overriding Visual Studio intellisense and using its own intellisense. It is the only way I've found.
It has a 30 days free trial if you want to test it.
Unfortunately the set of trigger keys for intellisense completion is not a configurable item for VB.Net. There is no way in the default Visual Studio environment to change this behavior.
It would be possible to develop a plugin of sorts to accomplish this. However that's a pretty extreme measure.
EDIT
As of Visual Studio 2017, it is now possible to change this. See the answer below