My vscode does not execute code in "output", but in the console debug

Asked

Viewed 221 times

2

I’m learning to code in Javascript (Cod3r’s WEB Development Course by Udemy) and I’m having a lot of problems with Visual Studio Code, which I’ve been postponing for not being able to solve. The following problems are:

  1. Unable to execute code in "output";
  2. Unable to stop running code using Ctrl+Alt+M or Ctrl+Alt+N.

1 - This problem occurs when I run any and all code in Vscode, the course where I use the base, shows that the instructor runs his code and appears in "output", however in my always appeared in "Debug Console" when I press F5, which should be the right button. I never moved anything to fix, if yes, I failed and undone. However, one gambit I got was (look at the level) to lower the extension Node.js Exec https://marketplace.visualstudio.com/items?itemName=miramac.vscode-exec-node still running using F8 but it’s not what I want, because it doesn’t feel right. How to fix?

2 - This second problem occurs when I went to learn the commands of bind in Javascript, the following example was:

//Agora criando de uma outra forma usando diferentemente do ".bind(this)" 
function Pessoa(){
    this.idade = 0 
    
    const self = this //colocando uma variavel para this

    setInterval(function(){  
        //usando:

        self.idade++
        //no lugar de:
        // this.idade++

        console.log(this.idade)
    }.bind(this) , 1000)
}

new Pessoa 

(Please don’t mind the comments)

The instructor of the course that with Ctrl+Alt+M stopped running the code, but it does not happen even the Ctrl+Alt+N that is to continue. How to proceed?

  • Excuse me, Ian, isn’t Udemy’s instructor answering your questions? I’m doing Xamarin 2020 at Udemy and my instructor sometimes takes a while, but always answers the questions.

  • I thought that being a problem in Vscode I could solve here faster, I asked there to see what will happen. Thanks bro <3

2 answers

2


  1. Generally the F5 (Vscode) shortcut refers to Step Into in the Debugg process, this must be why your program appears in the Debug Console. To appear in Output, I recommend installing the Code Runner extension and trigger the shortcut Crtl + Alt + N. Another alternative to finish the program can be F1 + Stop Code Run.
  • 1

    It worked!!! Thank you guys. I wonder why it doesn’t work naturally without extensions. It is not normal for me an app not to be ready to be used (laughs). I thank you already.

  • 1

    That’s good! Some languages to be programmed in Vscode really need many extensions, it’s strange, but soon gets used. I hope I’ve helped in some way.

0

Uses the "Node.js Exec" extension. You need to download Node (on the internet nodejs.org) then install the extension, as soon as you install the extension (you need Node installed for it to work), you will go in your Pure Javascript code (do not try to use it with native things that only the browser can render, but if it is things like console.log, functions or applications Node it will work) and press the F8 button, it will open a tab and will run Node. If you want to customize (you want to) you can go to the installation tab of the extension and see some commands and settings to leave it the way you prefer.

It sounds like a lot of work, but it’s pretty quick actually, you follow the steps that work. Ah... and Vscode is just a super powerful code editor, as comfortable as it is for us, it doesn’t have the native obligation to replace your computer’s browser. Thank our community of modders who make these extensions that make our life easier.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.