How to increase the number of lines being updated in VS Code Jupyter output? - visual-studio-code

VS Code has a setting called "notebook.output.textLineLimit": n, that controls the number of lines shown in the tab under the cell (by default, it's set to 30).
However, this number only affects the number of lines shown that are executed first, with the number of new output lines that are updated being limited to 4, regardless of this setting. They show up after a "..." line.
For example, if you run:
for i in range(0,100000):
print(i)
You will see the first n-4 (where n is your "notebook.output.textLineLimit" parameter) i's show up and then only the newest 4 i's be continuously printed out. See screenshot here
I looked at all settings that showed up when searching for 'notebook.' and for '#ext:ms-toolsai.jupyter' and didn't find the one that controlled the number of last lines printed out.

Related

Visual Studio Code select same position above and below not the whole line before and after (see image)

I'm using visual studio code and run into a weird problem. I'm not sure how I got here - I could have accidently pressed a shortcut unknowingly.
I'm trying to select a phrase, link or anything that crosses multiple lines (whether the lines are true lines or due to word wrap). When I select multiple lines, it doesn't automatically select the text at the start and end between the two points. Rather, it just selects the length of text for that line and repeats it in the subsequent lines. See the image below to understand.
Image of issue
As you can see, I am trying to select the words from "the" to the end of "sub". Instead of selecting all the words between the two, it selects the text "the instru" and selects every line with the same amount of characters/length.
In order to show what I am expecting, I have pasted the text into Notepad and done the same thing.
What I am expecting
As you can see, all the words between "the" and "sub" are selected.
If anyone has any idea about how to fix this, I would be greatly appreciative.
Below is a copy of the text if the images don't display.
Follow the instructions below for a click guide to retire and/or add 'School'.
Best practice if there is a change in 'School' structure would be to 'retire' any existing school setup that is no longer required and add the new sub school information. The reason why we don't just edit existing school names (typically) is due to leaving historical data intact.
Try using ctrl+shift+P and typing "Toggle Column Selection Mode"

How to set vscode to display the number of selected lines?

Who knows how to set vscode to display the number of selected lines? Just like NotePad++, when we select many lines, we can see how many lines selected in the lower right corner, thanks!
Try this extension: Selected Lines Count
Without an extension, you have to resort to a workaround: use the command Add Cursors to Line Ends and observe the selection count. The default shortcut is Shift+Alt+I (i, not L).
Surely, you can find an extension. Till now, you can see in the Status Bar, how many characters you have selected. Take a look, at some extensions here.

How customize results in Recoll?

Please tell me how to display in the result sheet the full string of the word you are looking for, and not in pieces as in default in Recoll,I'll try in more detail:
I have recoll installed on my computer (which uses Xapian).
There are so many files.
I want to use recall as an alternative to grep
I indexed my data and search, but in the resultant window I do not like the output:
I want the whole row to be highlighted as if in a grepe, where I have the search word and output it immediately to the Result Sheet.
And now it looks like it gives out a piece of text where the searched word is found, but only partially, then it is divided by several points and again a piece of text, and again. You can see an example in the image, for example here (default settings) https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2018/01/Screenshot-Recoll.jpg?resize=768%2C596&ssl=1
This is how recoll works. It shows you "snippets" of text around the search hits. You can adjust the snippets parameters (size and number of context words) in the preferences Gui Configuration, Search Parameters section. You can also hit Preview, and then shift down/up arrows, to browse the result documents previews, for a more complete view.

Find an unsuppressed line in a large script

I am running a script which is fairly large. In the output screen I get ans = 10.
The problem is that the code is very large and I cannot pin point where this output is coming from.
Are there any tips to find the origin of this output within the MATLAB environment since I prefer not to have a random output on the screen?
In the case of a single script file, you can programmatically invoke mlint to return all warnings in the form of a struct:
L = mlint('my_filename'); % No need for .m at the end
Inspecting the structure you could see the following:
This structure has a field named 'message' which contains various issues, among which is what we're after - 'Terminate statement with semicolon to suppress output (in functions).'. At this stage you can run
find( strcmp({L.message},... % output is not suppressed on purpose
'Terminate statement with semicolon to suppress output (in functions).') )
Then inspect the line numbers that get printed.
Alternatively, if you want to skip the variable editor, or want to inspect a whole folder of .m files, you can run mlintrpt (in the case of a folder) or mlintrpt('plotWithoutOutliers') (in the case of a single file) and get a report in the following form:
As Luis said: look for the mlint error. In code this is shown as an orange shaded = and orange wiggle beneath it; on the scroll bar on the right it shows an orange line which you can hover over to see what the warning is and click on to go to the warning.
Additionally I included the red errors for completion. These will cause your code to be unable to run. Same here, red wiggle + red line on the right.
Last, the square on the top right, by the arrow, will either be green (no problems), orange (warnings, but the code will be able to run usually) or red (code won't be able to run).
Used Dev-iL's answer to create a simple function that will tell you the lines of code that are not suppressed. This way you don't need to inspect the returned lines in the structure L. Example: lines = UnsuppressedLines('isEven.m')
function [lines] = UnsuppressedLines( matlabScript)
l = mlint(matlabScript);
unsuppressedInstances = find( strcmp({l.message},'Terminate statement with semicolon to suppress output (in functions).') )
if isempty(unsuppressedInstances)
fprintf('No unsuppressed lines in script')
lines = [];
else
lines = {l.line};
lines = lines(unsuppressedInstances);
end
end

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