Look at some useful features.
Format code
Before i did mention to install:
So right click and
Here a image on how it work have a long line with dict,list and tuple,right side after format.
![[Image: 6jVJhv.jpg]](https://imagizer.imageshack.com/v2/xq90/923/6jVJhv.jpg)
Mess up some code before and after format.
Messed up:
IntelliSense
One of the strong feature with editor is IntelliSense
It goes beyond auto completion.
You can view available methods, parameter hints, short documentation, source code(where is function/method source code) etc...
If take mouse over
Need to scroll method doc or that it stay open
Now can also look at source code for this
Linter
You annoying friend pylint
Command Palette
So how dos it work:
![[Image: 8IpV89.jpg]](https://imagizer.imageshack.com/v2/xq90/923/8IpV89.jpg)
What it finds is down in left corner
Click on it and it show up in windows under.
So the fix is pretty obvious missing
Format code
Before i did mention to install:
pip install autopep8 yapf blackTake a look at format code with the new star Black.
So right click and
Format Document
,after have choose "python.formatting.provider": "black"
Here a image on how it work have a long line with dict,list and tuple,right side after format.
![[Image: 6jVJhv.jpg]](https://imagizer.imageshack.com/v2/xq90/923/6jVJhv.jpg)
Mess up some code before and after format.
Messed up:
import random import time class Coin: def __init__(self ): self.sideup="Heads" def toss(self): if random.randrange( 2)== 0: self.sideup = "Heads" else: self.sideup= "Tails" def toss_result( ): my_coin=Coin( ) print(f"This side is up: {my_coin.sideup}") print("I am tossing the coin...") time.sleep(4) my_coin.toss() print(f"This side is up: {my_coin.sideup}") if __name__ == "__main__" : toss_result( )After format:
import random import time class Coin: def __init__(self): self.sideup = "Heads" def toss(self): if random.randrange(2) == 0: self.sideup = "Heads" else: self.sideup = "Tails" def toss_result(): my_coin = Coin() print(f"This side is up: {my_coin.sideup}") print("I am tossing the coin...") time.sleep(4) my_coin.toss() print(f"This side is up: {my_coin.sideup}") if __name__ == "__main__": toss_result()
IntelliSense
One of the strong feature with editor is IntelliSense
It goes beyond auto completion.
You can view available methods, parameter hints, short documentation, source code(where is function/method source code) etc...
If take mouse over
get()
method:![[Image: oJhIIU.jpg]](https://imagizer.imageshack.com/v2/xq90/924/oJhIIU.jpg)
Need to scroll method doc or that it stay open
ctrl+space
.Now can also look at source code for this
get()
function alt+f12
(peek).F12
goes to source code where get()
is defined.Linter
You annoying friend pylint
![Wall Wall](https://python-forum.io/images/smilies/eusa_wall.gif)
pip install pylint flake8So i turn it of in normal use,then just turn it on if want a check of code.
Command Palette
ctrl+shift+p
search Pylint
then get an option on/off
.So how dos it work:
![[Image: 8IpV89.jpg]](https://imagizer.imageshack.com/v2/xq90/923/8IpV89.jpg)
What it finds is down in left corner
errors
and Warnings
. Click on it and it show up in windows under.
So the fix is pretty obvious missing
{
.print(f"This side is up: {my_coin.sideup}")Save and this error/advise goes away.