Is there a way to toggle word wrapping for the Output window in VS Code? - visual-studio-code

I've been working with large print statements in VS Code recently and was wondering: is there was an easy way to turn on word wrapping in the OUTPUT window rather than having to use a horizontal scroll bar?
In a situation where I'm printing a string with hundreds of characters, I would like it to be able to wrap around the output window properly.
There is an editor word wrap setting but I have not been able to find anything that actually affects the output window.

Related

VS Code : Format document is working weird on Flutter

When i click "Format Document" button inside of page, it looks like this,
From what I can tell, you are trying to solve the awkward line wrapping and deep nesting problem. When your code gets nested as deep as it is, it hits the column word wrap limit and the limit forces forces the formatter to break items that would normally be on one line into several. There are a couple things you can do:
Best option: Refactor your code and split it into multiple classes/ files. That will make it so that you don't have as deeply nested code and it will make it more readable as well as more maintainable.
Go to the vs code settings and search for Dart: Line Length and edit the value to set when the file starts wrapping content.

How can I have a fixed screen so that when I code I don't have to keep scrolling right in VS code or keep having to indent? [duplicate]

I want to use full viewport while coding in VS Code. But the lines are not expanding when i expand my VS Code window.
Any Fix ?
The correct configuration to use:
In order to configure V.S. Code so that the lines of code in
your editor will only wrap at the end of the view port, and
never before, you need to assign the correct value to the
setting: editor.wordWrap
There are 4 different values that can be assigned to the
editor.wordWrap setting. There is one that I believe
is exactly what you are asking for, however; 2 of the other
three could work too, so I will list them all, and suggest
the one I think will work best for you. The following are
the only "out-of-the-box" line-wrapping configurations that
VSCode supports, and they are as follows:
01|   "editor.wordWrap": "off"_
— Assigning off to the wordWrap setting will make it
so that your editors lines will never auto-wrap. The only
way a line will ever be moved to the next line is if you add
a line break — by pressing the [ENTER] key. — and
proceed to continue typeing text on the next line. This way
could work for you, because you get 100% control over when
the lines break.
02|   "editor.wordWrap": "on"
Assigning on to the editor.wordWrap setting makes it
so that that the lines of code in your editor will wrap
exactly where the viewport ends. No matter how big, or how
small the editor's viewport width is, the lines always
extend the entirety of the viewport, and never before.
NOTE: "on" sounds to me like what you were asking for
in your question
03|   "editor.wordWrap": "wordWrapColumn"
When you assign wordWrapColumn   —to—   "editor.wordWrap" the lines of code inside your editors view-port will wrap at what ever you set the setting editor.wordWrapColumn to. To be more specific, I'll give you an example.
if you configure wordWrapColumn so that it looks like the code-snippet below:
"editor.wordWrapColumn": 80
...then your lines will all wrap at 80.
This is by far the most popular configuration, as it is frequently coupled with 3rd party formatters, and linters, such as ESLint & Prettier. Prettier's printWidth setting, coupled with "editor.wordWrap": "wordWrapColumn", is an extremely reliable and consistent configuration.
4| "editor.wordWrap": "bounded"
— Last is "bounded", bounded is a mix between on, and print width. In a nutshell, lines will wrap if either of two conditions are true.
- First lines will wrap at what ever "editor.wordWrapColumn" is set to, just like the configuration example #3.
- Secondly, lines will wrap at the end of the view port.
To reiterate through what I just typed, lines wrap at _"editor.wordWrapColumn"'_s value, unless the view-port is smaller than the value of "editor.wordWrapColumn", in that case lines wrap at the view-port.
That's all...
You can add any extension in you VS code such as Beautify or Prettier. Or if you want to format the document you can simply use shortcut Shift+Alt+F.
If you want to merge multiline code into single.Follow the steps
1.Select all line you want to merge in single.
2.Press F1 and search for join lines.
3.Select join lines and press enter.
You can also create a keyboard shortcut for this command editor.action.joinLines
"editor.mouseWheelZoom": true
Adding this setting to your settings.json will enable zooming in when holding CTRL and scrolling. After you save settings.json with this setting, you can hold the ctrl key and scroll with your mouse or trackpad to zoom in which will make your code cover the full screen. If you want more focus, you can enter Zen Mode. It is a nice feature built into Visual Studio Code, which helps you to focus more on your code than the activity bar or other files. You can toggle zen mode with shortcut keys CTRL + K Z, Command palette, or View menu.

How to move selected code segment to the left in VS Code?

