For example I have a python file opened. I want to press a hotkey and it would instantly run this python file.
If for example I had a go file opened. I press the same hotkey and it would run this go file.
Thank you for any help.
Hi @nikitavoloboev , the default hotkey is Ctrl+Alt+N. To change the hotkey, go to the menu under File > Preferences > Keyboard Shortcuts, and change the keyboard shortcut for code-runner.run. Refer to https://code.visualstudio.com/docs/customization/keybindings#_customizing-shortcuts
Thank you, this works perfectly.
However there is an issue with running a go file :

Could you please try go run /foo/bar/main.go in your terminal?
Running go run in the terminal on this file works well.
How is the path of GO in your environment variables? Is it Users/***/go? Seems it should be /Users/***/go
The path is set correctly I believe.
This is however a folder outside the go src folder. Perhaps that makes a difference?
May be the root cause (the cwd is different). Could you try below setting (to run code in terminal of VS Code) and run again?
Go to File > Preferences -> User Settings, and open settings.json, and set like below:
{
"code-runner.runInTerminal": true
}
Ok, now it works when you run the code the first time. However if you run it again, it gets stuck and never finishes the second go run command for some reason :

Could you please simplify you GO file and try again? e.g. just fmt.Println('hello')
Same thing :

I have installed GO on my Mac. And it works on both terminal and non-terminal. I think this may not be related to this extension, since it is also working for JS in your environment.
It is really quite annoying. It go runs and gives the output for the first command. But it seems the second one gets run indefinitely and no result is shown.
I have to close the terminal and run again if I want to see output. :(
Most helpful comment
Hi @nikitavoloboev , the default hotkey is
Ctrl+Alt+N. To change the hotkey, go to the menu underFile > Preferences > Keyboard Shortcuts, and change the keyboard shortcut forcode-runner.run. Refer to https://code.visualstudio.com/docs/customization/keybindings#_customizing-shortcuts