phaser on vscode launch - visual-studio-code

I've created a simple game using Phaser on vscode.
I read that i need to run it locally in order to run it on chrome and i can't manage to do so using vscode's F5.
when im on "index.html" and pressing F5 it pops out an alert box that says "cannot find progrem to debug".
pressing F5 while im on any other file causes a error in the debugger "window is not defined"(when im on phanser.js)/"Phaser is not defined"(when im on any other file)
how can i start this program correctlly ? sorry for the basic question .

http-server works just fine. But if you want to debug the game easily. You might want to follow the steps in this post: https://divillysausages.com/2015/06/09/using-phaser-with-visual-studio-code/
It is an instruction for setting up Typescript phaser development in vscode, but the steps that teach you how to set up node server also applies to a javascript usage case. If you want to make it easy to debug(pause code executing while game running, etc.) Try to set it up in that way.

Had to install http-server from npm and run it in terminal.
tried it before, but accidently installed it not globaly.
now it works. thanks!

Related

Why terminal becomes unresponsive after Parcel build?

I am following Parcel's "Building a web app with Parcel" to learn how to use it. The problem arises after I type in npx parcel src/index.html. The build runs fine and I can see the development server results just fine. The terminal becomes unresponsive afterwards. I can't type, quit, or anything. The only workaround is killing the terminal and restarting...which is very annoying. I've looked for answers, I've updated Node to the latest version, but to no avail. This doesn't happen when I use Webpack or any other time. Here is a screen shot just in case that helps. Could someone please help this unworthy noob out? Screen shot of terminal and VSCode
When you just run npx parcel, it starts a development server that will continue to run until you exit. This development server will watch for changes that you make as you develop and will reload your project, so you don't need to restart/rebuild every time you make changes.
The reason you can't type anything into the terminal (or, at least, that the terminal doesn't respond when you do) is that the development server is still running in that terminal. You have to exit the development server before the terminal prompt will re-appear and you can use it as normal.
To exit any program running in a terminal, you can type Control+C (hold down the Control key and hit the "c" key). This works for any terminal program, not just parcel. This will exit the development server program and you'll get your terminal prompt back.
There are other things you can do with programs (or "jobs") in the terminal window. You can read more about them here and here.
But you should use the development server to your advantage. Keep it running while you work. If you need to use the terminal while it's running, just open up another terminal window.
When you finally want to build your app/site, run parcel build instead.
You can read more about all of this here: https://parceljs.org/getting-started/webapp/

How To Fix VSCode: Exception has occurred: ReferenceError: closeDescriptionPopup is not defined

Not sure how this problem specifically occurred. I've been doing some googling trying to narrow down what exactly is going wrong as my project was fine a few days ago. When i attempt to debug my VSCODE project i'm presented with this error.
this is a picture of my launch.json file:
Also, this an error if it helps displayed in the debug console.
Things i've tried so far,
Rebooting the computer
Uninstalling and Reinstalling VSCODE as well as disabling extensions
Creating a new VSCODE Project to attempt to debug
Deleting the launch.json file and creating a new one
just delete the launch.json file and it will work again
After spending some time debugging I solved this problem by simply installing npm packages, I executed command npm i
Just make sure that your npm packages are all installed and none is failing.
Hopefully this helps you or someone with the same issue.
I've solve this problem.
Remove the launch.json file and do not replace it.
Just try to build with F5 button.
Start Debugging from within VSCode
run npm start from a separate terminal and wait for the server to start
refresh the page in your browser
My intuition is that this would create 2 instances of the server binding to the same port and cause a bunch of problems. I'm not sure why, but in my case it worked as expected and let me debug with breakpoints normally.
You don’t need to use the VS Code run button with Live Server. You just right-click the HTML file in explorer and use the menu option “Open with Live Server”.

What settings do I have to change to make Visual Studio Code automatically run files in the right directory?

Coming from IDLE, I am used to be able to just left-click python files anywhere, it'll launch IDLE, and then pressing F5 just runs the script. In VSCode however, I have to open the terminal, cd into the right directory, and only then can I finally run my python script. Is there a way to change this behavior?
I was recommended to use the Code Runner extention and bound the Run Code (code-runner.run) command to my F5 key.
Then I noticed input() not being ran so I had to make sure code-runner.runInTerminal was on, but that re-started my problem from the beginning because the terminal was at the wrong working directory and then I finally found the code-runner.fileDirectoryAsCwd setting to run it from there.
I think this solution is similar to this one for the python extention, but I'm not sure if that would cause the whole wrong working directory issue again.
choose from menu file then click on auto save

Angular ng serve asking to open app and not working

Problem Statement
When I try to do ng s -o in my terminal for my Angular app, it says, "How would you like to open this?" inside a popup box where I can choose an app, but choosing an app doesn't work.
Image of Problem
When I try to choose an app, it displays code. When I chose Chrome in the popup box, this happens:
The image shows that when I run an app after ng s -o it just displays code. Also, the tab title in the browser says "ng" when the code shows. Another thing, there is no error in the terminal...
Expected Results
I want to run my Angular app with ng s -o.
Actual Results
The app doesn't serve and asks to open an app.
Note: I am using Visual Studio Code for this.
The problem was related to my cli. I was using PowerShell when I was running ng, and for some strange reason, PowerShell stopped running ng and was asking me to open an app to run the file. Even though this never happened to me before and I was using ng and PowerShell just fine before. Strange!
Now I am using CMD instead. It now runs perfectly. So, I switched cli's from PowerShell to CMD in my integrated terminal in Visual Studio Code and it started working.
I got the idea to switch cli's from this: https://github.com/Microsoft/vscode/issues/28541
npx ng serve -o works for me in visual studio code.
The problem was caused as the Vs code was using PowerShell mode. By changing it to default cmd mode, the ng commands started to work.
The steps to change from PowerShell to cmd mode is as follows:
Press Ctrl + Shift + P to show all commands.
Type profile in the displayed text box to filter the list.
Select Terminal: Select Default Profile.
You will be prompted to select your preferred terminal shell, you can change this later in your settings or follow the same process as we do now.

Can't open VSCode from command-line WSL ZSH

So I decided to quit dual-boot and start using WSL. I'm having a problem and really can figure out how to fix it.
I simply can't open VSCode using the code command from the terminal when using an external terminal. When using the integrated, a command like "code ." works just fine.
Anyone knows how to fix it? It was working good a few steps of setup ago, but I lost track and don't exactly when that happened. I'm currently using HyperJS as terminal and my integrated terminal is already running zsh and it works when the VSCode is connected to WSL and when it isn't aswell.
Anyway, hoping for a fix, 'cause I'm really lost.
Thanks!
It's fixed and it was an easy fix, but it took long for me to realize that all I had to do was one step.
Here's the thing: the command "code" on the integrated terminal was working like a charm because the VSCode itself was running as administrator on Windows.
My Hyper wasn't running as administrator, so all I did was:
Right-click on HyperJS icon and go to the properties of the application
Switch to "Compatibility" tab
Check the "Run as administrator"
It's working without a problem now. Took me a while to realize that, but it's all good now.