For the command, if VS-Code was a default install use C:\Users\paynek\AppData\Local\Programs\Microsoft VS Code\Code.exe.To access the code stash from Visual Studio Working with GitHub in VS-Code as VS-Code comes ready to work with GitHub. To ensure code in the code stash is a) backed up b) available from other locations create a GitHub account, create a (if you don't want others to see this code make it private) repository. Copy the folder to the current Visual Studio solution and add to the solution. In some case there may be a class project stored in C:\CodeStash, to use it, copy the project by right clicking in VS-Code file explorer which opens to Windows Explorer. For instance, handling cross thread violation for interacting with controls from another thread. Finding a snippetĪ code snippet might be something easy to re-code for some developers while not for other developers. Note in the above image, there are other sub-folders which in this case are actual full projects while in the files shown are not connected to the other files as they are code snippet. This is a sample folder structure under C:\CodeStash Each sub-folder is like a chapter in a book which may contain sub-folders. Placed in a folder which for this article will be called CodeStash. Microsoft VS-Code is a open source and very flexible editor that runs everywhere while it's not up to the level of Visual Studio it can be used for other things like house code snippets. Learn how to keep code that may be used in situations explained above or perhaps there is code found that was not needed but may be in the future. Worked out is used then time goes by, in another project the same thing is needed and the coder remembers this but forgets where and could it be in a former job or perhaps another programming language? Coders tend to either ask questions in developer forums or search the web for an answer or code that gets them started. Now, right click on the second file and choose "Compare with Selected".īoom! You've got a beautiful side-by-side comparison of the two files.From hobbyist, novice developer to full-time developer nobody can remember everything to write code in Microsoft Visual Studio. From the file explorer, right click on the first file to compare. Now, for something completely different! Is the shell command line not your cup of tea? Visual Studio Code to the rescue! Code has a built-in diffing feature. Isn't that better? You could very quickly see the differences in giant files. suppress-common-lines (sadly there is no shorthand) prevents the output from displaying any lines that are identical. That's all well and good, but can you imagine scrolling through a 5000 line comparison looking for a few differences? What a pain.Ī new flag ? to the rescue! diff sample1.json sample2.json -y -suppress-common-lines. Wow! That's a huge improvement! Between the files, the | is an indicator that the lines are different. This does the same comparison but puts the results side by side. diff sample1.json sample2.json -y (the -y is shorthand for -side-by-side). Let's make it a bit simpler by adding another flag to the command. It's great information, if not a bit hard to read. That's indicating that the first file has a 14th line that the second file does not have. 7,9c7,9 means there are differences in lines 7 through 9 and the subsequent lines display the differences. The symbols point to the relevant file: left (first file) and right (second file). 4c4 means there is a difference or change on line 4 of each file. You'll find a slew of options to improve the default experience.įor the default comparison, just type diff name-of-file1 name-of-file2 and you'll get a result like this:īasically, you're seeing a summary of differences between lines. Have you ever needed to easily tell the difference between two files? diff on the command line to the rescue!įirst, don't forget to examine the docs by doing man diff from the command line.
0 Comments
Leave a Reply. |