Why can't I continue executing Julia code in the VSCode REPL if I hit CTRL+F5? - visual-studio-code

Under Visual Studio Code (VSCode) with the Julia extension there are two REPLs. One is the standard REPL that comes with Julia. The other is some modified REPL provided by VSCode. This modified REPL has some advantages over the standard REPL.
I found two ways of running a program in the VSCode REPL. For both the first step is to select the file containing the code in the VSCode editor. The second step could be either one of these:
Hit CTRL+F5,
Click on an arrow (a triangle) that points rightwards and sits on the right-hand side of the bar with tabs at the top of the code editor.
Method 1 Is more convenient, especially since Method 2 sometimes does not work and has to be repeated.
However, there is a strong disadvantage to Method 1: After the program executes I get the message:
Terminal will be reused by tasks, press any key to close it.
After this I cannot execute code in the REPL since hitting any key indeed closes the Terminal.
This does not happen when the program is started by Method 2: after the program runs I can run Julia code in the Terminal.
Is there a way to have Method 1 work like Method 2?

Related

VSCode Integrated Terminal With no Word Wrap Still Inserts Line Breaks (but with no Carriage Return)

I would like to turn off word wrap in my vscode terminal so I can more easily view compiler messages.
e.g.
Imagine this is a very long line generated from a compiler and it has a lot of information and when it word wraps it is very hard to read so I would like vs code to just have a scroll bar at the bottom like SO has here.
However, after attempting several different methods of disabling word wrap, what is actually generated looks like:
Imagine this is a very long line generated from a compiler and it
t has a lot of information and when it word wraps it is very hard to read so I would like vs code to just have a scroll bar at the bottom like SO has here.
(extra t on the second line is intentional)
So it appears that I've managed to turn off word wrap internal to vscode, but something is still causing a carriage return (with no line feed), I think?
These messages are produced by running a C++ build task in the integrated terminal that in turn calls cmd.exe to run a script (e.g. cmd.exe <build command script>
Here is what I've tried so far:
First thing I tried was turning off word wrap in vscode (alt + z, or View > Word Wrap). This led to the weird line break described above.
I was suspicious that cmd was the one causing this weird line break, so I disabled "wrap text output on resize" and set the screen buffer width manually to 1000 (1000 >> greater than any of my output lines) within
command prompt properties for both "properties" and "default". I then tested the same command running in my vscode terminal and it worked as expected in the cmd terminal but still not vscode.
I was suspicious powershell (which I think vs code uses in it's integrated terminal?) was the one causing the line break, so I set the properties the same as in the cmd image above. Again this worked as expected in the powershell terminal, but still not vscode.
Following this, I changed the "terminal fixed dimensions" using the command from the command pallet and set the width to a matching column width of 1000 (leaving row empty for "automatic").
I've tried restarting vscode and my pc between several of these steps with no change.
What could be causing this behavior inside of the vscode terminal?

VSCode Intellisense Completion - Assembly Language

I'm using VSCode to write in 6510 assembly language for C64, and I'm running into a problem with Intellisense. I'm using the Kick Assembler C64 for VS Code. So I expected the 6510 assembly mnemonics to be recognized, which it seems like they are. The problem I'm running into is after typing the three letter opcode mnemonic and hitting tab to select it, the cursor moves one space past it (which is fine), but then Intellisense immediately starts making suggestions, so that I cannot hit the tab key again to create the space I'd like between the opcode mnemonic and the operand.
Is there a way to make Intellisense hold off on making suggestions until after I've typed that first character of the operand? I'd rather not turn it off completely and slow myself way down.
Thanks,

How to exit the command but not the interpreter?

I wrote some code in stk like this :
STk> (+ 2 3 ]
]]
||))
However, this is wrong. I'm not able to either correct this by going to the previous line or get out of this command. The only way seems to be Ctrl+Z but that takes me out of STk and everything I've done in it is gone.
Is there a way I can be inside the interpreter and continue programming without having to exit the interpreter if I've made an error like the one above. My terminal is Xfce4 Terminal 0.6.3.
Try pressing Ctrl + D. This worked for an earlier version that I am using.

How do I discover Elm's REPL in VS Code?

