How to display a margin ?

Hello,
I don't know if this topic has already been created but I haven't twisted it on Google.
I would like to be able to display a margin that would include numbers and also a small icon to display or remove from the code.
Here is a small example :


I would therefore like to know how to display the numbers and also how to retract part of the code in order to improve visibility