How do I run the canopy editor in blocking mode? - enthought

I would like to use the canopy editor as an external editor for a program. I need to be able to open the editor and block until the user saves and closes the editor. Right now, canopy returns immediately.
Is there a way to do that? Ideally it would be by running a python command that just opens the editor, and not the opening screen. Less ideal would be a way to test that the editor was still open.

Related

Where does the "Run Python" button at the top-right of the editor come from?

When opening a Python file in vscode, I see an overlay in the upper right corner of the window that allows me to directly run the program:
Where does this overlay comes from?
from an extension specific to Python?
from something that leverage tasks and allows for such display?
something else?
I am asking because it would be great to have such a shortcut in other programming languages (Go in my case) to quickly launch (something, usually to run a program)
This functionality comes from the ms-python.python extension.
You can verify for yourself: Disable the extension, then do the required IDE reload, then observe that that button is gone. Then enable the extension and observe that it is back.
There's even a corresponding command that you can use in the command palette: Straight from the extension docs:
Python: Run Python File in Terminal
Runs the active Python file in the VS Code terminal. You can also run a Python file by right-clicking on the file and selecting Run Python File in Terminal.
Note: Since you mentioned:
I am asking because it would be great to have such a shortcut in other programming languages (Go in my case) to quickly launch (something, usually to run a program)
Since this is functionality provided by an extension, you're "at the mercy" of whatever the extension devlopers actually want to implement, and whether such a feature actually makes sense for a given language.
Such a "run file" button would very natural for languages that lend themselves toward scripting, but less so for languages geared toward larger projects where it's not statistically normal for a file to "have a main function".

How can I use the "PowerShell Integrated Console" in VS Code?

I have the PowerShell extension installed under VSCode. When I open up a PowerShell script, VS Code automatically pops open a "PowerShell Integrated Console" window in my terminal. It's different from the normal PowerShell terminal:
It's better than the default one because keyboard shortcuts like Ctrl+Backspace to delete a word work. But when I try to open one of these fancy terminals myself, the option isn't there:
How can I get one of these improved terminals without opening a script file, and how can I get VSCode to use them automatically instead of the old PS terminal?
Note:
Normally, a PIC (PowerShell Integrated Console) is automatically created the first time you open a PowerShell source-code file for editing in a session.
The instruction below show to how to directly create a PIC, which may also be helpful if you need to restart it after a crash - though you're usually prompted to create a new one when that happens.
Instruction as of v2022.12.1 of the PowerShell extension for VSCode (Visual Studio Code):
Execute the PowerShell: Show Session Menu command from the command palette (Ctrl-Shift-P).
This will create a PIC and show a submenu, which you can simply dismiss with Esc.
Note: If the PowerShell extension was already loaded but the PIC has crashed, choose Restart Current Session from the submenu instead.
Additionally, you may assign a keyboard shortcut to the command, by clicking the cog icon on the right edge of the command palette entry.
Because the PIC doesn't have an external executable entry point you can not define it as a custom shell profile (at least as of VSCode 1.67.1).
GitHub issue #3918 discusses implementing simpler ways to activate / load the PIC on demand as a future enhancement:
Making the PIC show in the list of available shells (as shown in your question, analogous to the extension-contributed JavaScript Debug Terminal entry) is one of the suggestions, but the concern is that there can only be one PIC as of this writing, so such an entry would behave differently from other shells in the list, which create a new session every time.
However, this concern would go away if support for multiple PICs were to be implemented, which is being proposed in GitHub issue #2418.

Using Mobaxterm right-click paste, execute large blocks of pasted code one at a time?

I've been using MobaXterm for a while now, and frequently use right-click paste to execute small blocks of code at the Linux command line or in a Python interpreter. My intention is that each line should be executed one at a time, even if I paste several lines at once. This used to work fine, but recently the application behavior changed and now I have to hit enter after each line. I have checked and "Paste using right click" is checked in the terminal settings menu. Does anyone know how to change this behavior? TIA

How do programs like Emacs and Nano get user input while running in terminal without the user having to press enter?

Programs like Emacs and Nano can run in a terminal window and accept real time user input, how might I accomplish this myself? I am looking to use C++ but I can see this could require interfacing with the user's shell, in this case Bash. How can I take input (be it from the mouse or keyboard) from the terminal window without the user having to press enter?
My target platform is Mac OSX Version 10.13.5, but answers on how to do this on other platforms like Windows or Linux are also welcome.
These programs set the terminal to raw mode as opposed to cooked mode. Cooked mode is read a line at a time and is handled by the terminal driver, and raw mode is read a character at a time and is handled by the running program instead.
This Answer has more information.
This Repo is a simple project that implements this mode that you can learn from. man termios will also give you information about manipulating terminal modes.

Vscode attach debug output window

I do not want Vscode to open up another window while debugging. Is there a way to attach this window inside the IDE?
If the above is impossible, is there a way to choose a more usable terminal? The default terminal doesn't allow for text selection which makes it unacceptable.
Since VSCode is not an IDE, we do not have a built-in terminal.
I tried the terminals on OS X, Linux, and Windows. They all allow me to select and copy text (however on Windows it is through the 'Edit' > 'Mark' mechanism).
Andre Weinand, Visual Studio Code
The vscode forums have a request for an integrated terminal with a number of upvotes, i'd advise adding your voice to the chorus.
It's a must to output the debug console writes to an attached panel in Visual Studio Code. Click an highlight a word in the debug output console text to do a global project search to find all code containing that string. A common thing like tagging error blocks with a unique ID that gets output to the console when the error happens. Full text search of the project source code tree for the ID...