How can my integraded terminal automatically cd into the directory of the currently active file? - terminal

I'm pretty new to Visual Studio Code and am used to a nice feature from my previous IDE. That feature had the integrated terminal follow the active file into its directory, at all times. So when I switched to viewing another file in my IDE, the integrated terminal would change its cwd to that new file's directory.
I'm aware of the Terminal Here Extension and the context menu option:
The problem with both is, that they require action on my part, i.e. using a shortcut or the context-menu respectively. I want the terminal to just change into the active file's directory, whenever I switch to another file.
How can I achieve this with Visual Studio Code?

Related

Command to open another instance of integrated terminal on Visual Studio Code?

This question is specifically for Visual Studio Code (VS Code) and it's integrated terminal.
Is it possible to open another integrated terminal to run certain commands from npm scripts or from within one terminal?
For example: if the command "Start cmd" is executed, it opens a new separate window. But, is it possible to force that command to open and run inside another integrated terminal within VS Code?
Note:
There are keyboard shortcuts avaiable to open, close, show, hide etc, but this question is asking about performing these actions from code or command not using keyboard shortcut.
Visual Studio code has nice keyboard shortcuts for opening new integrated terminal instances:
For Windows:
Ctrl+Shift+`
For Macintosh
Ctrl+Shift+~
For more information on shortcuts take a look here for Windows and here for Macintosh. At least this way you can run any command you want in multiple instances. For example, run your server in one integrated window, and other one off commands in another instance, etc...
Hopefully that helps!

In Windows 10, can I set a default "Open with" application for docker files?

Docker image files must be named Dockerfile with no extension. I typically edit these files using Visual Studio Code. Whenever I want to open one, I need to right click it and select Open With and then select Visual Studio Code from the list. For most files, which have a file extension, the Open With modal has a checkbox to remember the preferred application. Is there anyway to set a preferred application for files based on anything other than file extension, so that I could just double-click a Dockerfile to edit it?
You can use information from here to assign files with no extension to a default program, but it seems it will apply to ALL files with no extension (docker or not).

Make Visual Studio Code open files in the already open project window?

I build my project on the terminal using make. When I encounter some compile errors, the output indicates in which files there is an error. I can Ctrl-click the file names to open them (a feature of iTerm). However, this makes Visual Studio Code open a new window with that single file, instead of navigating to that file in the already open project window. Is there a way to change this?
There is an option window.openFilesInNewWindow, but that only works for files opened within VS Code, not from Finder or other apps.
VSCode accepts -r or --reuse-window as a parameter to force opening a file in the active project window.
If you can configure your iTerm feature and add this parameter, it should work as expected.
Reference : https://code.visualstudio.com/docs/editor/codebasics

Visual Studio 2013 - Open .aspx and .cs files from other project at the current project

Probably it's a stupid question but i would like to open aspx and cs files from the windows explorer without opening a new instance of visual studio, is this possible?
Greets,
Firmino
There are several ways you can improve your experience opening files in VS.
You can use drag and drop
Troubleshooting: You can't drag and drop between apps in Windows if one of them is running with admin rights and another is not. Normally, you don't need either of Explorer or VS to run with admin privileges.
Visual studio running with no admin rights will most likely will be reused to open a file when you doubleclick in the Explorer (sometimes it still opens new instance with no sensible reason)
You can use File_Menu->Open->File (Ctrl+O). This will basically open an Explorer instance for you.
You can use File_Menu->Recent files if you have opened desired file recently
You can just add file to the project (and then get rid of it when it's no longer needed) (Shift+Alt+A)
You can use Show All Files feature (a toggle button in Solution Explorer) to view all the files under project folder (recursively), even if they are not included in the project. You cannot see folders higher in hierarchy, but you could make for example a symlink or just a dumb copy
You can file a feature request or a bug report (it can be done from VS itself) to make developers know about this situation
Hope any of those solutions will work for you.
Right Click On The File
Click Open With
And Select Notepad..
It Would Do The JOB

How do I launch multiple instances of Xamarin Studio on the Mac (Visual Studio for Mac)? [duplicate]

This question already has answers here:
How can I launch multiple instances of MonoDevelop on the Mac?
(10 answers)
Closed 9 years ago.
I'd like to have multiple copies of Xamarin Studio running simultaneously. Once one copy is running, double-clicking the Xamarin Studio icon in /Applications or clicking the currently-running Dock icon simply brings the current one to the foreground.
Just want a tool?
If you just want to download something that does this for you, there is also the MS Solution Launcher or the older Xamarin Studio Launcher v3. Presumably, it does something similar to the script below but comes in a nice pre-built app with a distinct icon you just copy to your Application folder. As well, it can even be set up as a target for opening .sln files, allowing you to launch a new Xamarin Studio instance when you double-click a solution file.
Do it yourself
Just like described for MonoDevelop, you can force a new instance from the command line. As well, with an AppleScript side-trip described for MonoDevelop, you can get this in the form of an app icon.
The only difference between the MonoDevelop script and the new Xamarin Studio version is the requirement of an additional escape character since the new app has a space in its name.
Open AppleScript Editor and enter the following (note the doubly-escaped space to get the space to the shell unmolested).
do shell script "open -n /Applications/Xamarin\\ Studio.app/"
Save with a name like "Xamarin Studio Launcher" and make sure to specify Application for the file format.
Drag the icon to your dock.
Each run of this new "app" will launch a new instance of Xamarin Studio.
From there, as described in a comment from the MonoDevelop answer, you can use the Xamarin Studio icon instead of the default applet icon.
Right-click the original Xamarin Studio app and choose "Show Package Contents".
Navigate to /Contents/Resources/ and copy the XamarinStudio.icns file (or monodevelop.icns, for older XS releases).
Right-click the launcher app you created and choose "Show Package Contents".
Navigate to its /Contents/Resources/ and paste a new copy of that icns file.
Delete the original applet.icns icon and rename the new monodevelop.icns to applet.icns to take its place.

Resources