How do I discover Elm's REPL in VS Code?
Specifically, I have no clue how to get up and running with Elm and VS Code.
My past experience involves using F# and Visual Studio.
How do I send instructions to Elm's REPL?
Where is Elm's REPL located within VS Code's IDE?
Any suggestions?
Once you've installed the Elm package, you can use the Elm: REPL - Start command to start a REPL session.
(You access this command the same way as you access other commands in VS Code: by opening the Command Palette. This can be done through the View menu (View -> Command Palette) or with a keyboard shortcut (Ctrl + Shift + P or Cmd + Shift + P, depending on whether you use Windows or Mac).
Once the session has started, you can send lines or selections to the REPL. Type a line into your editor, then run the Elm: REPL - Send Line command to send it to the REPL. There is a default keyboard shortcut for this (Alt + /) as well.
If you want to send more than a line, highlight the thing you'd like to send (probably a function or value definition), and run the Elm: REPL - Send Selection command. Again, there's a keyboard shortcut: Alt + Enter.
Note that the REPL does not support type annotations; sending type annotations to the REPL will result in an error. You can still annotate your function and value definitions in your code, but when you highlight the definitions to send to the REPL, just make sure not to highlight the type annotations.
If you're just looking to play around in the Elm repl, just do this:
1) install Elm globally (using npm, or using an installer from elm-lang.org)
2) open VS Code, then press CTRL + ` (or Cmd + ` on a Mac); this opens VS Code's built-in terminal
3) type elm-repl -- this starts elm's repl, and you can try out snippets, etc
However since your real question is about getting up and running w/ Elm in VS Code, here's a start:
1) download/install elm-format from https://github.com/avh4/elm-format
2) install VS Code
3) install VS Code extension "elm" (it's by a Sascha Brink); add "elm.formatOnSave": true to your VS Code settings
Now when you create/edit a .elm file you'll get code coloring, etc.
If your Elm code is for an app (as opposed to repl snippets), you'll want to see results in elm-reactor. So start a VS Code terminal (see above), type elm-reactor, and your app should be served at http://localhost:8000
In short; You don't want to use vscode (yet) for Elm development. Either go with Atom (Elmjutsu) or IntelliJ (CE works fine with the elm-plugin).
You get support for refactoring and fast navigation. The reason I don't recommend using vscode is because the elm-plugin is underdeveloped.
Unfortunately, the elm-plugin with IntelliJ also is a little underdeveloped, since it does not underline-highlight errors in your sourcecode – so tracking errors does have a cognitive tax.
I know that this question is related to the elm-repl and the possibility to send your selection to the repl is a nice one. But it only saves you two shortcuts (copy selection, send to repl vs copy selection, alt-tab to repl, paste and enter). The way lines are formatted (in elm-format) renders send-single-line as mostly a not-properly-thougth-through feature.
What I do is open a terminal and open elm-repl there, and I split my screen so I always have the output available.

Configure pointer focus properties of Matlab's command window

I'm running Matlab 2013a, under Linux, using Xmonad (using the XMonad.Config.Xfce package).
This problem occurs whether the command window is docked or not.
The command window prompt does not get the keyboard focus unless the pointer is located
over the command window.
Is there a way to get the Matlab command window to have focus behaviour just like other normal windows, like a terminal?
Most important: I'd like to have the keyboard focus follow the window focus,
and not require any special positioning of the pointer, so that I can just "Alt-Tab" around my windows and have the command window get the keyboard focus. All of the resources I've found so far relate to programmatic control of focus; I'm just trying to improve my user experience in an interactive session.
To get keyboard focus on the Command Window, include the following in your xmonad.hs
import XMonad.Hooks.SetWMName
import XMonad.Hooks.ManageHelpers
and configure your ManageHook as follows
myManageHook = composeAll . concat $
[ [appName =? a --> doCenterFloat | a <- myFloatAS ]
, (your other hooks)
] where
myFloatAS = ["MATLAB"]
Finally, include setWMName "LG3D" in your startupHook. See here for a full xmonad.hs configuration which uses this (this is where I found the solution). If you have other Java apps that don't get focus as they should you can add them to the myFloatAS list.
It's a problem in the built-in java.
If i run:
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre
matlab -desktop
Matlab works as expected.
I ran into this problem, running MATLAB2014a. I set up setWMName "LG3D" but still i couldn't get focus on my window. I had to click on the focused window to get the cursor, and sometimes the situation was even worse and I had to click on random places till i get my cursor back. This wouldn't happen on MATLAB2010. What worked for me was to use the native version of java as describe above.
In the end, i used the following bash script to start matlab8:
#!/bin/bash
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk-amd64/jre/
/usr/local/bin/matlab8 -desktop -nosplash