I have a bunch of F# scripts (fsx) that I use for my basic deployment needs. I just right click them and say "Run with F# interactive"
However, sometimes the script fails and I would like to keep the interactive console running. So far I haven't figured out a nice way to achieve that.
I tried starting up the fsi.exe manually but then how can I launch my script from there?
If you are hackish enough, you may want adding just another Explorer context menu item similar to Run with F# Interactive, but keeping the console window open after .fsx script terminates. Here is the working outline of how to achieve this for Windows7/VS2012:
being admin open regedit and find the key HKEY_CLASSES_ROOT\VisualStudio.fsx.11.0\shell
add new subkey with some unique name, like openRunCmd, make (Default) value for this key whatever you like to see in context menu, maybe Run with Fsi in shell
finally, add subkey HKEY_CLASSES_ROOT\VisualStudio.fsx.11.0\shell\openRunCmd\command and set (Default) value for this subkey to the following line:
c:\windows\system32\cmd.exe /Q /K %%USERPROFILE%%\fsx.bat "%1"
Now, close regedit, go to your home directory and create there a batch file fsx.bat with the following line:
"C:\Program Files (x86)\Microsoft SDKs\F#\3.0\Framework\v4.0\Fsi.exe" --quiet --exec "%1"
After these mods you would be able to click on any .fsx script with right mouse button, pick Run with Fsi in shell and have the shell window staying after script termination until you close it. With few small adjustments the same approach would work for VS2010.
Just be careful to adjust details, if your system settings differ from ones above. Good luck!
Update: For those who want to try this at home or at work I've posted a detailed walk-through here.
#load "myScipt.fsx";;
should work I think. But myself i prefer just to have separate console window (cmd.exe), from which i can run fsi myScipt.fsx and see the output.
I have created a windows shortcut with
Target:
cmd /k "C:\Program Files (x86)\Microsoft SDKs\F#\3.1\Framework\v4.0\Fsi.exe" deploy.fsx
Start in:
C:\FolderContaningFsxScript
This keeps the window open if the script fails so I can see any compile errors. It also keeps the window open if the script runs successfully which might or might not be desirable.
I find it easier to just click the shortcut instead of Right Click > Run with F# Interactive. I think a batch file with the above command would work as well.
Related
Debugging a VisualStudio 2019 project, build errors indicate
Source file 'C:\Users\blah..\ ..\target\some_file.jar'
(ignore space).
I'd like to make sure the file that is being sought is where it is being sought, but I can't tell where that is for the dots. How does one identify the actual path being sought?
The dots are used in a build command in VS, and indicate a jump in the file structure of one level for each pair of dots.
Thus, the command "cd C:\Users\blah..\ ..\target" would change the directory to c:\target.
I installed the "docker dive" extension in VsCode. I aready had the Docker extension installed (which it requires). The docs say that Dive will run when an image is selected in the Docker extension images list. But that does not happen.
I entered "dive" in the command palette and "Docker:Dive" came up. I selected it and it displayed a list of my images for me to select one. When I did that, a new terminal window opened and tried to run dive my_image_name.
Then Powershell displayed the error: dive : The term 'dive' is not recognized as the name of a cmdlet, ....
It's looking for "dive" in my PATH.
I'm confused. Docker Dive is an installed extension. Why should it also need it in my PATH? And if it really needs it, what is the path of the executable?
You need to install dive first. Just check the repo and you should be ready to go github.com/wagoodman/dive
For Windows users. From the releases page https://github.com/wagoodman/dive/releases/
you need to find the Assets and download the windows one. Like https://github.com/wagoodman/dive/releases/download/v0.10.0/dive_0.10.0_windows_amd64.zip
You unzip the file and then you can create a folder on your C drive called dive, like C:\dive. Copy the executable dive.exe intoC:\dive
Then you need to add that folder address into your PATH. For that you need to go to
From there you click on Environment Variables, then to System variables; from there you click on the Path variable and then on Edit. On the Edit window, add a new entry, with tyhe New button; the add C:\dive and click Ok button.
Then close and re open Visual Studio Code. Now the extension should work as intended.
I have written a code analyzer as part of my Visual Studio Package.
This corresponds to the instructions on this page except that it is part of my existing Package and not a stand-alone analyzer.
The analyzer registers itself to analyze the the SyntaxNode types StringLiteralExpression and InterpolatedStringExpression.
public override void Initialize ( AnalysisContext context )
{
context.RegisterSyntaxNodeAction ( AnalyzeString, SyntaxKind.StringLiteralExpression, SyntaxKind.InterpolatedStringExpression ) ;
}
As described here
By default, live code analysis executes analyzers only for open files in Visual Studio.
This is correct. My analyzer runs on open files.
The same page continues:
Run code analysis manually
In Solution Explorer, click the project.
On the Analyze menu, click Run Code Analysis on Project Name.
Code analysis will start executing in the background. You should see the message
Running code analysis for ... in the Visual Studio status bar towards
the bottom-left corner. Once code analysis completes, the status message will
change to Code analysis completed for . Error list will soon refresh
with all code analysis diagnostic
In this case, my analysis does not run.
I have placed breakpoints in the constructor, the SupportedDiagnostics property get, the Initialize function and the analyze function itself. None of them are entered if I start the code analysis manually via the Analysis menu (or via the context menu in the solution explorer).
Is there some additional condition required to activate a code analyzer for the manual code analysis?
I also encountered this weird issue.
In my case, I used the "wrong" Developer Command Prompt.
I installed VS Build tools after installing VS2017, which also installed the 2nd Developer Command Prompt.
The Start Menu shortcuts of the 2 Developer Command Prompt are as follows:
A: BuildTools (does not work!)
%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\Tools\VsDevCmd.bat"
B. VS Professional (works!)
%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\VsDevCmd.bat"
I spent all afternoon trying to figure this out! :-(
Every time I create a new file I have to select the file type manually via Document->Set Filetype->.....
Is there a shortcut or a custom command I can use to select programming language to pascal fast?
I'm glad you asked. The same annoyance bugs me every I create a new file to write a Bash script. So, I worked out a solution.
If you're using a Linux system, you can set up a custom command to call xdotool to do the job. If you don't have it installed, it should be available in your distro's repo. With xdotool, you can simulate a sequence of keypresses to do the work of selecting Pascal for you.
Go to Edit > Format > Send Selection to > Set Custom Commands
Click the Add button
Enter the appropriate xdotool command in the Command edit box (see below)
Hit the Enter key (Important! If you don't hit Enter, Geany won't save what's in the box.)
Click the OK button
The exact command to select Pascal on my Geany installation is...
xdotool key alt+d t p Page_Down Up Up Up Up Up Up Up Return
...but make adjustments if needed.
You'll also want to set a keyboard shortcut to run the custom command. (Important! The new document needs to have focus for the custom command to work.) You can try Ctrl+1, which is supposed to be the default keyboard shortcut for Custom Command 1, but it wouldn't work on my Geany installation for some reason. If you have the same issue, then...
Go to Edit > Preferences > Keybindings
Scroll down to "Send to Custom Command 1"
Click the Change button
Press the combination of keys you want for the shortcut
Click the OK button
Test the shortcut (Geany seems weirdly strict about what key combinations will work, so you may have to try a few. I got it working by choosing Alt+1.)
If you're using Windows, where xdotool isn't available, I'd probably try out xdotool-for-windows first, and if it didn't work out I'd see if something listed at AlternativeTo would serve the purpose.
There's commander plugin for Geany (geany-plugin-commander package on Debian-based distros). It basically makes all menu items, including Set Filetype, searchable. Don't forget to set the shortcut for the "command palette" menu after installing/enabling the plugin.
I've got a custom ant script for building and other fun stuff. IntelliJ has very nice integration for handling Ant tasks. However, every time I run a task IntelliJ opens the script in my editor panel. It moves to the line of the task I'm running and then I close it; actually I now have it in its own panel, minimized to the max.
Is there anyway to disable this behavior? I just want the Ant script to run the task, pop up its own panel with some feedback (which it does) and then allow me to keep coding without having to close the script. Please tell me this is possible.
Man, I can't believe this only had 4 views, and two of those were me. Pretty weak.
Anyways, I've got a solution that might help someone else down the road. In the Messages window that pops up when the ant build starts there is an Auto Scroll to Source button. Make sure this button is unchecked.