preface

In a roundabout way, I chose VS Code as a development tool for a simple reason — remote development.

After that, the development platform slowly began to be dominated by Linux. I chose Linux, first of all, because it is equivalent and convenient in compilation, operation and so on. Secondly, it is more unified with the post-test and deployment environment.

However, there is a paradox that the daily office is mainly Windows-based, while development can only take place on the deskless server side, thus resulting in reduced development efficiency and convenience. Although some small projects can be completed with Vim, but in larger projects, it will feel very awkward everywhere. Moreover, I have been very resistant to memorizing vim’s various shortcut keys, which may be a matter of habit.

As a result, my journey to remote development began on a long journey of change.

My way to remote development

Pycharm+vim+Putty

This was the way I first adopted. The main coding work was completed in Windows with Pycharm, and then synchronized to the remote server with SVN and SFTP. Then, I used Putty and VIM to do some small-scale development, and then carried out debugging, packaging and testing. It may seem complicated now, but at that time, it was thought that this was the way remote development should have been, so it lasted for a long time.

MobaXterm

Then I came across MobaXterm, and after a few months of using it I was amazed, why is there such a powerful tool?

Mobaxterm is an enhanced terminal emulation tool with a lot more functionality than Putty. More importantly, it integrates Xming to automatically project Windows from remote servers to local servers so that you can easily open a client with a UI.

So at this point I started to configure the Pycharm and Python development environment on the remote server, and then used MobaXterm to open the Pycharm client for development.

It went on for a few more months, and I thought, maybe this is the perfect solution for remote development.

xshell+xming

Then I tried Xshell, and there was no going back. After comparison, the disadvantages of MobaXterm are gradually highlighted, which also makes the advantages of Xshell more outstanding.

  • Rich and simple topic configuration
  • Powerful keyboard shortcuts
  • Quick and sensitive reaction
  • Supports rich customization functions

However, there is also a problem. Pycharm, my favorite interface, is no longer working. Xshell’s Own Xmanger is charged. You can only install Xming yourself, set up the forwarding tunnel, and display the Pycharm client with Xming.

At this point, I thought I might be able to stop exploring remote development, but then I came across VS Code.

VS Code remote development

In the past two years, VS Code has been outstanding in the field of development tools, which has attracted many students who used to be keen on Eclipse, IntelliJ and Atom to switch to VS Code and speak highly of it. For a long time, I thought VS Code wasn’t what it was, that it was just a featureless editor enriched by plug-ins. Therefore, although I follow VS Code, the frequency of use is pitiful.

It wasn’t until Microsoft announced VS Code Remote at PyCon 2019 in May that I found it too tempting.

I am not willing to give up Pycharm’s powerful auto-completion and code debugging functions for a little advantage, but I am willing to learn to change my usage habits and adapt to a new development tool for the convenience of remote development. Of course, if the tool can actually experience my situation, which VS Code did, it really surprised me with remote development.

Why vs Code?

Remote development is not new to development tools, and remote development has been implemented in the well-known InteliJ family of development tools. But why is VS Code the only thing that appeals to me?

Compare IntelliJ’s remote development with VS Code’s.

  1. IntelliJ remote development is available only in the Professional edition, but not in the community edition. Vs Code is free to use remote development.
  2. The remote development of IntelliJ is realized through FTP and SFTP(File Transfer Protocol). The principle of remote development of IntelliJ is to connect to a remote server through File Transfer Protocol and synchronize remote projects with local projects through upload and download. Such disadvantages are as follows: Unable to synchronize in real time and cumbersome operation. Vs Code connects to remote servers through Secure Shell (SSH). In other words, VS Code is more like a terminal simulation tool in remote development process. It does not require tedious upload and download steps, and has better real-time performance. It syncs instantly to the remote development machine.

Have to admire Microsoft’s strength in software, once they focus on a product, really will do amazing. So, after many comparisons, I chose VS Code as the remote development tool. This really completely frees up the dependence on terminal emulation tools.

Remote development configuration

Let’s start with the detailed configuration of vscode remote development.

** Step 1: ** Install plug-in

To configure Remote Development, you need to install a plug-in named Remote Development as follows:

  • Click the Extension button
  • Search Remote Development
  • The installation

After installation, you will see a remote Explorer button in the side activity bar.

** Step 2: ** Configure the remote server

After installing the plug-in, click remote Explorer and configure remote server on SSH TARGETS. The steps are as follows:

  • Click on the gear icon
  • The config file is displayed
  • Configure Host, Hostname, and User respectively

