shortcut key for diffing a file in Visual Studio Code? - editor

What is the shortcut key for diffing a sourcefile in VSCode?
Seems like I can only do diffs from the Git View
On top of that I seem to only have the ability to right-click and Open Change, so no seemingly obvious shortcut key from there as well.
Ideally what I would like to do is have the diffing ability on the explorer view or from the git view via shortcut key?

With the update to 0.3.0 there is now a command to diff the opened file to another file. You can assign a keybinding to it, the command id is workbench.files.action.compareFileWith

There is a special tool for diffing, not sure it answers your question though.
https://visualstudiogallery.msdn.microsoft.com/d8d61cc9-6660-41af-b8d0-0f8403b4b39c

Related

How can I force file ordering in F# projects using vscode?

I'm trying to work with vscode in my WebSharper project (Ionide plugin seems... Whoah!) but when I load the fsproj into vscode, files in the explorer are ordered by name, not by "F# precedence". How can I configure vscode so that files are correctly ordered? Thank you.
The VS-like project explorer has been added to Ionide recently. It includes assembly references, project references, and ordered files (including folder supports). We've also added several commands to manipulate project and file order, you can access them with right-click context menu on this new project explorer
In Visual Studio Code you press Ctrl + Shift + P, then enter "F#: Move File Up".
If you have activated the great ionide plugin you can navigate to the F# symbol on the activity bar. This will open the project explorer which allows you to reorder files using the arrow icons:
This will change the order of the files (<Compile Include="xyz.fs" /> statements) in your .fsproj file (which is what you would have to do manually if you're not using the ionide plugin).
Without any plugin, VSCode 1.66 (March 2022) should support a better order support.
See issue 32592:
ordering of files is really important for the F# projects, and we provide couple of helper commands to manage it (move file up/down etc).
Those commands work more or less, but I don't think it's best UX.
I think it would be super nice if users had ability to use normal drag and drop to manipulate the order - just as they are able to manipulate files in normal file explorer (drag and drop files to move them to subfolder for example)
It is currently released in VSCode insider, with commit c468903 ("Finalize tree drag and drop API").

Visual Studio 2015 - Merge tool button missing

I'm having problems with merge tool in Visual Studio 2015. I didn't need the merge tool for the longest time, I haven't used it for couple of months. Now when I need it I can't find it. I was trying to google and find an answer, checking VS settings but with no success. I can only see buttons 'Overwrite Local File or Folder' and 'Keep Local File Contents'. When I press Compare button, I see diff tool but I'm not able to accept changes (check buttons are missing).
What am I doing wrong? How can I merge two files?
Please navigate to files in source control
Right click on file/folder you want to branch>>Merge
Full list of other solutions.
This is because these files in your local folder are not been tracked by TFS Version Control. For example, you added a file "readme.txt" in you local folder and hadn't check-in them into version control. Another people in your team also added this file in the same relative path and checked it into version control. Now, when you get the latest version or check in your changes, you will get the behavior as your screenshot. A similar question can be found here: TFS Conflict Type: Writable File - A writable file by same name exists locally
It's doing exactly the same things in Visual Studio 2017.
If you had a problem in workspace and you rollback it from a save, you can have the same issue.
You need to rebind some of the project by yourself first like the asked question here : Re etablish TFS source control bindings, then if all is going well you will see the button.
If it's not working, try to use external merge tool which will allow you to edit thoses files.

How can I get all the files

I have a solution. I select get the latest, it does not....
I have a folder that has 3rd party dlls. These are not gotten. Instead I have to go into my source control browser and get the latest. Programmers forget to do this and their code breaks.
How can I get the latest directly from the solution?
The source control interface in the solution explorer is very poor. I'd recommend using the source control view instead.
The reason that tfs doesn't get all the files when you get latest on the solution explorer is that it only considers files in the solution. If you use the source control view instead, you will get all the files with no messing about.
The other option is to add all the files to your solution. Right click in the solution explorer and add existing file. In the file browser, choose the file and then click the arrow at the right end of the open button to drop down a menu - choose add as link so that the solution references the file where it is rather than taking a copy of it.
You can use "Get Specific Version" and specify "Latest". Also specify to overwrite files that haven't changed.
Perhaps you could add the DLLs directly to the solution in their own solution folder. Then Visual Studio would know about them and pick them up with the rest of the solution.

Team Foundation Server How to Edit file without checking it out

i'm working with TFS and i need to edit file localy without checking it out .
another case if some one checked in the file and i need to change my locally copy.
what should I do ?
in Visual source safe we can do that by removing the read only check on the file.
Ok, this is relatively easy in VS2010, and quite normal. I mean the locking model of source control is obsolete anyway.
In vs2010, click Tools -> Options -> Source Control -> Environment and select Allow checked-in items to be edited. This should stop the TF client from marking files as read-only.
Also you may have to change the Editing drop-down in Source Control -> Environment to Do nothing.
Well.. You can certainly unmark the file as read only and edit it in something other than visual studio. Or, you can still use visual studio, but not edit it when the solution it's a part of is opened..
Quite frankly, I'd look into other options with regards to why
1. that file needs to be in source control.
2. If it does need to be in source control, why does your copy need to be different.
Just unset the read-only flag on the file locally.
You may have some issues later when try to do a "Get Latest" operation, which will warn you about a locally writeable file.

Is it possible to configure TFS not to mark file as read-only?

The title pretty much says it all.
I'm using a RFT, VS addin that allows me to edit a proprietary data file with a GUI. The problem is that this file doesn't show up in VS and when I start editing it via the GUI, VS doesn't check it out automatically (probably a bug of the VS addin). So, I've to check it out manually before editing it, otherwise the addin will crash when trying to save the file (because it is read-only), and sometimes will also corrupt the local working copy of this project.
Everything would be much easier if TFS didn't mark the file not checked out as read only.
Do you know if there is a way to instruct TFS to keep all the files as not read-only?
No. You can exclude it from source control, but that's probably not want you want.
I have the same issues with TFS. Our project has a few small SQL Server database files that we have chosen to put under source control. We handle the read only issue by adding these to the post build statement on the project build. I suppose we could have done this pre-build as well.
attrib $(TargetDir)*.mdf -r
attrib $(TargetDir)*.ldf -r
It has been a while, but - I think this link is actually the answer to that.
When you do a check out, what you are actually doing is saying “TFS, I
would like to edit the version of the file that I have already
downloaded, is that ok?” TFS then looks at that version, and tells you
if you can edit it or not (based on your security permissions at that
point in time and if anyone else has placed a lock on the file). If
you can edit the file, the TFS marks the file as read/write on your
local machine and allows you to proceed.
I.E: When I r.clicked the project and selected "Check out and edit", the r/o flag was automatically removed, and I could compile (with both pre/post events) and then "check in" again.
Well you can get latest to a samba share, which eats the readonly bit.

Resources