[PYTHON] Add auto-completion to EV3 Micropyhon programming in VS Code

LEGO Mindstorms EV3 officially supports Python (EV3MicroPython = Pybricks), and the extension function of VSCode (Visual Studio Code editor), which is Microsoft's free integrated development environment, and the firmware of EV3 have been released [^] 1].

It's easy to use just by adding an extension to VS Code, so it's recommended as an introduction to text programming using EV3, but there is one dissatisfaction with coding. That is, there is no auto-completion feature.

Here, we will introduce the procedure for auto-completion of EV3 Micropython API with VS Code.

As a prerequisite, Python3, Git % 81% 84% E5% A7% 8B% E3% 82% 81% E3% 82% 8B-Git% E3% 81% AE% E3% 82% A4% E3% 83% B3% E3% 82% B9% E3 % 83% 88% E3% 83% BC% E3% 83% AB) is installed on your PC, and as an extension of VS Code, Microsoft Python It is assumed that itemName = ms-python.python) and EV3 MicroPython are installed. (For MacOS, you also need to install XCode)

procedure

  1. Open the command palette (Crl + Shift + P) and launch Python Terminal [^ 2].
  2. In Python Terminal, execute the following command [^ 3].
$ python -m pip install --upgrade pip
$ pip install git+https://github.com/pybricks/pybricks-api@master

The following is executed for each project (workspace). The setting is completed when a .venv file is generated for each project. 3. Select "New Project" from the EV3 MicroPython extension to launch a new project. 4. Launch the terminal (Crl + Shift + \ ) and run python3 -m venv .ven v`.

When you restart VS Code, the pybricks API will be auto-completed. (The image shows method candidates displayed when left_motor, which is an instance of the Motor class, is described.) スクリーンショット 2020-03-27 14.25.43.png

reference

Pybricks

Recommended Posts

Add auto-completion to EV3 Micropyhon programming in VS Code
Write Spigot in VS Code
Set VS Code to PyCharm.
How to use VS Code in venv environment on windows
I want to be able to run Python in VS Code
Programming to fight in the world ~ 5-1
Programming to fight in the world ~ 5-5,5-6
Programming to fight in the world-Chapter 4
To maintain code quality in PyCharm
How to run TensorFlow 1.0 code in 2.0
Migrate from VS Code to PyCharm
Programming to fight in the world ~ 5-2
How to use VS Code (code server) with Google Colab in just 3 lines
(For myself) Put Flask in VS Code
Pass PYTHONPATH in 1 minute with VS Code
In Jupyter, add IPerl to the kernel.
Dynamically add fields to Form objects in Django
Personal notes to doc Python code in Sphinx
To add a module to python put in Julialang
Use Python in Anaconda environment with VS Code
Add totals to rows and columns in pandas
Convert cubic mesh code to WKT in Python
I tried to build an environment with WSL + Ubuntu + VS Code in a Windows environment
"Book to train programming skills to fight in the world" Python code answer example --1.3 URLify
What to do if Python IntelliSense is not displayed in VS Code on Windows
"Book to train programming skills to fight in the world" Python code answer example --2.6 palindrome