VS Code, click to follow a file and line - terminal

Let's say I have a GCC compilation output in the internal terminal with a line like this:
/a/path/to/a/file.h:95: undefined reference to ...
the file is a link which is allowed to perform Ctrl + click to follow. It just jumps at the beginning of the file.
My question is then, is it possible to make it take the line number into the account? So instead of jumping to the beginning of the file, it would jump to line 95.

Related

Matlab script not displaying images (imshow)

As the title says, I have looked over my code and I don't see a reason that my script is not printing out the images. In particular, I have solution code that does print out the images and I don't see any differences in the code so I'm at a bit of a loss. The code does throw errors at unfinished lines, however there should still be printed images in the first few sections, the errors shouldn't interfere with that so I still don't know why they don't print out. My code is as follows:
EDIT: Some of my classmates have the same error, I suspect it might be a path issue but I'm not sure how to address that.
EDIT2: I've reformatted the post to be clearer, sorry for including extraneous parts of this code. The document is a .mlx file, hence where there is code and text interspersed. The code did not run when I used the "Run section" button, however if I copied and pasted the coded into the Command Window it would run without issue.
P = phantom('Modified Shepp-Logan',300);
figure
imshow(P);
imwrite(P, 'raw1.tif');
This section of the code seems to be working as expected when I tested it on MATLAB R2019b.
P = phantom('Modified Shepp-Logan',300);
figure
imshow(P);
imwrite(P, 'raw1.tif');
As an aside, all files will be saved to the current working directory unless otherwise specified.
Steps Taken:
To Run Script
Home Tab → New Script → Paste Script → Editor Tab → Run
and Give Script Save Name
To Easily Open Exported/Saved File:
Current Folder Side Panel → Right Click On File → Open Outside MATLAB
Results
Extension: Other Cool Tricks (to avoid running unfinished lines)
Using %% can be used to separate the script into sections. Each section can be run using the Run Section Button in the EDITOR tab or can be run using the command:
Windows: Ctrl + r
MacOS: ⌘ + r
Section 1 Code
%%
Section 2 Code
%%
Section 3 Code
Using MATLAB version: R2019b

Xcode Debugging - How do you tell what the next method call is?

I'm trying to figure out how to determine what the next method call will be in Xcode if I have a breakpoint set at a particular line of code. Is there a way you can tell what method is executed next? The problem with using "Step Over" is that sometimes it switches into that screen (I don't know what it's called) that shows you the hexadecimal values. I'm guessing it's some sort of screen showing you the byte code? I'm not sure how to get around that and go to the next method in the chain.
Simply look at the stack trace on the left side of the screen. The topmost line (line 0) is the function that you are currently in. The next line below that (line 1) is the function that called the current function and it's the one you will return to when the current function is done.
Look at that stack trace. Notice how some lines are bold and some are not. The lines in bold are functions that you have the source code for. Either code you wrote or code you have from any 3rd party libraries you are using.
If you are stepping through some of your own code and you get to the last line of the function, look at the stack trace. Look at line 1. Is it bold or not? If not, then there is no source code and if you enter that function you will see the assembly code (all that hexadecimal stuff).
Let's say line 0 (your current function) is your own code. Then you see that line 1 and maybe 2 is not in bold, but line 3 is and you want to get to your code in line 3. Click on the "step out" up arrow ( ↥ ) to finish the current function. That will take you to the line 1 (now it becomes line 0). Now you are in the assembly code. Just tap the "step out" button again. Tap it again until you get back to your own code again.
Just look at the stack trace to see where each click of "step out" will take you next.
The picture below is an example. Look at the stack trace. Line 0 is the function I'm currently in. It's named effective in my ViewController class. Note it is bold. Line 1 is the function that called line 0. Line 1 is my cellForRowAt method. It is also in bold. The debugger is currently on the last line of the effective method. If I do either "step over" or "step out" at this point, I will be leave the effective method and return to the point where it was called. Line 1 shows where that is. Since line 1 is in bold I know I have the code for it.
Once you leave the current function and return to the previous function, all of the lines in the debugger shift up. Line 1 becomes line 0. Now I know that when I leave my cellForRowAt method, I would be taken into code I don't have the code for (since that line in the stack trace isn't bold). In fact, as you can in the stack trace, there are no more bold lines until the stack trace returns all of the way back to main. So unless you want to see lots of assembly code, once you finish debugging in cellForRowAt, you may as well click the "continue program execution" button.

Visual Studio Debugging: How do I go to specific line without dragging the debug arrow?

I have a class with many lines in it. I can hit a breakpoint and then drag the yellow break arrow back to a specific line but it can be difficult to do this when the line of code you need is hundreds of lines away.
Is there a way to accomplish this by typing in the line number you'd like to take the arrow to?
Also, how do you jump to a line in a different class file?
Thanks in advance.
Right-click the desired line and select "Set next statement". Or you can use the default keyboard shortcut Ctrl+Shift+F10.
This feature can only be used to set the statement to another line in the same method/function, so you won't be able to skip to a different file.
You don't have to drag the yellow line just go to the line right click and select set next statement

Visual Studio\Python -How to move multiple code lines to right

Sorry for the silly question, but i'm trying to move my code right but doing it line by line.
Lets say my code is
if x==0:
print a
else:
if x==3:
and lets say i want to add new "if" in the begining of the code i need to take all my code right
so the new code will look like:
if y==3:
print y
else:
if x==0:
print a
else:
if x==3:
as for today i'm pressing "space" several time on each line to set it in the right place
I know that "ALT" and arrow take it up\down but coudnt fine the left right if there is something like that
thanks
Either move it line-by-line with TAB, or select several lines and use TAB. You can move them in the other direction with Shift+TAB. As already suggested you can also use Ctrl+K, Ctrl+F to auto-format.
In the visual studio settings you can decide whether the spacing consist of tab symbols or actual blank spaces and the number. Keep this in mind, as some file types don't like one or the other.
you can use Shift+tab to move the whole code 1 tab space

issue with debugged application output in gdb

I am doing my first steps with GDB in TUI mode.
During the debug session I see that each line outputted to console occurs in a single line (in the picture you see 222222 highlighted in red). It is like having an output pane of one single line.
On top of that, each \n doesn't cleanup that line so all the strings do overwrite each other making my output very confusing.
Can you help me a bit with this issue or point me to some key command to look for in order to have a clean output?
I also highlighted another area (in the picture 1111111) because the first string is outputted there and then all other on the frame of the source code window.
You can always refresh tui screeen every time your program outputs something with Ctrl+L key binding. Or you can temporarily swith to normal mode, step and watch program output and switch back to tui mode (Ctrl+X A). See all key bindings here.

Resources