The article is constantly updated every week. It’s not easy to create original articles. It’s my greatest affirmation that “Sanlian” let more people see it. WeChat can search the public for the first time to read the official account of “backend Technology School” (usually one to two updates earlier than blogs).
Hello, I’m lemon. Let’s get to the topic of today.
See also vscode
Visual studio code (vs Code for short) is a free code editor developed by Microsoft and supports windows, Linux and MacOS operating systems. In the developer survey organized by stack overflow in 2019, vs code is considered to be the most popular development environment for developers.
I wrote a article about how to use vscode to develop remote, and the remote development environment of vscode is relative to other ide The remote development environment of the system realizes real remote development. The object of operation on the local host (windows or MAC) is directly the remote machine (Linux). All the modifications on the local host are directly based on the remote file. The traditional development process can edit the file locally and upload it to the remote compiler by FTP tools. This set of tedious operation is caused by This is very convenient.
That article has been widely praised by all readers and reprinted by major numbers for more than 15 times. Interested friends read my original article: hand hands teach you to configure vs code remote development tools, and improve working efficiency by N times.
In this article, I will teach you how to create a smooth C / C + + development environment based on my daily work experience. This configuration guide may not be comprehensive and will not teach you how to configure plug-ins step by step. These too detailed work is left to you to complete. In fact, the plug-in download page will have detailed instructions.
Many novices may feel that vscode editing text is OK, but reading and writing code are too difficult to use. That’s because they don’t master the correct opening method,The essence of vscode is rich plug-in system support. I believe that after reading this article and configuring the environment, there is only one sentence “Zhenxiang” that can describe it。
In order to have an intuitive impression, let’s take a look at my vscode plug-in list first. Because I use vscode to develop C / C + + / go / Python programs, there are many plug-ins, and some plug-ins that may not be related to this article can be ignored.
Basic development plug-in
Since the configuration supports the development in the C / C + + environment, the following two plug-ins are required to be installed. They mainly provide some basic code debugging and viewing functions. After installation, vscode can support C / C such as intelligent code completion, type filling and association, symbol and function definition jump, reference lookup, etc++ Program development and source management essential ability, let your vscode from editor to ide basic plug-in.
Source code reading
The programmer’s daily work has two major contents: one is to write his own code, the other is to read the code written by others. The following two plug-ins let you read the code gracefully in vscode.
First of all, the following lazy God tool todo tree, his own todo crying also to supplement the implementation.
The usage scenario of this plug-in is that after reading the code, you add the following comment:
//Todo will expand this function in the futureOf course, I don’t know when the “future” is. If I’m not careful, it will become a distant future. Part of the reason is that the person who wrote this comment forgot it after a long time. At this time, you need the “todo tree plug-in”. We can manage such comments in code more easily.
This plug-in can help you organize and manage todo comments. The tags with todo annotated in the code will be displayed in the sidebar, of course, not limited to todo comments. You can customize the management tags, such as
FIXMECan be filtered and filtered based on tags.
Another recommended source reading plug-in is bookmarks
The function of the “Bookmarks” plug-in is as direct as its name. Yes, it is your source code bookmark. When we look at the source code of large projects, we often need to jump between thousands of source files. At this time, bookmarks can help you create and manage bookmarks conveniently. When you see where you want to add a bookmark, press the shortcut key
Ctrl + Alt + K, click more than once to delete, not only that he also provides the ability to jump before bookmark and view management, more functions can experience by themselves, anyway, I think big project source code uses this very cool.
Here are two git version control related plug-ins. Git is the most widely used version control tool in the project. Of course, vscode provides rich git version control functions. Basically, you can complete some git operations by clicking on the interface. However, the two plug-ins I will introduce today can enable your GIT It’s even more amazing. It’s an enhancement of the function, which makes your git operation more intuitive and easy to use. Who doesn’t like the beautiful things?
The first one is the GIT graph plug-in, which visualizes the GIT warehouse, which makes your submission records look beautiful and generous, and provides rich git operations based on the submission points in the diagram.
As you can see in the figure, the submission records become a time line, and the branches can be clearly distinguished by different color time lines. By clicking the submission point on the submission line, you can view the submission action at that time. You can view what changes have been made in the submission action. You can also easily jump to the change file, and experience more functions by yourself. This plug-in lemon Highly recommended!
The gitlens plug-in described below is also a git enhancement tool.
One of my favorite features is that it can display the submission information of this change directly after the changed position in the file, and then you can jump to the submission file comparison through the displayed submission information. In fact, there are other rich functions, but I use this function most.
Small and beautiful tools
The following plug-ins are the tool plug-ins accumulated in my daily use. They are not necessary, but they will double the happiness of coding after they have them. Let’s introduce them to you one by one.
The first is the following bracket pair colorizer plug-in, which I call the rainbow bracket plug-in.
Are you often bothered by the fact that curly, curly, and parentheses are not matched? Do you often look for matching brackets to see blind? Now, you don’t want 888 or 998. Just download and install this plug-in with one click. You can never worry about it any more. This plug-in allows you to write each bracket can find his own color, in pairs, click one half of the brackets to automatically match the other half, saving the majority of programmers’ myopia.
Let’s introduce the following korofile header plug-in. This plug-in is mainly used to automatically insert the description of the beginning of the header file and the function description.
For example, we often see that other people’s header files start with such templates:
This is not typed out by others. After installing the plug-in, you only need to simply configure the format you want, and then press the shortcut key
Ctrl + Alt +iSuch a template can be generated automatically.
Similar to the function description annotation template, just press the shortcut key
Ctrl + Alt +tCan be completed, very convenient.
The following plug-in switcher, which can jump between header files and C / C + + files.
This plug-in is just because I am too lazy to save effort. We often need to jump to the corresponding source file through the header file, or jump from the source file to the corresponding header file. Of course, you can choose to open it in the file manager in the sidebar, but it is a bit cumbersome to add one more step, so I found this plug-in, and actually according to the plug-in’s documentation, It’s able to jump between different file types, not just header files and source files, lazy Gospels, you’re worth it.
The following plug-ins are more practical tool plug-ins, each take what you need.
The first is the official Chinese version of vscode。 Although lemon advocates and encourages you to use more practical English, if you don’t want to make trouble with it, then let vscode speak Chinese as well. Microsoft official direct supply, good compatibility and easy to eat.
Here is the markdown preview enhancement plug-in。 For people who often write blogs or articles, markdown is indispensable. This plug-in supports split screen preview and various markdwon enhancements.
Finally, the shellman plug-in is a Linux Shell Scripting aid. It is inevitable to write a script when working under Linux. This plug-in can provide convenient shell script automatic completion and association functions, which can improve the speed and accuracy of your script writing.
Most commonly used shortcut keys
There are too many shortcut keys. It’s not necessary to write them down completely. Just remember some commonly used shortcut keys. It’s good to strengthen the memory of some infrequently used shortcut keys when using them. List my own commonly used shortcut keys, not much, but enough! More than enough for daily development work.
Ctrl + Shift + PThis must come first. This command is the mother of all commands. It doesn’t go too far. It will open the vscode command window. In this window, you can enter the name of the plug-in mentioned above to know which features the plug-in supports. In addition, it will also explain the feature shortcut keys.
Here’s an example. First, type in
Ctrl + Shift + PThen open the input box to find
bookmarksYou can know all the features supported by this plug-in, and by the way, write down the shortcut key.
Ctrl + PFile search. Quickly open the file list, input keyword matching file, display the latest opened file first, and easily jump between specified files.
F12Jump to definition. This is nothing to say. Jump to the definition of function or symbol. This is high frequency operation.
Alt + F12In the preview mode, the definition is displayed on the current page
F12The advantage is that it will not jump out of the current file to the definition file, but open a small window preview in the current file, as shown in the following figure:
Shift + F12View the reference to the function or variable where the cursor is located, as shown in
Alt +F12Similarly, open the list of referenced files in the current file in preview mode. As shown in the figure below:
Alt + left / right arrowMove forward or backward to the previous location of the source code where the cursor is located.
Ctrl + Shift + OTo view the symbols in the current file, you can use keywords to filter symbols. Of course, you can also find symbols in the outline view on the left. However, the outline view can’t find matching symbols, so I prefer to use shortcut keys to find symbols.
Are you done with shortcut keys? No, there are too many shortcuts; are the other shortcuts unimportant? Different from person to person, the shortcut key of high frequency use is important, and the above several are ultra-high frequency use. Just remember these. If you use more shortcut keys, you will remember them naturally. But the ones I said must be kept in mind first, which will greatly reduce your use cost and enjoy the fun of vscode coding as soon as possible!
Finally, a few words
When I was in college, I had to install vc++ 6.0 in my freshman class. At that time, there were ides like visual studio. However, the teacher didn’t recommend other ides. They found more modern ides than vc++ 6.0 by virtue of their interest in programming, such as jetbrain series and visual studio series, and they couldn’t help but to try.
At present, the mainstream IDE is very rich. In fact, the editor or IDE is just a tool, which can’t be easily used by itself. Just like the VIM party and Emacs party, no one can convince anyone. Some people like it.
We should pay more attention to the programming itself, improve their own hard power is the most important, but a good tool can let you get twice the result with half the effortAnd lemon is also fully in favor of this, and I hope this article will make you twice as good as you can.
I am lemon, love technology, also love life, insist on sharing output, let oneself and readers have harvest! Pay attention to me and be strong with me.
If the article is helpful to you, please do not hesitate to “like, comment, forward” to encourage me to continue to create。
The official account of WeChat’s search or scanning code can be sent to the “back-end technology school” to reply to “information” “1024”. Articles are updated every week, see you next time!