The question is, how do I move the selected block of code by one or several tabs, but not to the right (which is done by selecting a code and pressing Tab key), but to the left? Without selection each line one by one and deleting whitespace?
Moving parts of code from one place to another with differences in indent levels is a bit hard without knowing the shortcut.
What I mean (Imgur)
Thanks!
For what you want,
Shift+Tab
should do the trick. However, I would like to recommend this extension which I find easier to use when formatting blocks of text: Indent One space
Note however this extension only indents selections by exactly one space, forward or backwards.

How to use TextFlow

I am running netbeans 8.1 and scene builder 2.0 with javaFX 8.0. I have just started messing around with the TextFlow container recently. In my program, I have wrapped a textArea inside the TextFlow container, but I cannot figure out how to use my textflow to count the number of lines being displayed inside the text area. Some people recommend using "flowcomposer", but I do not seem to have the flow composer option for some reason, and I'm not really sure how to import it...
Text wrapping is set to "true" inside my textarea...unfortunately, this means I cannot programmatically count lines "as-is" by counting the number of newlines, since wrapped text does not include a newline character.
Ultimately, not only do I want to be able to get the number of lines being displayed, but I also want to get the current line or position my cursor at a specific line/scroll to a specific line.
What do you guys think? Is textflow and flowcomposer the way to do this, or am I barking up the wrong tree? If this is indeed a viable way to accomplish the goals stated above, why am I not being able to use textflow to get the lines?
Any help would be greatly appreciated!:)

How do I get a cursor on every line in vscode

I'm trying to use the multi cursor functionality of vscode on a large(ish) file.
the file is too large to select every line individually with ctrl-alt-up or down. In sublime-text I would select everything and push ctrl-shift-l. Is there a similar thing in vscode. I've tried using a regex search for ^, but that gives me an error stating "Expression matches everything".
The command Selection / Add Cursors to Line Ends altshifti will put a cursor on every line in the current selection. (For mac use optshifti)
Tip: You can pull up the keyboard shortcut reference sheet with ctrlk,ctrls (as in, those two keyboard combos in sequence).
(For mac use cmdk,cmds)
Hold Alt+Shift and select the block. Then press End or Right button.
You get selected individual lines.
I use version VSCode 1.5.3 in Windows.
Hold Alt+Shift+i
Hold Home (fn+-> Mac) for right-most or End for left most(fn+<- Mac)
This feature is actually called split selection into lines in many editors.
Sublime Text uses the default keybinding, CTRLSHIFT L
VSCode uses ALTSHIFTI
For Atom you actually need to edit your keymap to something like this
'.platform-win32 .editor, .platform-linux .editor':
'ctrl-shift-L': 'editor:split-selections-into-lines'
Real Lines vs Display Lines
First we have to understand the difference between Real Lines and Display Lines to completely understand the answer of the question.
When Word Wrap is enabled, each line of text that exceeds the width of the window will display as wrapped. As a result, a single line in the file may be represented by multiple lines on the display.
The easiest way to tell the difference between Real Lines and Display Lines is by looking at the line number in the left margin of the text editor. Lines that begin with a number correspond to the real lines, which may span one or more display lines. Each time a line is wrapped to fit inside the window, it begins without a line number.
Cursor At the Beginning of each Display Lines:
Cursor At the Beginning of each Real Lines:
Answer to the Question
Now that we know the difference between Display Lines and Real Lines, we can now properly answer the actual question.
Hold AltShift and select the text block.
Press Home to put cursor on the beginning of every Display Line.
Press End to put cursor on the end of every Display Line.
Press HomeHome (Home twice) to put cursor on the beginning of every Real Line.
Press EndEnd (End twice) to put cursor on the end of every Real Line.
Please understand that AltShiftI put cursor on the end of every Real Line.
Install the extension Sublime Commands.
[Sublime Commands] Adds commands from Sublime Text to VS Code: Transpose, Expand Selection to Line, Split into Lines, Join Lines.
(Don't forget to add the keybinding(s) from the extensions details page to your keybindings.json)
Doesn't VS Code already have a "split into lines" command?
Yes, yes it does. However it differs from the one in Sublime.
In VS Code, when you split into lines your selection gets deselected and a cursor appears at the end of each line that was selected (except for the last line where the cursor appears at the end of the selection).
In Sublime, when you split into lines a cursor appears at the end of each line (with the same exception as in VS Code) and the selection is divided on each line and "given" to the same line.
I have the same problem, i'm used to Alt + drag to do 'box selections' in visual studio but it does'n work in code.
It seems to be impossible for now to do it differently than by selecting every single line.
However plugins should be supported soon so we will likely see a plugin for this if not implemented directly by microsoft.
From visual studio uservoice forums:
We plan to offer plugin support for Visual Studio Code. Thank you for your interests and look for more details in our blog in the coming weeks. http://blogs.msdn.com/b/vscode.
For the preview we are looking for exactly this type of feedback. Keep it coming.
Sean McBreen – VS Code Team Member