You can use Ctrl-K, Ctrl-F on smaller blocks of text, so if you have a strange indenting style then highlighting only your change can correct the indentation on the selected lines and not the entire file.If you have a different indentation style than a code file that was previously checked, this process could also cause the subsequent diff to show lots of red. I also leave the Visual Studio indentation settings alone and stick with the defaults.The next person that does a diff on your check-in with the previous check-in will thank you. Just highlight the block and type the Visual Studio shortcuts. CTRL+K+C is a quicker way to bulk comment. Manually adding and removing ‘//’ is tedious especially, if you have a long piece of code you want to deactivate. You should try to minimize your code change to only what was necessary to fix the bug (don’t reformat the entire file). Hot Keys: CTRL+K+C for Bulk Comment & CTRL+K+U for Uncomment. If you are working on legacy code (for example fixing a bug) and there is a different indenting structure, it is good practice to stick with the legacy indenting and not modify the indenting of the entire file just because you fixed a bug in one line of code.This will still work with other errors such as undeclared variables. If there are errors in the structure of your code (missing closing brackets, missing semi-colon, etc.) then this will not work.Now your code will be reformatted to the correct indenting for your page. You can use Ctrl-K, Ctrl-D to format the entire document. You can manually go and fix each line but there is a much simpler way to correct the indenting. The way to skip these is to press CtrlCmd + K and CtrlCmd + D in succession. If you click on Tools -> Options, and then select Environment -> Keyboard, you can. However, sometimes you get false positives. Fortunately Visual Studio allows you to add your own keyboard shortcuts. Where does your class, if block, or method begin and end? Using CtrlCmd + D in Visual Studio Code allows you to select the next occurrence of the current selection, which is excellent. In C# as you are typing in a class file the indenting of your code can easily get out of alignment making the code hard to read.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |