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

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

Related

how to get color code on my code FOR EXAMPLE (Debug.Log) to be in a color?

s
I want someone to tell me how to put colors on the code so its easier for me to code.
I think you forgot to select unity c# components when installing visual studio,
try again with visual code
If you are talking about Intellisense / syntax highlighting, you need to make sure that you installed Visual Studio Tools for Unity (Note this is needed for Visual Studio only and you may already have it installed).
Then follow these steps:
Close Visual Studio
In Unity, go to Edit > Preferences > External Tools
Click on the External Script Editor dropdown (this should be on which ever Visual Studio editor you are using or any other supported editor).
Make sure Embedded packages and Local Packages is checked under Generate csproj files for:
Click on Regenerate project files
Open any C# script and check if syntax highlighting is working.
In the worst case, if that does not work, you can close Unity and delete everything except the Assets/ and Project Settings/ folders (as well as anything you explicitly added) in your project's root directory. Unity will regenerate the project folders and files again when you open the project in the editor. It may just be that some of your project files were corrupt.
Also, in case I misinterpreted your question and you are talking about coloring the output in the console window within the editor, you can try using rich text which I believe is supported by Unity's console window in the latest versions.
Example:
Debug.Log("<color=red>this is red text</color>");
For more info on that:
https://docs.unity3d.com/Packages/com.unity.ugui#1.0/manual/StyledText.html

How to duplicate a source file in visual studio

in visual studio 2019 on windows, if you right click on a .cs source file in the solution explorer, you have the option to copy. There is no duplicate option. If you copy, there is no paste option. There is no duplicate or paste in the file or edit menu either. There is no ctrl-v option either.
Any ideas?
I cant find any way to add a source file either. If I right click on the directory such as "blocks" where my current source files in my project are, then click "add", the menu which pops up "controller" is greyed out, as is "class".
There are no permissions issues - this is just a project I have been working on but is now "broken". If I go to the root of the project in solution explorer, it has the option to create controllers for example, but bazarely not folders or classes.
If I create a new .cs file in one of the source folders using windows file explorer, there seems to be no option to get this new file picked up by visual studio. The refresh icon at the top of the solution explorer is greyed out, and F5 does nothing.
Well, took me a while to figure this one out. Unlike every other IDE I have used for the last 20 years (eclipse, intellij etc), VS is for some reason making the entire project read only when its running locally. I have to stop it running to be able to add files etc.

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

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?

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).

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

Resources