vscode.dev. Can I write to the console in some way? - visual-studio-code

Is it possible to write to a console on vscode.dev like with Console.WriteLine("Hello World!");
I'm trying to make some beginner C# tuts, and would like to skip the install IDE part in the beginning, and focus on the language for now.
I'm sorry, can't seem to find any info about this, other than:
"Run and Debug are not available in the web editor. To run and debug, you will need to continue in an environment that can run code, like a codespace or local VS Code."
I was hoping for a simple runtime like here learn.microsoft.com

No, it's not possible. As your cited text clearly states, vscode.dev cannot execute code.

Related

How to Compile and Run Everytime I use CodeRunner in VSCode

I have been using Code Runner extension to build and run c++, python, and java files in Visual Studio Code. But it doesn't actually compile the program every time I run it. It just Run the program. So, If I make any change, The output in the terminal doesn't get updated and doesn't show the changes I have made. The Code Runner just build the program once and that's it. What should I do to make "Code Runner" Build or Compile the program every time I run a program using "Run" or Ctrl+Alt+N?
Got it. Here is what I did to solve the problem.
Go to Extension Settings of Code Runner Find and Mark Save File Before Run.
Screnshot Here
I think I know what you are talking about, Go to the top menu and find performance, inside look for an option something like code runner run in the terminal, check that box and then you can give input to the program.

Input does not work in Visual Studio Code

So I just started learning programming and I think something is messed up with my code runner in Visual Studio Code. When I try to use input in Python I can not write anything in the terminal. This problem came out recently. It writes that when I try to input anything that it "cannot edit in read-only editor". I also checked in here what could be the solution, but it did not help. Input still does not work. I am on Linux, and I also tried to uninstall the program and code runner as well, none of them worked so far.
Ps: I tried the Code-runner: Run in Terminal box check method, which did not work at all.

Debugging Python Code, Visual Studio Code, Virtual Enviroments

I have been trying to configure the debugger on vscode for debugging python code. Below is the launch.json config and following are the settings.json and externalTerminal (launch.json) config, respectively.
I have read through the documentation but I am afraid I am not able to understand it. From what I read on there, I need to set up my external terminal configuration as the integrated terminal isn't capable of accepting inputs(yet).
I am using virtualenvs for my project and I have them in the path: usr/Projects/VirtualEnvs. All my venvs reside in there. I tried to set "python.pythonPath": "/usr/Projects/VirtualEnvs/myVenv/bin/python3.6" which doesn't seem to work. Could anyone help me out or at least point me in the right direction (would be a good learning experience)? Please let me know if my question isn't clear enough.
I figured it out!
My mistake: The python interpreter was not set for the script I was debugging, and since I was using a venv with different Python version, I was thinking that maybe I'd have to somehow set it to that version of the Python interpreter!
How I came to the solution?: Today, while studying and getting stuck with a problem, I noticed that near my shebang was line that said 'Set as interpreter'. I clicked that and VSCode told me that it was now using Python 3.6.1 as the interpreter, that kind of got me excited. Just to be sure I did a google search and found this video. That, very quickly, helped me understand my problem that firstly the interpreter wasn't set and secondly, I was running the debugger from the wrong file!
"program": "${file}",
"cwd": "${workspaceFolder}"
This setting takes care of which folder and what file for you!
For the External Terminal configuration, a new terminal window pops up and you can supply args to your input statement and watch as the debugger goes step by step!

Notepad++ using "Run" command in a macro

Is it possible to create a macro in Notepad++ that is able to utilize the "Run" command so that I may call an external .exe to operate on the file specified? I am able to do it manually, but when I create a macro that includes the run (F5) and give it a specified command it fails to execute. Is this because the run command isn't supported when creating macros? If so, is there a work-around method?
Thanks
edit: to add context -- I've written a couple ruby scripts to facilitate data-entry that's done using notepad++, and would like to integrate them to the editor. Having them run by a shortcut method created by recording a macro seems to be the best way to do this, unless it's not possible to utilize the run command.
FWIW The Zeus and Zeus Lite editors can do this.
You can do it with the NppExec plugin (available in the Notepad++ wiki ). It allows you to create mini-scripts with keywords that perform commands.
You will also be able to add your script in the contextual (right-click) menu, or assign a shortcut to it.
I personaly uses it to saves a sql file, place myself in the current directory, and then executes isql.exe (external executable) on that file. That simple script transforms my Notepad++ into a rather handy SQL IDE.
I don't think you do it using only Notepad++.
Please see this thread:
http://sourceforge.net/projects/notepad-plus/forums/forum/331754/topic/4805532
If I understood you correctly, you have it all set up but are having issues with running it through Notepad++'s run command?
If so, try what I mentioned here.
I had similar issues with running php compiler and resolved it with the "cmd /c" added like in that mentioned example. And a "& pause" at the end, just so I see what goes on.

Is it possible for Eclipse to terminate gently instead of using SIGKILL?

I'm using Eclipse on Windows, with the PyDev plugin for Python development. When I use 'Run' to start my application, it spawns a new Python (CPython) instance. When I use the 'terminate' button (red square), it kills the process. However, it appears to do a SIGKILL, so my shutdown handler is unable to clean up.
Is there any way to get Eclipse to send a SIGTERM, or simulate a keyboard interrupt (ctrl-c) from the Eclipse console?
Note: I'm aware there are other Python IDEs like Komodo or Wing that might solve this problem, but I'm not looking to switch over this.
Eclipse uses the Java Process API which sends the signal. This is a native API and there is no way to change that. I assume that you've tried to install a handler for SIGKILL, too, and that didn't work.
Therefore, the only solution would be to write a small batch file which lists the processes and sends SIGTERM to one of them. Invoke that from a command prompt. If you use Alt-Tab to switch to it, it's almost as comfortable as doing it from inside Eclipse.
Or write a plugin to invoke batch files.
I looked at How can a Java program get its own process ID? and came up with this.
System.out.println("kill -SIGINT "+ProcessHandle.current().pid());
I realize this isn't ideal if you don't want it printing this out for production but if you're just prototyping it's handy. Or you could put it inside an if that only runs if you're debugging.