Mostly because of Python programming. Sublime has Python REPL, but it is quite slow and apt to crash when executing big programs. In VScode, it has built-in terminal and is stable and fast. Plus, the Jupyter extension is awesome (tho not as good as Jupyter Notebook). Last but not least, I care about the UI very much. I rock with cool theme and change them frequently, VScode also got it covered.
One of the features of VScode -- a wide variety of extensions, which makes the programming process efficient and satisfying.
Easy to browse and install, click the Extensions on the left side.
Left click the bottom left GEAR icon, find Settings.
- Close Open Folder: press
ctrl+k
then pressf
- Save File:
ctrl+s
- Fontsize Up/Down:
ctrl + "numberpad +"
/ctrl + "numberpad -"
- Toggle Sidebar:
ctrl+b
- Open Terminal:
ctrl+
- Run codes:
F5
-
Go to 桌面.
-
Right click 我的電腦, select 內容.
-
Click 進階系統設定 on the left, and select 環境變數 in the new window.
-
Find PATH in 使用者變數(upper section), and edit.
-
Click 確定 all the way out.
Left click the bottom left GEAR icon, find Color Theme to customize themes/icons.
Use arrow keys to preview changed theme.
file-icons is an extension which provides a lot of qute icons.
One of the default theme, which is the theme in all example pictures. Also, it is the default theme in Sublime Text 3.
Code Runner enables you to run various of codes, Python, C/C++ are included. But need to set up compiler or interpreter beforehand.
pressctrl+alt+n
or right click and select "run code" to execute. Also support block execution in Python.
Jupyter is a sick extension in vscode. But in the this version, the feature has been integrated in the Python extension, so you don't need to download Jupyter.
It allows you to create cells just like Jupyter Notebook by typing the keyword "#%%" in a line. You can also right click and select "Run Current File in Python Interactive Window".
Python is a integrated extension containing linting(語法/排版錯誤提示), Code formatting(自動排版), intellisense(智慧填字), etc.
flake8 is quite strict with the coding style, such as space between operators and operants, docstrings are required in every functions, unused variables, etc...
- type "pip install flake8" in terminal.
- modify user setting(',' might required).
enables flake8.
"python.linting.flake8Enabled": true
ignores certain warning. Error codes can be found in 問題 (buttom left).
"python.linting.flake8Args": [
"--ignore=E226"
]
- type "pip install autopep8" in terminal.
- modify user setting(',' might required).
choose formatting package.
"python.formatting.autopep8Path": "autopep8"
auto format every you save
"editor.formatOnSave": true
VS Code Jupyter Notebook Previewer let you preview .ipynb so you don't need to open jupyter notebook. But only preview, cannot execute,
press "show preview" on the upper right side.
Under construction 🔨
Processing is a java-based language. Using processing can easily accomplish some visual effects or physical simulation. But it isn't supported by Code Runner by default. We need to set up the processing-java in environment path first.
Find the path of processing-3.3.7 folder, mine is
D:\processing-3.3.7\
.
Add it to the PATH.
- Let Code Runner recognize .pde(processing extension).
Add the code below to the user setting.
"code-runner.executorMapByFileExtension": {
".pde": "processing-java --sketch=$dir --output=$dir/output --force --run"
},