You can easily compare the two files using the following command: If you have two classes in your solution as in the below image: This will give you the same view as the file differ extension, again this looks just like when you compare different versions of a file under source control. You can tap into the functionality that Visual Studio uses to compare files by using the Tools.DiffFiles command. I first wrote about this method back in 2019. This is my favourite way to compare files in Visual Studio, the only downside is that you need an extension. You will have to restart Visual Studio, after this you can select two files in Visual Studio's solution explorer and compare them as seen below: You can install the extension by going to:Įxtensions -> Manage extensions -> Online -> Search for "file differ" -> install This will show a comparison just as if you were comparing files in source control. This is a simple extension that allows you to select two files, right click and hit compare, just like in Visual Studio code. ![]() For that, the docs are pretty good.Mads Kristensen has made a lot of great extensions for Visual Studio, one of them is the file differ extension. The presupposition is that you already familiar a bit with vscode extension development so the posts will not cover explanations about “what is the extension”?, “how to start”? “What is TypeScript”? and so on. Obviously, all the code is open source What the posts will not include? So a post’s aspect might be not includes in the extension in the end but I needed that technique or aspect to move forward and it worth to mentioned.Īlso, each post will start with what the challenge that need to solved and will show with explanations and code how to solve it.Īnd finally, I’ll update the posts with new information that will come up along the road. The posts in the series will be divided so each post will deal with a different aspect, api method or flow so it can be read without context and will not require to read the full series (although it could help □) The posts written in at the same time as the extension so the progress will be in accordance so the topics. So, the third motivation is to show how to implement different functionalities in an extension. In order to present a view, you need to do a bunch of things that in different places in the code base so you not always know where to look. If it was a simple flatted library (such lodash), code snippets will do the job. I must to say, it’s not trivial, for me at least. They’re basically saying: “here is the code, try to understand how we did it”. To cover on that, there is a great demos repository but with that, you need to do “reverse engineering”. Vscode API’s docs are basically good but I feel that many times it lacks a context. ![]() I already tried to develop a tiny extension before but now I want to use more advanced API capabilities to enrich that plugin and make it ready for real use. Second, I’m using vscode intensively and I like to know it better. Click on a file, will open a diff view, side by side and (hopefully) the user will be able to take or leave changes just like in git merge. Once the other folder selected, the extension will compare the content of the folders and display a tree view of the files with the difference. In that panel, the user could choose a folder anywhere in the file system. There will be a dedicated panel for this in the view panel (in the left side of the app, at the same place the the files explorer). As much as it’s a trivial need and there are a lot of tools out there, vscode has none. With that plugin you can compare 2 folders’ content just like you do with git by comparing a branch code to master. The post is (will be) part of a series (□) and the only one who will not include any code examples and technical stuff. This post meant to introduce the journey of the Visual Studio Code (“vscode”) plugin CompareFolders.
0 Comments
Leave a Reply. |