I try to debug a Project in node JS with Visual Studio Code but i don't achieve.
I have built a simple project with the next commands:
express myExpressApp cd myExpressApp npm install npm
start
My file launch.json:
I select the Option “Launch app.js” in Window “Debug”. The application run without problems. I put a breakpoint:
I give in Chrome the address: http://localhost:3000/
Visual Studio Code says: “Pause on breakpoint”, but I don't see anything, I can press Continue and the application continues...
Edited: I use OS X 10.10 (I tested it and it works perfectly in Ubuntu.)
VSCode 0.8.0 has problems with node versions older than 0.12.0. Upgrade to at least 0.12.0 or wait for the upcoming VSCode 0.9.0.
When debugging with Visual Studio Code, there are many things you can do when you hit a breakpoint.
In order to go to the "debugging" view, you can either click the "bug" icon on the left or hit Ctrl + Shift + D.
You see Paused on breakpoint. in the Call Stack window. That window includes the callstack and you can double-click the different frames to navigate through the corresponding source.
You can also see the Variables window here to see the values of the variables (local/global/closure/etc.).
One of the more used functionality parts of debugging in VS Code is the debug console. In the debugging view, there's a little icon right next to the configuration that you're using that looks like the CLI character. You can either click that or just do a command palette search (Ctrl + Shift + P) for Debug: open Console. This will bring up the debugging console for your ad hoc debugging commands.
The documentation on VS Code debugging is quite robust, too, so I recommend you take a look at this.
Related
Recently, I switched my OS to Ubuntu. I just started with collage and I have to learn pascal for my finals. But a problem occurred.
I installed Visual Studio Code and Pascal extension for it, but I am unable to run even a simple Hello World code. I wrote code, it saved automatically as .pas, but when I enter debug & run option in VSC it displays a message that says 'Open a file which can be debugged or run.', followed by 'debug' and 'run' buttons that I am unable to click and another message that says 'To further configure Debug and Run create a launch.json file.'
I am not even sure am I supposed to post questions such as this one on stackoverflow, but I sincerelly hope that someone could give me a hint on what to do. Solve this within Visual Studio Code or switch to another IDE (and which one would you recommend for Linux user) and pretend that nothing happened?
Thanks in advance.
I know this isn't an answer to "how to debug with pascal with vscode" but, perhaps you would find it easier to just use FPC / Lazarus (IDE) to do your work. While it doesn't have a dark theme, contrary to popular belief, that's not necessary to program.
The IDE is feature packed and allows for full code completion, debugging, etc... (everything you really need to do the work for school).
Additionally, you can use this open source tool to install everything you need for your platform in just a few button clicks (also allows for installing common library packages)
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases
download release for your OS
under "FPC Version" & "Lazarus Version" select trunkgit (or stable for an older version)
click the "Install/Update FPC + Lazarus" button
Have you Installed Pascal extension which is available for code to smoothly run pascal code.
If you haven't then try installing this extension using,
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
ext install alefragnani.pascal
You can always check,
https://marketplace.visualstudio.com/items?itemName=alefragnani.pascal
to install and configure pascal in vscode.
I will direct you to the debugging page from the Visual Studio Code documentation that details how to use the debugger and configure a launch.json file. VSCode is a generic IDE so you need to give it some information about your project before it knows how to run the debugger. This is what launch.json is for.
If I could make a suggestion. When you're learning how to program, it's best to start with the basics. Write a small program in a text editor (VSCode is fine, or Vim, or Nano, or Notepad, or whatever). Save the file. Compile and run the program on the command line.
Once you put an IDE in the mix, you have to learn how to use that as well. If you're stuck on both parts, it can be hard to make progress. That said, it's good to learn how to use the IDE, and you should spend some time reading the documentation and working through some of the examples. It takes some time, but it will pay you back a thousand times when you can work more quickly.
I use:
print('Pls. show this line only');
to debug my flutter apps developed by Android Studio. However, the output in the [Run Tab] is usually something like:
Tens/Hundreds of system debug messages
I/flutter ( 9154): Pls. show this line only
Tens/Hundreds of system debug messages
OK, sometimes it takes me minutes to find my own debug message [Pls. show this line only].
My question is simple, how can we disable [Tens/Hundreds of system debug messages] in the Run Tab of Flutter Project in Android Studio?
Meanwhile, I am using:
print('***************************************************** Pls. show this line only');
as a work around.
In Android Studio....
Before
Settings
File > Settings > Editor > General > Console
Look for section:
Fold console lines that contain
Click the + button on right hand side of scrollable list
Add your substring of what you'd like hidden from the Console output.
For example in Flutter, I'd remove D/ (i.e. letter D + forward slash) which are emulator debug messages.
After
I Finally found a Workaround For VS code this is NOT permanent so you have to do it once per session but it helps a lot ...
there is a hidden feature in vs code for debug log filtering and all you need to do is to filter the log to have only the flutter related logs as follows :
1) focus on debug console (by clicking on it )
2) click ctrl + f (nothing will appear but you are now in filtering mode)
3) Type "I/Flutter"
4) hover on the word and click the icon next to it to make it stick .
that's it !
Before :
After:
In Android Studio:
select text you want to ignore in the console
Right-click it
Fold lines like this
Android Studio Flutter Console folding
Select the option as shown in case IntelliJ IDEs or Android Studio
Now you can filter as follows
The android-studio 4.0 has a setting to make this messages go away.
Go to File -> Settings -> Languages and Frameworks -> Flutter
Uncheck the box stating Enable verbose logging
Settings View
Add
I/flutter
in filter of VsCode Debug Console Filter.
Rather than filtering the logs, use the release version of the drivers :
flutter run --release
This will avoid printing all the system logs like :
V/MediaPlayerNative(22395): playback complete
And your debug prints will continue to display.
Drawback is you won't use anymore the hot reload. Reserved to investigate when the debug prints are flooded in system logs.
Of course applicable to VSCode.
I have updated my Android Studio to version 3.3.1, but now breakpoints are executing very slowly? First breakpoint take around 5 minutes to execute.
Can anyone please tell me what can I do to make it work like it was in the previous version?
I faced the same issue when I installed android studio 3.3.2. Any time I'd try to debug my app, it would run crazily slow. But finally got the solution as described below:
Go to the debugger and select view breakpoints
Make sure the Java method Breakpoint is unchecked.
It's often easy to add method breakpoints accidentally and That's usually the main reason behind the significant slowness of the debugging speed.
Follow the few steps below if that the case:
just remove all breakup points in your android studio.then automatically android debug will be fast.
remove all breakpoint step:
go to debugger then select red button it will pop up all debugger break point and then remove.
I'm now using the Visual Studio 2012, and now the keyboard shortcut for "ShowSmartTag", Ctrl + ., is not working. I googled a bit found someone said that CodeRush's Quick Nav shortcut is the same, so I disabled that command in CodeRush, but still I can not fix this. I also tried to disable all those suspicious extensions, but still no success. Any idea?
All keyboard shortcuts can be viewed from Tools > Options > Environment > Keyboard. What does your View.ShowSmartTag command say about current shortcuts?
If you try to assign CTRL + . to anything, it will tell you if the shortcut is used by something else...
In my case it was Web Essentials that caused this issue. I disabled it, and now all works well.
It's CodeRush that caused the issue and I uninstalled it, then SmartTag works again. My guess is that CodeRush replaced VS2012's built-in SmartTag entirely.
On my PC the problem occurs mostly when renaming a method or a parameter ...
To analyze this I have started a first VS 2012 instance without starting to edit the source code.
Then I have started a second instance of VS 2012 which must be attached to the first VS instance:
Debug->Attach to Process
Look for devenv.exe, Title = title of the VS main window
Select Managed and Native Code
Attach
Enable Break when exception occurs:
Debug->Exceptions
Enable C++ Exceptions, Common Language Runtime Exceptions
OK
Now as I started to edit a parameter name in the first VS instance, an error was thrown and the debugger in the second instance showed me an error in an memory Profiler Add-In.
After I have uninstalled the Add-in, the ShowSmartTag called by the keyboard works fine again.
I have the same problem with Ctrl + ., and I try this hotkey in anywhere of Visual Studio, but it is useless. My notebook is ThinkPad T430 made in Vietnam; I think this is an issue by the keyboard standard.
Maybe you should set another hotkey for "ShowSmartTag". For example, I removed the "NavigateTo" and added the Ctrl + + to "ShowSmartTag".
I don't see how to just run an app in Visual C++ Express. Debug option is right there but how about running the app? I checked each button on above and right clicked everything I could but I don't see the option to just run it? Without debugging. I don't mind debugging but I lose the console screen that main is running its loop in.
You can do this by pressing Ctrl+F5. Or you could add it as a menu item (found this on the www):
Tools -> Customize- > Commands tab -> Rearrange Commands -> Select Debug from Menu Bar dropdownlist -> Add -> Select Debug from Categories, Select Start without debugging from Commands -> OK.
The option might not be available by default on your toolbar, To set the Start without debugging button. You can goto and select Tools > Customize > Debug and then drag n drop it on your toolbar.
You can change the Solution Configuration to 'Release', which strips the majority of debugging information, but no matter what you do, if you execute it within the IDE it will take control of it to a certain extent.
If I want to run a console app without interference from the IDE I just open another command prompt, cd to the debug/release directory (as appropriate) and execute it from there.
Without going into the IDE, I know that with default keybindings(keyboard shortcuts):
Ctrl+F5 will start without debugging
F5 will start with debugging.