[PYTHON] Set VS Code to PyCharm.

Introduction

I said, "Of course, everyone at Pythonista can use ** PyCharm **, which is an excellent IDE for daily development, dexterously to develop explosively."

I said, "It's been more than half a year since I was addicted to PyCharm swamp as a clue to Pythonista."

I said, "But these days."

I said, "Everyone apparently doesn't understand PyCharm's intelligence well, because it's free, so I'm using a tool called VS Code !!!"

I said, "This is crazy !!!!!!!!! Our PyCharm is so amazing !!!!!! I was thinking of doing it, but the more I looked it up ..."

I said, "Oh? VS Code is enough if you combine plug-ins ...? And it's really light ... It's free, and every day I feel ..."

In this way, my VS Code → PyCharm conversion plan started ...

table of contents

-[Table of Contents](#Table of Contents) -[Function required for VS Code](Function required for #vscode) -[Plug-in that seems to be needed](#Plug-in that seems to be needed) -[Plugins required for python development](#Plugins required for python development) -[Plugins required for Django development](#django development plugins) -[Plugins required for front-end development](# Plugins required for front-end development) -[Tools required for editors in general](#Tools required for editors in general) -[Plugins required for markdown](# Plugins required for markdown) --[Plugins required to use git](Plugins required to use #git) -[Plugins required to use the database](# Plugins required to use the database) -[Plugin to become PyCharm](Plugin to become #pycharm) -[Other useful plugins](#Other useful plugins)

Functions required for VS Code

It's been a little over half a year since I've been in PyCharm, so I may disagree with you, but I think the features I'm looking for in the IDE are as follows. (May increase in the future)

--Syntax highlighting --lint · format --Interpreter selection (virtual environment) --Search / replace file name and code --Code completion --Static type analysis --Remote debugging --Refactoring --Test --Support for Docstring --Github cooperation (diff, pull request, pull, commit, push, merge is good for the time being) --Connection to DB (Excel-like display / modification of table / addition / modification of columns and tables / import / dump of csv) --Edit execution / debug configuration --Django development environment

I think it's enough if it can work.

In other words, if you can do this with VS Code, you don't need PyCharm ...

So, for the time being, I searched for plugins that seemed necessary to meet the above conditions!

Details in another article ...

Plugins that you may need

Plugins required for Python development

-ms-python.python: Includes features such as IntelliSense, linting, debugging, code navigation, code formatting, refactoring and more , A tool that has all the necessary functions for Python -magicstack.MagicPython: A tool that highlights all Python 3 syntax features, including type annotations, f strings, and regular expressions. -njpwerner.autodocstring: docstring snippet generation tool -Brainfit.vscode-importmagic: A tool that automatically imports Python -ms-pyright.pyright: Fast type checker with fine-grained settings

Plugins needed to develop Django

-batisteo.vscode-django: Django template syntax, etc. -bibhasdn.django-snippets: Django snippets

Plugins required for front-end development

-VisualStudioExptTeam.vscodeintellicode: AI-assisted code completion tool for js / ts -dbaeumer.vscode-eslint: JavaScript style check tool -esbenp.prettier-vscode: Style check tool for front end in general (HTML / css / js) -octref.vetur: A tool that performs Lint, format, auto-completion, etc. of vue.js -stevencl.addDocComments: Tool to automatically generate jsdoc -formulahendry.auto-rename-tag: A tool that modifies the corresponding tags of HTML and XML at the same time. -formulahendry.auto-close-tag: A tool that automatically generates HTML / XML end tags. -ecmel.vscode-html-css: A tool that complements class attributes such as HTML and CSS -ritwickdey.LiveServer: A tool that can set up a simple local server

Tools needed for editors in general

-shardulm94.trailing-spaces: Tool to highlight when there is a space at the end of the sentence -mosapride.zenkaku: Tool for highlighting double-byte spaces -EditorConfig.EditorConfig: VSCode version of the tool that allows you to unify styles with different editors -CoenraadS.bracket-pair-colorizer-2: A tool that colors the corresponding parentheses and curly braces. -oderwat.indent-rainbow: A tool that colors indents -christian-kohler.path-intellisense: Tool that auto-completes filenames -nickdemayo.vscode-json-editor: A tool that makes JSON previews easier to see and edit -ICS.japanese-proofreading: Tool for checking Japanese such as text markdown -edb.vandelay: A tool that automatically imports JavaScript and Python and removes unnecessary imports. -alefragnani.Bookmarks: Ability to bookmark specific lines of code

Plugins required for markdown

-yzane.markdown-pdf: Markdown and PDF output tool -yzhang.markdown-all-in-one: Markdown shortcut, automatic preview, completion, etc. Tools with street features -jebbs.markdown-extended: A tool that allows you to paste Excel and spreadsheet tables

~~ AlanWalk.markdown-toc: Create a headline from markdown ~~ → Ueno markdown all-in-one made!

-bierner.markdown-preview-github-styles: Change markdown preview to Github style -DavidAnson.vscode-markdownlint: Markdown style check tool -shuworks.vscode-table-formatter: A tool to format table syntax with markdown

Plugins required to use git

-codezombiech.gitignore: A tool that supports the operation of .gitignore files. -donjayamanne.githistory: A tool to support Git history, search, etc. -eamodio.gitlens: Code change / commit history check tool -GitHub.vscode-pull-request-github: Pull request management tool -mhutchie.git-graph: High-performance git graph display tool

Plugins required to use the database

~~ ckolkman.vscode-postgres: Query tool for PostgreSQL ~~ → sqltools seems to be more convenient, so I deleted it! -mtxr.sqltools: Tools that can connect to multiple types of DB

Plugin to become PyCharm

-garytyler.darcula-pycharm: PyCharm theme application tool -k--kato.intellij-idea-keybindings: A tool that sets IntelliJ IDEA key bindings

Other useful plugins

-fabiospampinato.vscode-todo-plus: todo management tool -formulahendry.code-runner: Code execution tool -GrapeCity.gc-excelviewer: csv and Excel file viewing tool -janisdd.vscode-edit-csv: A tool that allows you to view and edit csv as a table. -mechatroner.rainbow-csv: A tool that displays csv and tsv in different colors for each column. -humao.rest-client: REST client tool that also supports GraphQL -ms-azuretools.vscode-docker: Tool to launch docker from vscode -MS-CEINTL.vscode-language-pack-ja: Tool that localizes to Japanese -Shan.code-settings-sync: vscode settings synchronization tool? -Equinusocio.vsc-material-theme: Fashionable theme -PKief.material-icon-theme: A tool that sets icons that are easy to see for each extension. -ms-vscode-remote.vscode-remote-extensionpack: For remote servers and containers in ssh Tools that allow you to debug

Here are just a few of the official Python extensions that are definitely essential for developing in Python!

python

First, let's install Python!

This will almost solve the PyCharm conversion of VS Code! !! !! !! !! !!

In particular

--Syntax highlighting --lint · format --Interpreter selection (virtual environment) --Search / replace file name and code --Code completion --Static type analysis --Remote debugging --Refactoring --Test

Will be able to do it!

Officially amazing! !!

After installation, we will only handle lint, format, and interpreter settings.

lint and format

For now, let's install flake8 and ʻautopep8` for immediate use!

$pip install flake8
$pip install autopep8

Next, open the command palette with Control + command + p → search for ʻopen settings (JSON)` and open settings.json.

Please add / correct the following items.

settings.json


{
    ...
    "editor.tabSize": 4,
    "editor.formatOnType": true,
    "editor.formatOnPaste": true,
    "editor.formatOnSave": true,

    "files.autoSave": "afterDelay",
    "files.autoSaveDelay": 1000,
    "python.linting.lintOnSave": true,
    "python.linting.pylintEnabled": false,
    "python.linting.pep8Enabled": false,
    "python.linting.flake8Enabled": true,
    "python.linting.flake8Args": [
        "--ignore=W293, W504",
        "--max-line-length=150",
        "--max-complexity=20"
    ],
    "python.formatting.provider": "autopep8",
    "python.formatting.autopep8Args": [
        "--aggressive", "--aggressive",
    ],
}

This completes the lint and formatter settings.

Interpreter settings

It is assumed that you will create a virtual environment with pipenv. There are a lot of articles about pipenv on the net, so if you get any errors, check out those great articles.

Let's install pipenv first.

$pip install pipenv

After that, create and apply the virtual environment with the following command.

$pipenv install
$pipenv shell

By doing this, you can see that a directory like / home / <user name> /. local / share / virtualenvs / <directory name>-<hash value> / is generated.

Then open Control + command + p → ʻopen settings (UI) and enter python.python path` to search for settings.

Enter / home / <user name> /. local / share / virtualenvs / <directory name>-<hash value> / bin / python in the item that appears to store the path to the python binary file.

If you search for the interpreter from Control + command + p again, the setting items will appear, but you should be able to select the added interpreter.

At the end

I think that you will be able to develop a team with VS Code to some extent just by inserting the introduced plug-in and making the above settings!

There are many plugins I would like to introduce, but I can't keep up with my writing ability, so I'll leave it at this level! (Especially for those who are migrating from PyCharm to VS Code for some reason, I think ʻintellij-idea-keybindings` is a ridiculous plugin, so please use it.)

By the way! As I've written so far, it's great that VS Code is free to use and you can freely build an environment with a wide variety of plugins.

However, if you focus on ** development in Python **, PyCharm is available by default in almost all of the introductions, and even if you want to change it, you can easily change it from the GUI.

As a disadvantage

--Markdown editing is weak --Since it consumes a lot of memory, the operation of the entire PC may slow down depending on the specifications.

And so on, but that much

--Real-time syntax check --Powerful cooperation function with DB --Search the entire project --Refactoring such as variable name change --Easy-to-use remote debugging

In addition, there is ease of use where you can easily reach the itch.

I wondered if it wouldn't make much sense for those who are already using PyCharm to move to VS Code in Python development!

Oshimai

** 5/10: I saw Extensions that I definitely want to include in VSCode, and there were many god plugins, so let me add various ones. I got it. ** **

Recommended Posts

Set VS Code to PyCharm.
Migrate from VS Code to PyCharm
To maintain code quality in PyCharm
VS Code settings
PyCharm code interpolation
Set up TinyGo development environment for VS Code
Rewrite Python2 code to Python3 (2to3)
How to make a Python package using VS Code
Python with VS Code (Windows 10)
Part 1 Attempt to code mathematics (∈)
Try Fortran with VS Code up to debug settings. [Win10]
Write Spigot in VS Code
Tool to check code style
Command to generate QR code
PyCharm test code automatic generation
Debug Python with VS Code
Settings to debug the contents of the library with VS Code
Set BigIntegerField to auto increment
I want to be able to run Python in VS Code
I want to use VS Code and Spyder without anaconda! !! !!
Convert python 3.x code to python 2.x
How to develop containers on remote servers with VS Code Remote-Containers
How to set Jupytext nicely when managing code as a team
How to build Python and Jupyter execution environment with VS Code
Set opset to embed in ONNX
Code to randomly generate a score
Resolve VS Code unresolved import error
Added code snippet functionality to django-ckeditor
Try running Jupyter with VS Code
Install VS Code on your Chromebook
Linux commands related to character code
How to run TensorFlow 1.0 code in 2.0
[VS Code] ~ Tips when using python ~
Install python with mac vs code
I was addicted to creating a Python venv environment with VS Code
Steps to create a Python virtual environment with VS Code on Windows
I made a tool to convert Jupyter py to ipynb with VS Code
I want to format and check Python code to my liking on VS Code
How to use VS Code (code server) with Google Colab in just 3 lines