One thing to note here is that Host is a name, you can call it anything you want. Hostname is the IP address of the remote server, and User is the account name used to log in to the remote server.

** Step 3: ** Open the Remote connection window

Place the mouse over the remote connection item configured in the previous step, click Connect to Host in New Window, and the desired remote connection will open in a New Window.

Configure the encryption-free login

Since VS Code does remote development by SSH remote connection to a remote server, it will prompt you for a password every time you open a remote connection, which is obviously tedious. However, there is a good solution. You can configure a password-free login to avoid having to re-enter your password every time you open a connection.

** Step 1: ** Generate the Windows public key

This requires Windows to configure SSH tools, you can install Git, OpenSSH to achieve.

Open the CMD,

$ ssh-keygen
Copy the code

SSH will generate a public key file in C:\Users\user_name\. SSH. You can see that there is an id_rsa.pub file.

** Step 2: ** Configure the remote server

Go to the SSH configuration directory.

$ cd ~/.ssh
$ ls
Copy the code

Check to see if there is a file named authorized_keys. If not, create one and attach the contents of the id_Rsa. pub file you just uploaded to the authorized_keys file.

$ touch authorized_keys
$ cat ~/id_rsa.pub >> authorized_keys
Copy the code

** Step 3: ** Modify file permissions

This step is very important, without this step, the previous operations are useless. Set authorized_keys to 600.

$ chmod -R 600 authorized_keys
Copy the code

This completes the configuration of cryptogram-free login.

Auxiliary plug-in

A tool, with its own tools, is difficult to meet the needs of different people, so plug-ins become an indispensable part. With the right plug-in configuration, a seemingly mundane tool can instantly become rich and powerful. I think one of VS Code’s strengths is its wide variety of plug-ins and easy configuration. Here, I’d like to recommend five of them that I think are good.

TabNine

The first, of course, is an autocomplete tool based on the GPT-2 language model, which I described in a previous article. Again, I highly recommend TabNine, even if you’re not using VS Code.

TabNine is quite different from the auto-completion tools I know. Traditional completion tools are more based on context information and third-party libraries, in other words, based on existing content. TabNine is more biased inference. It can quickly deduce the code to be input according to the input content of the developer. Even parameters, strings and symbols can be accurately deduced and completed.

Bookmarks

We often jump or turn pages during development, and when we go through a series of jumps and try to get back to where we started, we don’t know where to start. When using Pycharm, we can tag the code with shortcut keys. When we want to go back to a certain location, we can use shortcut keys or search to locate the exact location quickly. This is also one of the things that attracted me about Pycharm, which also formed my habit of tagging.

Moving from Pycharm to VS Code can be a bit awkward when it comes to tags, and you find yourself forgetting the previous code snippet. As it turns out, VS Code can also implement powerful tagging by configuring a plug-in called Bookmarks. We can use Ctrl+Alt+K, Ctrl+Alt+J, Ctrl+Alt+L shortcut keys to add labels, and can be quickly adjusted to the specified label position.

GitLens

A version management tool is essential for a multiplayer start, and Git is one of the most used. It plays such an important role in daily development that version management is a required feature in most development tools. I’ve been using Pycharm for a long time and I thought it did a pretty good job in Git version management, but after trying GitLens for a while, I found that Pycharm is far from GitLens in Git version management.

It clearly displays the modification time and modification history of the current file, visualizes branch, author, and commit information, and provides convenient and powerful comparison functions.

TODO Highlight

Sometimes during development, a piece of code needs to be modified and refined later, for testing or for some reason. If you do not make some marks, it will be difficult to distinguish what needs to be modified and what does not need to be modified over time. So getting into the habit of tagging is a great way to improve development efficiency.

TODO and FIXME are common TODO and FIXME markers that are automatically highlighted when used in Pycharm, making it very easy to find them. Vs Code can do this by installing the TODO Highlight plugin, which highlights what we need to work on and avoids the hassle of reviewing our code.

Code Runner

This is a support for C, C++, Java, Python and other mainstream programming languages to run fast plug-in, it can easily run the current active page code file, can run selected code sections, run custom commands, for debugging code has a great help.

Dry recommended

In order to facilitate everyone, I spent half a month’s time to get over the years to collect all kinds of iso technical finishing together, content including but not limited to, Python, machine learning, deep learning, computer vision, recommendation system, Linux, engineering, Java, content of up to 5 t +, I put all the resources download link to a document, The directory is as follows:

All dry goods to everyone, hope to be able to support it!

https://http://pan.baidu.com/s/1eks7CUyjbWQ3A7O9cmYljA (code: 0000)